Skip to content

Commit 45365a0

Browse files
committed
Merge tag 's390-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux
Pull s390 updates from Heiko Carstens: - Add support for function error injection. - Add support for custom exception handlers, as required by BPF_PROBE_MEM. - Add support for BPF_PROBE_MEM. - Add trace events for idle enter / exit for the s390 specific idle implementation. - Remove unused zcore memmmap device. - Remove unused "raw view" from s390 debug feature. - AP bus + zcrypt device driver code refactoring. - Provide cex4 cca sysfs attributes for cex3 for zcrypt device driver. - Expose only minimal interface to walk physmem for mm/memblock. This is a common code change and it has been agreed on with Mike Rapoport and Andrew Morton that this can go upstream via the s390 tree. - Rework of the s390 vmem/vmmemap code to allow for future memory hot remove. - Get rid of FORCE_MAX_ZONEORDER to finally allow for order-10 allocations again, instead of only order-8 allocations. - Various small improvements and fixes. * tag 's390-5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux: (48 commits) s390/vmemmap: coding style updates s390/vmemmap: avoid memset(PAGE_UNUSED) when adding consecutive sections s390/vmemmap: remember unused sub-pmd ranges s390/vmemmap: fallback to PTEs if mapping large PMD fails s390/vmem: cleanup empty page tables s390/vmemmap: take the vmem_mutex when populating/freeing s390/vmemmap: cleanup when vmemmap_populate() fails s390/vmemmap: extend modify_pagetable() to handle vmemmap s390/vmem: consolidate vmem_add_range() and vmem_remove_range() s390/vmem: rename vmem_add_mem() to vmem_add_range() s390: enable HAVE_FUNCTION_ERROR_INJECTION s390/pci: clarify comment in s390_mmio_read/write s390/time: improve comparison for tod steering s390/time: select CLOCKSOURCE_VALIDATE_LAST_CYCLE s390/time: use CLOCKSOURCE_MASK s390/bpf: implement BPF_PROBE_MEM s390/kernel: expand exception table logic to allow new handling options s390/kernel: unify EX_TABLE* implementations s390/mm: allow order 10 allocations s390/mm: avoid trimming to MAX_ORDER ...
2 parents cdc8fcb + 9a996c6 commit 45365a0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1595
-1259
lines changed

Documentation/s390/s390dbf.rst

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ corresponding component. The debugfs normally should be mounted to
6767
The content of the directories are files which represent different views
6868
to the debug log. Each component can decide which views should be
6969
used through registering them with the function :c:func:`debug_register_view()`.
70-
Predefined views for hex/ascii, sprintf and raw binary data are provided.
70+
Predefined views for hex/ascii and sprintf data are provided.
7171
It is also possible to define other views. The content of
7272
a view can be inspected simply by reading the corresponding debugfs file.
7373

@@ -119,8 +119,6 @@ Predefined views:
119119
120120
extern struct debug_view debug_hex_ascii_view;
121121
122-
extern struct debug_view debug_raw_view;
123-
124122
extern struct debug_view debug_sprintf_view;
125123
126124
Examples
@@ -129,7 +127,7 @@ Examples
129127
.. code-block:: c
130128
131129
/*
132-
* hex_ascii- + raw-view Example
130+
* hex_ascii-view Example
133131
*/
134132
135133
#include <linux/init.h>
@@ -143,7 +141,6 @@ Examples
143141
144142
debug_info = debug_register("test", 1, 4, 4 );
145143
debug_register_view(debug_info, &debug_hex_ascii_view);
146-
debug_register_view(debug_info, &debug_raw_view);
147144
148145
debug_text_event(debug_info, 4 , "one ");
149146
debug_int_exception(debug_info, 4, 4711);
@@ -201,7 +198,7 @@ debugfs-files:
201198
Example::
202199

203200
> ls /sys/kernel/debug/s390dbf/dasd
204-
flush hex_ascii level pages raw
201+
flush hex_ascii level pages
205202
> cat /sys/kernel/debug/s390dbf/dasd/hex_ascii | sort -k2,2 -s
206203
00 00974733272:680099 2 - 02 0006ad7e 07 ea 4a 90 | ....
207204
00 00974733272:682210 2 - 02 0006ade6 46 52 45 45 | FREE
@@ -298,10 +295,9 @@ order to see the debug entries well formatted.
298295
Predefined Views
299296
----------------
300297

301-
There are three predefined views: hex_ascii, raw and sprintf.
298+
There are two predefined views: hex_ascii and sprintf.
302299
The hex_ascii view shows the data field in hex and ascii representation
303300
(e.g. ``45 43 4b 44 | ECKD``).
304-
The raw view returns a bytestream as the debug areas are stored in memory.
305301

306302
The sprintf view formats the debug entries in the same way as the sprintf
307303
function would do. The sprintf event/exception functions write to the
@@ -334,11 +330,6 @@ The format of the hex_ascii and sprintf view is as follows:
334330
- Return Address to caller
335331
- data field
336332

337-
The format of the raw view is:
338-
339-
- Header as described in debug.h
340-
- datafield
341-
342333
A typical line of the hex_ascii view will look like the following (first line
343334
is only for explanation and will not be displayed when 'cating' the view)::
344335

arch/s390/Kconfig

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@ config S390
102102
select ARCH_INLINE_WRITE_UNLOCK_BH
103103
select ARCH_INLINE_WRITE_UNLOCK_IRQ
104104
select ARCH_INLINE_WRITE_UNLOCK_IRQRESTORE
105-
select ARCH_KEEP_MEMBLOCK
106105
select ARCH_STACKWALK
107106
select ARCH_SUPPORTS_ATOMIC_RMW
108107
select ARCH_SUPPORTS_NUMA_BALANCING
@@ -126,6 +125,7 @@ config S390
126125
select HAVE_ARCH_JUMP_LABEL_RELATIVE
127126
select HAVE_ARCH_KASAN
128127
select HAVE_ARCH_KASAN_VMALLOC
128+
select CLOCKSOURCE_VALIDATE_LAST_CYCLE
129129
select CPU_NO_EFFICIENT_FFS if !HAVE_MARCH_Z9_109_FEATURES
130130
select HAVE_ARCH_SECCOMP_FILTER
131131
select HAVE_ARCH_SOFT_DIRTY
@@ -145,6 +145,7 @@ config S390
145145
select HAVE_EFFICIENT_UNALIGNED_ACCESS
146146
select HAVE_FENTRY
147147
select HAVE_FTRACE_MCOUNT_RECORD
148+
select HAVE_FUNCTION_ERROR_INJECTION
148149
select HAVE_FUNCTION_GRAPH_TRACER
149150
select HAVE_FUNCTION_TRACER
150151
select HAVE_FUTEX_CMPXCHG if FUTEX
@@ -626,10 +627,6 @@ config ARCH_ENABLE_MEMORY_HOTREMOVE
626627
config ARCH_ENABLE_SPLIT_PMD_PTLOCK
627628
def_bool y
628629

629-
config FORCE_MAX_ZONEORDER
630-
int
631-
default "9"
632-
633630
config MAX_PHYSMEM_BITS
634631
int "Maximum size of supported physical memory in bits (42-53)"
635632
range 42 53

arch/s390/appldata/appldata_os.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,7 @@ static void appldata_get_os_data(void *data)
129129

130130
os_data->nr_cpus = j;
131131

132-
new_size = sizeof(struct appldata_os_data) +
133-
(os_data->nr_cpus * sizeof(struct appldata_os_per_cpu));
132+
new_size = struct_size(os_data, os_cpu, os_data->nr_cpus);
134133
if (ops.size != new_size) {
135134
if (ops.active) {
136135
rc = appldata_diag(APPLDATA_RECORD_OS_ID,
@@ -165,8 +164,7 @@ static int __init appldata_os_init(void)
165164
{
166165
int rc, max_size;
167166

168-
max_size = sizeof(struct appldata_os_data) +
169-
(num_possible_cpus() * sizeof(struct appldata_os_per_cpu));
167+
max_size = struct_size(appldata_os_data, os_cpu, num_possible_cpus());
170168
if (max_size > APPLDATA_MAX_REC_SIZE) {
171169
pr_err("Maximum OS record size %i exceeds the maximum "
172170
"record size %i\n", max_size, APPLDATA_MAX_REC_SIZE);

arch/s390/include/asm/asm-const.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
#ifndef _ASM_S390_ASM_CONST_H
3+
#define _ASM_S390_ASM_CONST_H
4+
5+
#ifdef __ASSEMBLY__
6+
# define stringify_in_c(...) __VA_ARGS__
7+
#else
8+
/* This version of stringify will deal with commas... */
9+
# define __stringify_in_c(...) #__VA_ARGS__
10+
# define stringify_in_c(...) __stringify_in_c(__VA_ARGS__) " "
11+
#endif
12+
#endif /* _ASM_S390_ASM_CONST_H */

arch/s390/include/asm/debug.h

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include <linux/kernel.h>
1313
#include <linux/time.h>
1414
#include <linux/refcount.h>
15-
#include <uapi/asm/debug.h>
15+
#include <linux/fs.h>
1616

1717
#define DEBUG_MAX_LEVEL 6 /* debug levels range from 0 to 6 */
1818
#define DEBUG_OFF_LEVEL -1 /* level where debug is switched off */
@@ -26,6 +26,21 @@
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 */
30+
31+
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;
41+
void *caller;
42+
} __packed;
43+
2944
typedef struct __debug_entry debug_entry_t;
3045

3146
struct debug_view;
@@ -82,7 +97,6 @@ struct debug_view {
8297
};
8398

8499
extern struct debug_view debug_hex_ascii_view;
85-
extern struct debug_view debug_raw_view;
86100
extern struct debug_view debug_sprintf_view;
87101

88102
/* do NOT use the _common functions */

arch/s390/include/asm/extable.h

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,20 @@
11
/* SPDX-License-Identifier: GPL-2.0 */
22
#ifndef __S390_EXTABLE_H
33
#define __S390_EXTABLE_H
4+
5+
#include <asm/ptrace.h>
6+
#include <linux/compiler.h>
7+
48
/*
5-
* The exception table consists of pairs of addresses: the first is the
6-
* address of an instruction that is allowed to fault, and the second is
7-
* the address at which the program should continue. No registers are
8-
* modified, so it is entirely up to the continuation code to figure out
9-
* what to do.
9+
* The exception table consists of three addresses:
10+
*
11+
* - Address of an instruction that is allowed to fault.
12+
* - Address at which the program should continue.
13+
* - Optional address of handler that takes pt_regs * argument and runs in
14+
* interrupt context.
15+
*
16+
* No registers are modified, so it is entirely up to the continuation code
17+
* to figure out what to do.
1018
*
1119
* All the routines below use bits of fixup code that are out of line
1220
* with the main instruction path. This means when everything is well,
@@ -17,6 +25,7 @@
1725
struct exception_table_entry
1826
{
1927
int insn, fixup;
28+
long handler;
2029
};
2130

2231
extern struct exception_table_entry *__start_dma_ex_table;
@@ -29,6 +38,39 @@ static inline unsigned long extable_fixup(const struct exception_table_entry *x)
2938
return (unsigned long)&x->fixup + x->fixup;
3039
}
3140

41+
typedef bool (*ex_handler_t)(const struct exception_table_entry *,
42+
struct pt_regs *);
43+
44+
static inline ex_handler_t
45+
ex_fixup_handler(const struct exception_table_entry *x)
46+
{
47+
if (likely(!x->handler))
48+
return NULL;
49+
return (ex_handler_t)((unsigned long)&x->handler + x->handler);
50+
}
51+
52+
static inline bool ex_handle(const struct exception_table_entry *x,
53+
struct pt_regs *regs)
54+
{
55+
ex_handler_t handler = ex_fixup_handler(x);
56+
57+
if (unlikely(handler))
58+
return handler(x, regs);
59+
regs->psw.addr = extable_fixup(x);
60+
return true;
61+
}
62+
3263
#define ARCH_HAS_RELATIVE_EXTABLE
3364

65+
static inline void swap_ex_entry_fixup(struct exception_table_entry *a,
66+
struct exception_table_entry *b,
67+
struct exception_table_entry tmp,
68+
int delta)
69+
{
70+
a->fixup = b->fixup + delta;
71+
b->fixup = tmp.fixup - delta;
72+
a->handler = b->handler + delta;
73+
b->handler = tmp.handler - delta;
74+
}
75+
3476
#endif

arch/s390/include/asm/linkage.h

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,27 @@
22
#ifndef __ASM_LINKAGE_H
33
#define __ASM_LINKAGE_H
44

5+
#include <asm/asm-const.h>
56
#include <linux/stringify.h>
67

78
#define __ALIGN .align 4, 0x07
89
#define __ALIGN_STR __stringify(__ALIGN)
910

10-
#ifndef __ASSEMBLY__
11-
1211
/*
1312
* Helper macro for exception table entries
1413
*/
15-
#define EX_TABLE(_fault, _target) \
16-
".section __ex_table,\"a\"\n" \
17-
".align 4\n" \
18-
".long (" #_fault ") - .\n" \
19-
".long (" #_target ") - .\n" \
20-
".previous\n"
21-
22-
#else /* __ASSEMBLY__ */
2314

24-
#define EX_TABLE(_fault, _target) \
25-
.section __ex_table,"a" ; \
26-
.align 4 ; \
27-
.long (_fault) - . ; \
28-
.long (_target) - . ; \
29-
.previous
15+
#define __EX_TABLE(_section, _fault, _target) \
16+
stringify_in_c(.section _section,"a";) \
17+
stringify_in_c(.align 8;) \
18+
stringify_in_c(.long (_fault) - .;) \
19+
stringify_in_c(.long (_target) - .;) \
20+
stringify_in_c(.quad 0;) \
21+
stringify_in_c(.previous)
3022

31-
#define EX_TABLE_DMA(_fault, _target) \
32-
.section .dma.ex_table, "a" ; \
33-
.align 4 ; \
34-
.long (_fault) - . ; \
35-
.long (_target) - . ; \
36-
.previous
23+
#define EX_TABLE(_fault, _target) \
24+
__EX_TABLE(__ex_table, _fault, _target)
25+
#define EX_TABLE_DMA(_fault, _target) \
26+
__EX_TABLE(.dma.ex_table, _fault, _target)
3727

38-
#endif /* __ASSEMBLY__ */
3928
#endif

arch/s390/include/asm/pci_dma.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,6 @@ static inline void validate_st_entry(unsigned long *entry)
131131
*entry |= ZPCI_TABLE_VALID;
132132
}
133133

134-
static inline void invalidate_table_entry(unsigned long *entry)
135-
{
136-
*entry &= ~ZPCI_TABLE_VALID_MASK;
137-
*entry |= ZPCI_TABLE_INVALID;
138-
}
139-
140134
static inline void invalidate_pt_entry(unsigned long *entry)
141135
{
142136
WARN_ON_ONCE((*entry & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_INVALID);
@@ -173,11 +167,6 @@ static inline int pt_entry_isvalid(unsigned long entry)
173167
return (entry & ZPCI_PTE_VALID_MASK) == ZPCI_PTE_VALID;
174168
}
175169

176-
static inline int entry_isprotected(unsigned long entry)
177-
{
178-
return (entry & ZPCI_TABLE_PROT_MASK) == ZPCI_TABLE_PROTECTED;
179-
}
180-
181170
static inline unsigned long *get_rt_sto(unsigned long entry)
182171
{
183172
return ((entry & ZPCI_TABLE_TYPE_MASK) == ZPCI_TABLE_TYPE_RTX)

arch/s390/include/asm/pgtable.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1669,7 +1669,7 @@ static inline swp_entry_t __swp_entry(unsigned long type, unsigned long offset)
16691669
#define kern_addr_valid(addr) (1)
16701670

16711671
extern int vmem_add_mapping(unsigned long start, unsigned long size);
1672-
extern int vmem_remove_mapping(unsigned long start, unsigned long size);
1672+
extern void vmem_remove_mapping(unsigned long start, unsigned long size);
16731673
extern int s390_enable_sie(void);
16741674
extern int s390_enable_skey(void);
16751675
extern void s390_reset_cmma(struct mm_struct *mm);

arch/s390/include/asm/ptrace.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,10 @@ static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
184184
return regs->gprs[15];
185185
}
186186

187+
static inline void regs_set_return_value(struct pt_regs *regs, unsigned long rc)
188+
{
189+
regs->gprs[2] = rc;
190+
}
191+
187192
#endif /* __ASSEMBLY__ */
188193
#endif /* _S390_PTRACE_H */

0 commit comments

Comments
 (0)