Skip to content

Commit 625acff

Browse files
committed
Merge tag 's390-5.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 fixes from Vasily Gorbik: - Fix a couple of late pt_regs flags handling findings of conversion to generic entry. - Fix potential register clobbering in stack switch helper. - Fix thread/group masks for offline cpus. - Fix cleanup of mdev resources when remove callback is invoked in vfio-ap code. * tag 's390-5.13-5' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/stack: fix possible register corruption with stack switch helper s390/topology: clear thread/group maps for offline cpus s390/vfio-ap: clean up mdev resources when remove callback invoked s390: clear pt_regs::flags on irq entry s390: fix system call restart with multiple signals
2 parents b7050b2 + 67147e9 commit 625acff

File tree

5 files changed

+21
-21
lines changed

5 files changed

+21
-21
lines changed

arch/s390/include/asm/stacktrace.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,16 @@ struct stack_frame {
9191
CALL_ARGS_4(arg1, arg2, arg3, arg4); \
9292
register unsigned long r4 asm("6") = (unsigned long)(arg5)
9393

94-
#define CALL_FMT_0 "=&d" (r2) :
95-
#define CALL_FMT_1 "+&d" (r2) :
96-
#define CALL_FMT_2 CALL_FMT_1 "d" (r3),
97-
#define CALL_FMT_3 CALL_FMT_2 "d" (r4),
98-
#define CALL_FMT_4 CALL_FMT_3 "d" (r5),
99-
#define CALL_FMT_5 CALL_FMT_4 "d" (r6),
94+
/*
95+
* To keep this simple mark register 2-6 as being changed (volatile)
96+
* by the called function, even though register 6 is saved/nonvolatile.
97+
*/
98+
#define CALL_FMT_0 "=&d" (r2)
99+
#define CALL_FMT_1 "+&d" (r2)
100+
#define CALL_FMT_2 CALL_FMT_1, "+&d" (r3)
101+
#define CALL_FMT_3 CALL_FMT_2, "+&d" (r4)
102+
#define CALL_FMT_4 CALL_FMT_3, "+&d" (r5)
103+
#define CALL_FMT_5 CALL_FMT_4, "+&d" (r6)
100104

101105
#define CALL_CLOBBER_5 "0", "1", "14", "cc", "memory"
102106
#define CALL_CLOBBER_4 CALL_CLOBBER_5
@@ -118,7 +122,7 @@ struct stack_frame {
118122
" brasl 14,%[_fn]\n" \
119123
" la 15,0(%[_prev])\n" \
120124
: [_prev] "=&a" (prev), CALL_FMT_##nr \
121-
[_stack] "R" (stack), \
125+
: [_stack] "R" (stack), \
122126
[_bc] "i" (offsetof(struct stack_frame, back_chain)), \
123127
[_frame] "d" (frame), \
124128
[_fn] "X" (fn) : CALL_CLOBBER_##nr); \

arch/s390/kernel/entry.S

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,7 @@ ENTRY(\name)
418418
xgr %r6,%r6
419419
xgr %r7,%r7
420420
xgr %r10,%r10
421+
xc __PT_FLAGS(8,%r11),__PT_FLAGS(%r11)
421422
mvc __PT_R8(64,%r11),__LC_SAVE_AREA_ASYNC
422423
stmg %r8,%r9,__PT_PSW(%r11)
423424
tm %r8,0x0001 # coming from user space?

arch/s390/kernel/signal.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,6 @@ void arch_do_signal_or_restart(struct pt_regs *regs, bool has_signal)
512512

513513
/* No handlers present - check for system call restart */
514514
clear_pt_regs_flag(regs, PIF_SYSCALL);
515-
clear_pt_regs_flag(regs, PIF_SYSCALL_RESTART);
516515
if (current->thread.system_call) {
517516
regs->int_code = current->thread.system_call;
518517
switch (regs->gprs[2]) {

arch/s390/kernel/topology.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ static void cpu_group_map(cpumask_t *dst, struct mask_info *info, unsigned int c
6666
{
6767
static cpumask_t mask;
6868

69-
cpumask_copy(&mask, cpumask_of(cpu));
69+
cpumask_clear(&mask);
70+
if (!cpu_online(cpu))
71+
goto out;
72+
cpumask_set_cpu(cpu, &mask);
7073
switch (topology_mode) {
7174
case TOPOLOGY_MODE_HW:
7275
while (info) {
@@ -83,10 +86,10 @@ static void cpu_group_map(cpumask_t *dst, struct mask_info *info, unsigned int c
8386
default:
8487
fallthrough;
8588
case TOPOLOGY_MODE_SINGLE:
86-
cpumask_copy(&mask, cpumask_of(cpu));
8789
break;
8890
}
8991
cpumask_and(&mask, &mask, cpu_online_mask);
92+
out:
9093
cpumask_copy(dst, &mask);
9194
}
9295

@@ -95,7 +98,10 @@ static void cpu_thread_map(cpumask_t *dst, unsigned int cpu)
9598
static cpumask_t mask;
9699
int i;
97100

98-
cpumask_copy(&mask, cpumask_of(cpu));
101+
cpumask_clear(&mask);
102+
if (!cpu_online(cpu))
103+
goto out;
104+
cpumask_set_cpu(cpu, &mask);
99105
if (topology_mode != TOPOLOGY_MODE_HW)
100106
goto out;
101107
cpu -= cpu % (smp_cpu_mtid + 1);

drivers/s390/crypto/vfio_ap_ops.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -366,16 +366,6 @@ static int vfio_ap_mdev_remove(struct mdev_device *mdev)
366366
struct ap_matrix_mdev *matrix_mdev = mdev_get_drvdata(mdev);
367367

368368
mutex_lock(&matrix_dev->lock);
369-
370-
/*
371-
* If the KVM pointer is in flux or the guest is running, disallow
372-
* un-assignment of control domain.
373-
*/
374-
if (matrix_mdev->kvm_busy || matrix_mdev->kvm) {
375-
mutex_unlock(&matrix_dev->lock);
376-
return -EBUSY;
377-
}
378-
379369
vfio_ap_mdev_reset_queues(mdev);
380370
list_del(&matrix_mdev->node);
381371
kfree(matrix_mdev);

0 commit comments

Comments
 (0)