Skip to content

Commit 69f39c5

Browse files
committed
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Martin Schwidefsky: "Nine bug fixes for s390: - Three fixes for the expoline code, one of them is strictly speaking a cleanup but as it relates to code added with 4.16 I would like to include the patch. - Three timer related fixes in the common I/O layer - A fix for the handling of internal DASD request which could cause panics. - One correction in regard to the accounting of pud page tables vs. compat tasks. - The register scrubbing in entry.S caused spurious crashes, this is fixed now as well" * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/entry.S: fix spurious zeroing of r0 s390: Fix runtime warning about negative pgtables_bytes s390: do not bypass BPENTER for interrupt system calls s390/cio: clear timer when terminating driver I/O s390/cio: fix return code after missing interrupt s390/cio: fix ccw_device_start_timeout API s390/clean-up: use CFI_* macros in entry.S s390: Replace IS_ENABLED(EXPOLINE_*) with IS_ENABLED(CONFIG_EXPOLINE_*) s390/dasd: fix handling of internal requests
2 parents b910a91 + d3f4689 commit 69f39c5

File tree

7 files changed

+54
-62
lines changed

7 files changed

+54
-62
lines changed

arch/s390/include/asm/mmu_context.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ static inline int init_new_context(struct task_struct *tsk,
6363
_ASCE_USER_BITS | _ASCE_TYPE_SEGMENT;
6464
/* pgd_alloc() did not account this pmd */
6565
mm_inc_nr_pmds(mm);
66+
mm_inc_nr_puds(mm);
6667
}
6768
crst_table_init((unsigned long *) mm->pgd, pgd_entry_type(mm));
6869
return 0;

arch/s390/kernel/entry.S

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <asm/processor.h>
1515
#include <asm/cache.h>
1616
#include <asm/ctl_reg.h>
17+
#include <asm/dwarf.h>
1718
#include <asm/errno.h>
1819
#include <asm/ptrace.h>
1920
#include <asm/thread_info.h>
@@ -230,7 +231,7 @@ _PIF_WORK = (_PIF_PER_TRAP | _PIF_SYSCALL_RESTART)
230231
.hidden \name
231232
.type \name,@function
232233
\name:
233-
.cfi_startproc
234+
CFI_STARTPROC
234235
#ifdef CONFIG_HAVE_MARCH_Z10_FEATURES
235236
exrl 0,0f
236237
#else
@@ -239,7 +240,7 @@ _PIF_WORK = (_PIF_PER_TRAP | _PIF_SYSCALL_RESTART)
239240
#endif
240241
j .
241242
0: br \reg
242-
.cfi_endproc
243+
CFI_ENDPROC
243244
.endm
244245

245246
GEN_BR_THUNK __s390x_indirect_jump_r1use_r9,%r9,%r1
@@ -426,13 +427,13 @@ ENTRY(system_call)
426427
UPDATE_VTIME %r8,%r9,__LC_SYNC_ENTER_TIMER
427428
BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
428429
stmg %r0,%r7,__PT_R0(%r11)
429-
# clear user controlled register to prevent speculative use
430-
xgr %r0,%r0
431430
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_SYNC
432431
mvc __PT_PSW(16,%r11),__LC_SVC_OLD_PSW
433432
mvc __PT_INT_CODE(4,%r11),__LC_SVC_ILC
434433
stg %r14,__PT_FLAGS(%r11)
435434
.Lsysc_do_svc:
435+
# clear user controlled register to prevent speculative use
436+
xgr %r0,%r0
436437
# load address of system call table
437438
lg %r10,__THREAD_sysc_table(%r13,%r12)
438439
llgh %r8,__PT_INT_CODE+2(%r11)
@@ -1439,6 +1440,7 @@ cleanup_critical:
14391440
stg %r15,__LC_SYSTEM_TIMER
14401441
0: # update accounting time stamp
14411442
mvc __LC_LAST_UPDATE_TIMER(8),__LC_SYNC_ENTER_TIMER
1443+
BPENTER __TI_flags(%r12),_TIF_ISOLATE_BP
14421444
# set up saved register r11
14431445
lg %r15,__LC_KERNEL_STACK
14441446
la %r9,STACK_FRAME_OVERHEAD(%r15)

arch/s390/kernel/nospec-branch.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
#include <linux/module.h>
33
#include <asm/nospec-branch.h>
44

5-
int nospec_call_disable = IS_ENABLED(EXPOLINE_OFF);
6-
int nospec_return_disable = !IS_ENABLED(EXPOLINE_FULL);
5+
int nospec_call_disable = IS_ENABLED(CONFIG_EXPOLINE_OFF);
6+
int nospec_return_disable = !IS_ENABLED(CONFIG_EXPOLINE_FULL);
77

88
static int __init nospectre_v2_setup_early(char *str)
99
{

drivers/s390/block/dasd.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2581,8 +2581,6 @@ int dasd_cancel_req(struct dasd_ccw_req *cqr)
25812581
case DASD_CQR_QUEUED:
25822582
/* request was not started - just set to cleared */
25832583
cqr->status = DASD_CQR_CLEARED;
2584-
if (cqr->callback_data == DASD_SLEEPON_START_TAG)
2585-
cqr->callback_data = DASD_SLEEPON_END_TAG;
25862584
break;
25872585
case DASD_CQR_IN_IO:
25882586
/* request in IO - terminate IO and release again */
@@ -3902,9 +3900,12 @@ static int dasd_generic_requeue_all_requests(struct dasd_device *device)
39023900
wait_event(dasd_flush_wq,
39033901
(cqr->status != DASD_CQR_CLEAR_PENDING));
39043902

3905-
/* mark sleepon requests as ended */
3906-
if (cqr->callback_data == DASD_SLEEPON_START_TAG)
3907-
cqr->callback_data = DASD_SLEEPON_END_TAG;
3903+
/*
3904+
* requeue requests to blocklayer will only work
3905+
* for block device requests
3906+
*/
3907+
if (_dasd_requeue_request(cqr))
3908+
continue;
39083909

39093910
/* remove requests from device and block queue */
39103911
list_del_init(&cqr->devlist);
@@ -3917,13 +3918,6 @@ static int dasd_generic_requeue_all_requests(struct dasd_device *device)
39173918
cqr = refers;
39183919
}
39193920

3920-
/*
3921-
* requeue requests to blocklayer will only work
3922-
* for block device requests
3923-
*/
3924-
if (_dasd_requeue_request(cqr))
3925-
continue;
3926-
39273921
if (cqr->block)
39283922
list_del_init(&cqr->blocklist);
39293923
cqr->block->base->discipline->free_cp(
@@ -3940,8 +3934,7 @@ static int dasd_generic_requeue_all_requests(struct dasd_device *device)
39403934
list_splice_tail(&requeue_queue, &device->ccw_queue);
39413935
spin_unlock_irq(get_ccwdev_lock(device->cdev));
39423936
}
3943-
/* wake up generic waitqueue for eventually ended sleepon requests */
3944-
wake_up(&generic_waitq);
3937+
dasd_schedule_device_bh(device);
39453938
return rc;
39463939
}
39473940

drivers/s390/cio/device_fsm.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -795,6 +795,7 @@ ccw_device_online_timeout(struct ccw_device *cdev, enum dev_event dev_event)
795795

796796
ccw_device_set_timeout(cdev, 0);
797797
cdev->private->iretry = 255;
798+
cdev->private->async_kill_io_rc = -ETIMEDOUT;
798799
ret = ccw_device_cancel_halt_clear(cdev);
799800
if (ret == -EBUSY) {
800801
ccw_device_set_timeout(cdev, 3*HZ);
@@ -871,7 +872,7 @@ ccw_device_killing_irq(struct ccw_device *cdev, enum dev_event dev_event)
871872
/* OK, i/o is dead now. Call interrupt handler. */
872873
if (cdev->handler)
873874
cdev->handler(cdev, cdev->private->intparm,
874-
ERR_PTR(-EIO));
875+
ERR_PTR(cdev->private->async_kill_io_rc));
875876
}
876877

877878
static void
@@ -888,14 +889,16 @@ ccw_device_killing_timeout(struct ccw_device *cdev, enum dev_event dev_event)
888889
ccw_device_online_verify(cdev, 0);
889890
if (cdev->handler)
890891
cdev->handler(cdev, cdev->private->intparm,
891-
ERR_PTR(-EIO));
892+
ERR_PTR(cdev->private->async_kill_io_rc));
892893
}
893894

894895
void ccw_device_kill_io(struct ccw_device *cdev)
895896
{
896897
int ret;
897898

899+
ccw_device_set_timeout(cdev, 0);
898900
cdev->private->iretry = 255;
901+
cdev->private->async_kill_io_rc = -EIO;
899902
ret = ccw_device_cancel_halt_clear(cdev);
900903
if (ret == -EBUSY) {
901904
ccw_device_set_timeout(cdev, 3*HZ);

drivers/s390/cio/device_ops.c

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
159159
}
160160

161161
/**
162-
* ccw_device_start_key() - start a s390 channel program with key
162+
* ccw_device_start_timeout_key() - start a s390 channel program with timeout and key
163163
* @cdev: target ccw device
164164
* @cpa: logical start address of channel program
165165
* @intparm: user specific interruption parameter; will be presented back to
@@ -170,10 +170,15 @@ int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
170170
* @key: storage key to be used for the I/O
171171
* @flags: additional flags; defines the action to be performed for I/O
172172
* processing.
173+
* @expires: timeout value in jiffies
173174
*
174175
* Start a S/390 channel program. When the interrupt arrives, the
175176
* IRQ handler is called, either immediately, delayed (dev-end missing,
176177
* or sense required) or never (no IRQ handler registered).
178+
* This function notifies the device driver if the channel program has not
179+
* completed during the time specified by @expires. If a timeout occurs, the
180+
* channel program is terminated via xsch, hsch or csch, and the device's
181+
* interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
177182
* Returns:
178183
* %0, if the operation was successful;
179184
* -%EBUSY, if the device is busy, or status pending;
@@ -182,9 +187,9 @@ int ccw_device_clear(struct ccw_device *cdev, unsigned long intparm)
182187
* Context:
183188
* Interrupts disabled, ccw device lock held
184189
*/
185-
int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
186-
unsigned long intparm, __u8 lpm, __u8 key,
187-
unsigned long flags)
190+
int ccw_device_start_timeout_key(struct ccw_device *cdev, struct ccw1 *cpa,
191+
unsigned long intparm, __u8 lpm, __u8 key,
192+
unsigned long flags, int expires)
188193
{
189194
struct subchannel *sch;
190195
int ret;
@@ -224,6 +229,8 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
224229
switch (ret) {
225230
case 0:
226231
cdev->private->intparm = intparm;
232+
if (expires)
233+
ccw_device_set_timeout(cdev, expires);
227234
break;
228235
case -EACCES:
229236
case -ENODEV:
@@ -234,7 +241,7 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
234241
}
235242

236243
/**
237-
* ccw_device_start_timeout_key() - start a s390 channel program with timeout and key
244+
* ccw_device_start_key() - start a s390 channel program with key
238245
* @cdev: target ccw device
239246
* @cpa: logical start address of channel program
240247
* @intparm: user specific interruption parameter; will be presented back to
@@ -245,15 +252,10 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
245252
* @key: storage key to be used for the I/O
246253
* @flags: additional flags; defines the action to be performed for I/O
247254
* processing.
248-
* @expires: timeout value in jiffies
249255
*
250256
* Start a S/390 channel program. When the interrupt arrives, the
251257
* IRQ handler is called, either immediately, delayed (dev-end missing,
252258
* or sense required) or never (no IRQ handler registered).
253-
* This function notifies the device driver if the channel program has not
254-
* completed during the time specified by @expires. If a timeout occurs, the
255-
* channel program is terminated via xsch, hsch or csch, and the device's
256-
* interrupt handler will be called with an irb containing ERR_PTR(-%ETIMEDOUT).
257259
* Returns:
258260
* %0, if the operation was successful;
259261
* -%EBUSY, if the device is busy, or status pending;
@@ -262,19 +264,12 @@ int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
262264
* Context:
263265
* Interrupts disabled, ccw device lock held
264266
*/
265-
int ccw_device_start_timeout_key(struct ccw_device *cdev, struct ccw1 *cpa,
266-
unsigned long intparm, __u8 lpm, __u8 key,
267-
unsigned long flags, int expires)
267+
int ccw_device_start_key(struct ccw_device *cdev, struct ccw1 *cpa,
268+
unsigned long intparm, __u8 lpm, __u8 key,
269+
unsigned long flags)
268270
{
269-
int ret;
270-
271-
if (!cdev)
272-
return -ENODEV;
273-
ccw_device_set_timeout(cdev, expires);
274-
ret = ccw_device_start_key(cdev, cpa, intparm, lpm, key, flags);
275-
if (ret != 0)
276-
ccw_device_set_timeout(cdev, 0);
277-
return ret;
271+
return ccw_device_start_timeout_key(cdev, cpa, intparm, lpm, key,
272+
flags, 0);
278273
}
279274

280275
/**
@@ -489,18 +484,20 @@ void ccw_device_get_id(struct ccw_device *cdev, struct ccw_dev_id *dev_id)
489484
EXPORT_SYMBOL(ccw_device_get_id);
490485

491486
/**
492-
* ccw_device_tm_start_key() - perform start function
487+
* ccw_device_tm_start_timeout_key() - perform start function
493488
* @cdev: ccw device on which to perform the start function
494489
* @tcw: transport-command word to be started
495490
* @intparm: user defined parameter to be passed to the interrupt handler
496491
* @lpm: mask of paths to use
497492
* @key: storage key to use for storage access
493+
* @expires: time span in jiffies after which to abort request
498494
*
499495
* Start the tcw on the given ccw device. Return zero on success, non-zero
500496
* otherwise.
501497
*/
502-
int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw,
503-
unsigned long intparm, u8 lpm, u8 key)
498+
int ccw_device_tm_start_timeout_key(struct ccw_device *cdev, struct tcw *tcw,
499+
unsigned long intparm, u8 lpm, u8 key,
500+
int expires)
504501
{
505502
struct subchannel *sch;
506503
int rc;
@@ -527,37 +524,32 @@ int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw,
527524
return -EACCES;
528525
}
529526
rc = cio_tm_start_key(sch, tcw, lpm, key);
530-
if (rc == 0)
527+
if (rc == 0) {
531528
cdev->private->intparm = intparm;
529+
if (expires)
530+
ccw_device_set_timeout(cdev, expires);
531+
}
532532
return rc;
533533
}
534-
EXPORT_SYMBOL(ccw_device_tm_start_key);
534+
EXPORT_SYMBOL(ccw_device_tm_start_timeout_key);
535535

536536
/**
537-
* ccw_device_tm_start_timeout_key() - perform start function
537+
* ccw_device_tm_start_key() - perform start function
538538
* @cdev: ccw device on which to perform the start function
539539
* @tcw: transport-command word to be started
540540
* @intparm: user defined parameter to be passed to the interrupt handler
541541
* @lpm: mask of paths to use
542542
* @key: storage key to use for storage access
543-
* @expires: time span in jiffies after which to abort request
544543
*
545544
* Start the tcw on the given ccw device. Return zero on success, non-zero
546545
* otherwise.
547546
*/
548-
int ccw_device_tm_start_timeout_key(struct ccw_device *cdev, struct tcw *tcw,
549-
unsigned long intparm, u8 lpm, u8 key,
550-
int expires)
547+
int ccw_device_tm_start_key(struct ccw_device *cdev, struct tcw *tcw,
548+
unsigned long intparm, u8 lpm, u8 key)
551549
{
552-
int ret;
553-
554-
ccw_device_set_timeout(cdev, expires);
555-
ret = ccw_device_tm_start_key(cdev, tcw, intparm, lpm, key);
556-
if (ret != 0)
557-
ccw_device_set_timeout(cdev, 0);
558-
return ret;
550+
return ccw_device_tm_start_timeout_key(cdev, tcw, intparm, lpm, key, 0);
559551
}
560-
EXPORT_SYMBOL(ccw_device_tm_start_timeout_key);
552+
EXPORT_SYMBOL(ccw_device_tm_start_key);
561553

562554
/**
563555
* ccw_device_tm_start() - perform start function

drivers/s390/cio/io_sch.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ struct ccw_device_private {
157157
unsigned long intparm; /* user interruption parameter */
158158
struct qdio_irq *qdio_data;
159159
struct irb irb; /* device status */
160+
int async_kill_io_rc;
160161
struct senseid senseid; /* SenseID info */
161162
struct pgid pgid[8]; /* path group IDs per chpid*/
162163
struct ccw1 iccws[2]; /* ccws for SNID/SID/SPGID commands */

0 commit comments

Comments
 (0)