Skip to content

Commit 990f227

Browse files
committed
Merge tag 's390-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull more s390 updates from Heiko Carstens: - Allow s390 debug feature to handle finally more than 256 CPU numbers, instead of truncating the most significant bits. - Improve THP splitting required by qemu processes by making use of walk_page_vma() instead of calling follow_page() for every single page within each vma. - Add missing ZCRYPT dependency to VFIO_AP to fix potential compile problems. - Remove not required select CLOCKSOURCE_VALIDATE_LAST_CYCLE again. - Set node distance to LOCAL_DISTANCE instead of 0, since e.g. libnuma translates a node distance of 0 to "no NUMA support available". - Couple of other minor fixes and improvements. * tag 's390-5.9-2' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: s390/numa: move code to arch/s390/kernel s390/time: remove select CLOCKSOURCE_VALIDATE_LAST_CYCLE again s390/debug: debug feature version 3 s390/Kconfig: add missing ZCRYPT dependency to VFIO_AP s390/numa: set node distance to LOCAL_DISTANCE s390/pkey: remove redundant variable initialization s390/test_unwind: fix possible memleak in test_unwind() s390/gmap: improve THP splitting s390/atomic: circumvent gcc 10 build regression
2 parents 23c2c8c + b450eeb commit 990f227

File tree

12 files changed

+59
-46
lines changed

12 files changed

+59
-46
lines changed

arch/s390/Kbuild

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,4 @@ obj-$(CONFIG_S390_HYPFS_FS) += hypfs/
77
obj-$(CONFIG_APPLDATA_BASE) += appldata/
88
obj-y += net/
99
obj-$(CONFIG_PCI) += pci/
10-
obj-$(CONFIG_NUMA) += numa/
1110
obj-$(CONFIG_ARCH_HAS_KEXEC_PURGATORY) += purgatory/

arch/s390/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ config S390
126126
select HAVE_ARCH_JUMP_LABEL_RELATIVE
127127
select HAVE_ARCH_KASAN
128128
select HAVE_ARCH_KASAN_VMALLOC
129-
select CLOCKSOURCE_VALIDATE_LAST_CYCLE
130129
select CPU_NO_EFFICIENT_FFS if !HAVE_MARCH_Z9_109_FEATURES
131130
select HAVE_ARCH_SECCOMP_FILTER
132131
select HAVE_ARCH_SOFT_DIRTY
@@ -766,6 +765,7 @@ config VFIO_AP
766765
def_tristate n
767766
prompt "VFIO support for AP devices"
768767
depends on S390_AP_IOMMU && VFIO_MDEV_DEVICE && KVM
768+
depends on ZCRYPT
769769
help
770770
This driver grants access to Adjunct Processor (AP) devices
771771
via the VFIO mediated device interface.

arch/s390/include/asm/atomic.h

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ static inline int atomic_fetch_add(int i, atomic_t *v)
4545
static inline void atomic_add(int i, atomic_t *v)
4646
{
4747
#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
48-
if (__builtin_constant_p(i) && (i > -129) && (i < 128)) {
48+
/*
49+
* Order of conditions is important to circumvent gcc 10 bug:
50+
* https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549318.html
51+
*/
52+
if ((i > -129) && (i < 128) && __builtin_constant_p(i)) {
4953
__atomic_add_const(i, &v->counter);
5054
return;
5155
}
@@ -112,7 +116,11 @@ static inline s64 atomic64_fetch_add(s64 i, atomic64_t *v)
112116
static inline void atomic64_add(s64 i, atomic64_t *v)
113117
{
114118
#ifdef CONFIG_HAVE_MARCH_Z196_FEATURES
115-
if (__builtin_constant_p(i) && (i > -129) && (i < 128)) {
119+
/*
120+
* Order of conditions is important to circumvent gcc 10 bug:
121+
* https://gcc.gnu.org/pipermail/gcc-patches/2020-July/549318.html
122+
*/
123+
if ((i > -129) && (i < 128) && __builtin_constant_p(i)) {
116124
__atomic64_add_const(i, (long *)&v->counter);
117125
return;
118126
}

arch/s390/include/asm/debug.h

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* S/390 debug facility
44
*
5-
* Copyright IBM Corp. 1999, 2000
5+
* Copyright IBM Corp. 1999, 2020
66
*/
77
#ifndef DEBUG_H
88
#define DEBUG_H
@@ -26,19 +26,14 @@
2626
#define DEBUG_DATA(entry) (char *)(entry + 1) /* data is stored behind */
2727
/* the entry information */
2828

29-
#define __DEBUG_FEATURE_VERSION 2 /* version of debug feature */
29+
#define __DEBUG_FEATURE_VERSION 3 /* version of debug feature */
3030

3131
struct __debug_entry {
32-
union {
33-
struct {
34-
unsigned long clock : 52;
35-
unsigned long exception : 1;
36-
unsigned long level : 3;
37-
unsigned long cpuid : 8;
38-
} fields;
39-
unsigned long stck;
40-
} id;
32+
unsigned long clock : 60;
33+
unsigned long exception : 1;
34+
unsigned long level : 3;
4135
void *caller;
36+
unsigned short cpu;
4237
} __packed;
4338

4439
typedef struct __debug_entry debug_entry_t;

arch/s390/include/asm/topology.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,6 @@ static inline const struct cpumask *cpumask_of_node(int node)
8686

8787
#define pcibus_to_node(bus) __pcibus_to_node(bus)
8888

89-
#define node_distance(a, b) __node_distance(a, b)
90-
static inline int __node_distance(int a, int b)
91-
{
92-
return 0;
93-
}
94-
9589
#else /* !CONFIG_NUMA */
9690

9791
#define numa_node_id numa_node_id

arch/s390/kernel/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ CFLAGS_REMOVE_nospec-branch.o += $(CC_FLAGS_EXPOLINE)
4949

5050
obj-$(CONFIG_MODULES) += module.o
5151
obj-$(CONFIG_SCHED_TOPOLOGY) += topology.o
52+
obj-$(CONFIG_NUMA) += numa.o
5253
obj-$(CONFIG_AUDIT) += audit.o
5354
compat-obj-$(CONFIG_AUDIT) += compat_audit.o
5455
obj-$(CONFIG_COMPAT) += compat_linux.o compat_signal.o

arch/s390/kernel/debug.c

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
/*
33
* S/390 debug facility
44
*
5-
* Copyright IBM Corp. 1999, 2012
5+
* Copyright IBM Corp. 1999, 2020
66
*
77
* Author(s): Michael Holzheu ([email protected]),
88
* Holger Smolinski ([email protected])
@@ -433,7 +433,7 @@ static int debug_format_entry(file_private_info_t *p_info)
433433
act_entry = (debug_entry_t *) ((char *)id_snap->areas[p_info->act_area]
434434
[p_info->act_page] + p_info->act_entry);
435435

436-
if (act_entry->id.stck == 0LL)
436+
if (act_entry->clock == 0LL)
437437
goto out; /* empty entry */
438438
if (view->header_proc)
439439
len += view->header_proc(id_snap, view, p_info->act_area,
@@ -829,12 +829,17 @@ static inline debug_entry_t *get_active_entry(debug_info_t *id)
829829
static inline void debug_finish_entry(debug_info_t *id, debug_entry_t *active,
830830
int level, int exception)
831831
{
832-
active->id.stck = get_tod_clock_fast() -
833-
*(unsigned long long *) &tod_clock_base[1];
834-
active->id.fields.cpuid = smp_processor_id();
832+
unsigned char clk[STORE_CLOCK_EXT_SIZE];
833+
unsigned long timestamp;
834+
835+
get_tod_clock_ext(clk);
836+
timestamp = *(unsigned long *) &clk[0] >> 4;
837+
timestamp -= TOD_UNIX_EPOCH >> 12;
838+
active->clock = timestamp;
839+
active->cpu = smp_processor_id();
835840
active->caller = __builtin_return_address(0);
836-
active->id.fields.exception = exception;
837-
active->id.fields.level = level;
841+
active->exception = exception;
842+
active->level = level;
838843
proceed_active_entry(id);
839844
if (exception)
840845
proceed_active_area(id);
@@ -1398,25 +1403,24 @@ static int debug_hex_ascii_format_fn(debug_info_t *id, struct debug_view *view,
13981403
int debug_dflt_header_fn(debug_info_t *id, struct debug_view *view,
13991404
int area, debug_entry_t *entry, char *out_buf)
14001405
{
1401-
unsigned long base, sec, usec;
1406+
unsigned long sec, usec;
14021407
unsigned long caller;
14031408
unsigned int level;
14041409
char *except_str;
14051410
int rc = 0;
14061411

1407-
level = entry->id.fields.level;
1408-
base = (*(unsigned long *) &tod_clock_base[0]) >> 4;
1409-
sec = (entry->id.stck >> 12) + base - (TOD_UNIX_EPOCH >> 12);
1412+
level = entry->level;
1413+
sec = entry->clock;
14101414
usec = do_div(sec, USEC_PER_SEC);
14111415

1412-
if (entry->id.fields.exception)
1416+
if (entry->exception)
14131417
except_str = "*";
14141418
else
14151419
except_str = "-";
14161420
caller = (unsigned long) entry->caller;
1417-
rc += sprintf(out_buf, "%02i %011ld:%06lu %1u %1s %02i %pK ",
1421+
rc += sprintf(out_buf, "%02i %011ld:%06lu %1u %1s %04u %pK ",
14181422
area, sec, usec, level, except_str,
1419-
entry->id.fields.cpuid, (void *)caller);
1423+
entry->cpu, (void *)caller);
14201424
return rc;
14211425
}
14221426
EXPORT_SYMBOL(debug_dflt_header_fn);
File renamed without changes.

arch/s390/lib/test_unwind.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ static noinline int test_unwind(struct task_struct *task, struct pt_regs *regs,
6464
break;
6565
if (state.reliable && !addr) {
6666
pr_err("unwind state reliable but addr is 0\n");
67+
kfree(bt);
6768
return -EINVAL;
6869
}
6970
sprint_symbol(sym, addr);

arch/s390/mm/gmap.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,23 +2485,36 @@ void gmap_sync_dirty_log_pmd(struct gmap *gmap, unsigned long bitmap[4],
24852485
}
24862486
EXPORT_SYMBOL_GPL(gmap_sync_dirty_log_pmd);
24872487

2488+
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
2489+
static int thp_split_walk_pmd_entry(pmd_t *pmd, unsigned long addr,
2490+
unsigned long end, struct mm_walk *walk)
2491+
{
2492+
struct vm_area_struct *vma = walk->vma;
2493+
2494+
split_huge_pmd(vma, pmd, addr);
2495+
return 0;
2496+
}
2497+
2498+
static const struct mm_walk_ops thp_split_walk_ops = {
2499+
.pmd_entry = thp_split_walk_pmd_entry,
2500+
};
2501+
24882502
static inline void thp_split_mm(struct mm_struct *mm)
24892503
{
2490-
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
24912504
struct vm_area_struct *vma;
2492-
unsigned long addr;
24932505

24942506
for (vma = mm->mmap; vma != NULL; vma = vma->vm_next) {
2495-
for (addr = vma->vm_start;
2496-
addr < vma->vm_end;
2497-
addr += PAGE_SIZE)
2498-
follow_page(vma, addr, FOLL_SPLIT);
24992507
vma->vm_flags &= ~VM_HUGEPAGE;
25002508
vma->vm_flags |= VM_NOHUGEPAGE;
2509+
walk_page_vma(vma, &thp_split_walk_ops, NULL);
25012510
}
25022511
mm->def_flags |= VM_NOHUGEPAGE;
2503-
#endif
25042512
}
2513+
#else
2514+
static inline void thp_split_mm(struct mm_struct *mm)
2515+
{
2516+
}
2517+
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
25052518

25062519
/*
25072520
* Remove all empty zero pages from the mapping for lazy refaulting

0 commit comments

Comments
 (0)