aboutsummaryrefslogtreecommitdiff
path: root/arch/s390/include
AgeCommit message (Collapse)AuthorFilesLines
2021-08-18s390/qdio: remove unused support for SLIB parametersJulian Wiedmann1-4/+0
Neither of the two drivers provides any SLIB parameter data, so get rid of the dead code. Signed-off-by: Julian Wiedmann <[email protected]> Reviewed-by: Benjamin Block <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
2021-08-09Merge 5.14-rc5 into driver-core-nextGreg Kroah-Hartman1-9/+9
We need the driver core fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-08-05s390: rename dma section to amode31Heiko Carstens4-14/+17
The dma section name is confusing, since the code which resides within that section has nothing to do with direct memory access. Instead the limitation is that the code has to run in 31 bit addressing mode, and therefore has to reside below 2GB. So the name was chosen since ZONE_DMA is the same region. To reduce confusion rename the section to amode31, which hopefully describes better what this is about. Note: this will also change vmcoreinfo strings - SDMA=... gets renamed to SAMODE31=... - EDMA=... gets renamed to EAMODE31=... Acked-by: Vasily Gorbik <[email protected]> Reviewed-by: Alexander Egorenkov <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-08-03s390/ftrace: implement hotpatchingIlya Leoshkevich3-41/+34
s390 allows hotpatching the mask of a conditional jump instruction. Make use of this feature in order to avoid the expensive stop_machine() call. The new trampolines are split in 3 stages: - A first stage is a 6-byte relative conditional long branch located at each function's entry point. Its offset always points to the second stage for the corresponding function, and its mask is either all 0s (ftrace off) or all 1s (ftrace on). The code for flipping the mask is borrowed from ftrace_{enable,disable}_ftrace_graph_caller. After flipping, ftrace_arch_code_modify_post_process() syncs with all the other CPUs by sending SIGPs. - Second stages for vmlinux are stored in a separate part of the .text section reserved by the linker script, and in dynamically allocated memory for modules. This prevents the icache pollution. The total size of second stages is about 1.5% of that of the kernel image. Putting second stages in the .bss section is possible and decreases the size of the non-compressed vmlinux, but splits the kernel 1:1 mapping, which is a bad tradeoff. Each second stage contains a call to the third stage, a pointer to the part of the intercepted function right after the first stage, and a pointer to an interceptor function (e.g. ftrace_caller). Second stages are 8-byte aligned for the future direct calls implementation. - There are only two copies of the third stage: in the .text section for vmlinux and in dynamically allocated memory for modules. It can be an expoline, which is relatively large, so inlining it into each second stage is prohibitively expensive. As a result of this organization, phoronix-test-suite with ftrace off does not show any performance degradation. Suggested-by: Sven Schnelle <[email protected]> Suggested-by: Vasily Gorbik <[email protected]> Co-developed-by: Heiko Carstens <[email protected]> Signed-off-by: Ilya Leoshkevich <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
2021-07-31Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netJakub Kicinski1-9/+9
Conflicting commits, all resolutions pretty trivial: drivers/bus/mhi/pci_generic.c 5c2c85315948 ("bus: mhi: pci-generic: configurable network interface MRU") 56f6f4c4eb2a ("bus: mhi: pci_generic: Apply no-op for wake using sideband wake boolean") drivers/nfc/s3fwrn5/firmware.c a0302ff5906a ("nfc: s3fwrn5: remove unnecessary label") 46573e3ab08f ("nfc: s3fwrn5: fix undefined parameter values in dev_err()") 801e541c79bb ("nfc: s3fwrn5: fix undefined parameter values in dev_err()") MAINTAINERS 7d901a1e878a ("net: phy: add Maxlinear GPY115/21x/24x driver") 8a7b46fa7902 ("MAINTAINERS: add Yasushi SHOJI as reviewer for the Microchip CAN BUS Analyzer Tool driver") Signed-off-by: Jakub Kicinski <[email protected]>
2021-07-30s390: add support for KFENCESven Schnelle1-0/+42
Signed-off-by: Sven Schnelle <[email protected]> [[email protected]: simplify/rework code] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
2021-07-30s390/mm: implement set_memory_4k()Heiko Carstens1-0/+6
Implement set_memory_4k() which will split any present large or huge mapping in the given range to a 4k mapping. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Carstens <[email protected]>
2021-07-29Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvmLinus Torvalds1-9/+9
Pull kvm fixes from Paolo Bonzini: "ARM: - Fix MTE shared page detection - Enable selftest's use of PMU registers when asked to s390: - restore 5.13 debugfs names x86: - fix sizes for vcpu-id indexed arrays - fixes for AMD virtualized LAPIC (AVIC) - other small bugfixes Generic: - access tracking performance test - dirty_log_perf_test command line parsing fix - Fix selftest use of obsolete pthread_yield() in favour of sched_yield() - use cpu_relax when halt polling - fixed missing KVM_CLEAR_DIRTY_LOG compat ioctl" * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: KVM: add missing compat KVM_CLEAR_DIRTY_LOG KVM: use cpu_relax when halt polling KVM: SVM: use vmcb01 in svm_refresh_apicv_exec_ctrl KVM: SVM: tweak warning about enabled AVIC on nested entry KVM: SVM: svm_set_vintr don't warn if AVIC is active but is about to be deactivated KVM: s390: restore old debugfs names KVM: SVM: delay svm_vcpu_init_msrpm after svm->vmcb is initialized KVM: selftests: Introduce access_tracking_perf_test KVM: selftests: Fix missing break in dirty_log_perf_test arg parsing x86/kvm: fix vcpu-id indexed array sizes KVM: x86: Check the right feature bit for MSR_KVM_ASYNC_PF_ACK access docs: virt: kvm: api.rst: replace some characters KVM: Documentation: Fix KVM_CAP_ENFORCE_PV_FEATURE_CPUID name KVM: nSVM: Swap the parameter order for svm_copy_vmrun_state()/svm_copy_vmloadsave_state() KVM: nSVM: Rename nested_svm_vmloadsave() to svm_copy_vmloadsave_state() KVM: arm64: selftests: get-reg-list: actually enable pmu regs in pmu sublist KVM: selftests: change pthread_yield to sched_yield KVM: arm64: Fix detection of shared VMAs on guest fault
2021-07-27s390: use generic strncpy/strnlen from_userHeiko Carstens1-16/+2
The s390 variant of strncpy_from_user() is slightly faster than the generic variant, however convert to the generic variant now to follow most if not all other architectures. Converting to the generic variant was already considered a couple of years ago. See commit f5c8b9601036 ("s390/uaccess: use sane length for __strncpy_from_user()"). Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]>
2021-07-27KVM: s390: restore old debugfs namesChristian Borntraeger1-9/+9
commit bc9e9e672df9 ("KVM: debugfs: Reuse binary stats descriptors") did replace the old definitions with the binary ones. While doing that it missed that some files are names different than the counters. This is especially important for kvm_stat which does have special handling for counters named instruction_*. Fixes: commit bc9e9e672df9 ("KVM: debugfs: Reuse binary stats descriptors") CC: Jing Zhang <[email protected]> Signed-off-by: Christian Borntraeger <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
2021-07-27s390/headers: fix code style in module.hIlya Leoshkevich1-4/+2
struct brace should be on the same line. Signed-off-by: Ilya Leoshkevich <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/hwcaps: make sie capability regular hwcapHeiko Carstens1-12/+2
Commit 7f16d7e787b7 ("s390: show virtualization support in /proc/cpuinfo") introduced special handling for sie capability, saying this should not be exposed via hwcaps, without giving a reason. However this leads to an inconsistent /proc/cpuinfo features line where all features except the sie capability are also present in hwcaps. I really don't see a reason to not add that to hwcaps - it might be quite pointless, but at least this way it is possible to get rid of some special handling. Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/hwcaps: add sanity checksHeiko Carstens1-0/+2
Add BUILD_BUG_ON() sanity checks to make sure the hwcap string array contains a string for each hwcap. Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/hwcaps: introduce HWCAP bit numbersHeiko Carstens1-23/+52
Introduce HWCAP bit numbers, making it easier to tell at which bit number we currently are. Also use these bits with the BIT macro to define the real HWCAP masks. Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/hwcaps: shorten HWCAP definesHeiko Carstens2-23/+23
Remove s390 part of all HWCAP defines, just to make them shorter and easier to handle. The namespace is anyway per architecture. This is similar to what arm64 has. Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390: add HWCAP_S390_PCI_MIO to ELF hwcapsNiklas Schnelle1-0/+1
In order to support the use of enhanced PCI instructions in both kernel- and userspace we need both hardware support and proper setup in the kernel. The latter can be toggled off with the pci=nomio command line option. Thus availability of this feature in userspace depends on all of kernel configuration (CONFIG_PCI), hardware support and the current kernel command line and can thus not rely solely on a facility bit. Instead let's introduce a new ELF hardware capability bit HWCAP_S390_PCI_MIO to tell userspace whether these PCI instructions can be used. Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Niklas Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390: make PCI mio support a machine flagNiklas Schnelle1-0/+2
Kernel support for the newer PCI mio instructions can be toggled off with the pci=nomio command line option which needs to integrate with common code PCI option parsing. However this option then toggles static branches which can't be toggled yet in an early_param() call. Thus commit 9964f396f1d0 ("s390: fix setting of mio addressing control") moved toggling the static branches to the PCI init routine. With this setup however we can't check for mio support outside the PCI code during early boot, i.e. before switching the static branches, which we need to be able to export this as an ELF HWCAP. Improve on this by turning mio availability into a machine flag that gets initially set based on CONFIG_PCI and the facility bit and gets toggled off if pci=nomio is found during PCI option parsing allowing simple access to this machine flag after early init. Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Niklas Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390: report more CPU capabilitiesHeiko Carstens1-0/+2
Add hardware capability bits and feature tags to /proc/cpuinfo for NNPA and Vector-Packed-Decimal-Enhancement Facility 2. Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/qdio: remove unused macrosJulian Wiedmann1-5/+0
These macros haven't seen any use in a long time. Also note that the queue_irqs_*() ones wouldn't even compile anymore. Signed-off-by: Julian Wiedmann <[email protected]> Reviewed-by: Benjamin Block <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/qdio: clarify reporting of errors to the driversJulian Wiedmann1-4/+3
Now that all drivers use qdio_inspect_queue() and qdio's internal queue tasklets are gone, the driver-specified queue handlers are only called for async error reporting (eg. for an error condition in the QEBSM code). So take a moment to clean up the Output Queue handlers (they are _always_ called with qdio_error != 0), and clarify which error types can be reported through what interface. As Benjamin already suggested a while ago, we should turn these into distinct enums at some point. Signed-off-by: Julian Wiedmann <[email protected]> Reviewed-by: Benjamin Block <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/qdio: remove remaining tasklet & timer codeJulian Wiedmann1-3/+0
Both qdio drivers have moved away from using qdio's internal tasklet and timer mechanisms for Output Queues. Rip out all the leftovers. Signed-off-by: Julian Wiedmann <[email protected]> Reviewed-by: Benjamin Block <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/boot: move dma sections from decompressor to decompressed kernelAlexander Egorenkov1-0/+8
This change simplifies the task of making the decompressor relocatable. The decompressor's image contains special DMA sections between _sdma and _edma. This DMA segment is loaded at boot as part of the decompressor and then simply handed over to the decompressed kernel. The decompressor itself never uses it in any way. The primary reason for this is the need to keep the aforementioned DMA segment below 2GB which is required by architecture, and because the decompressor is always loaded at a fixed low physical address, it is guaranteed that the DMA region will not cross the 2GB memory limit. If the DMA region had been placed in the decompressed kernel, then KASLR would make this guarantee impossible to fulfill or it would be restricted to the first 2GB of memory address space. This commit moves all DMA sections between _sdma and _edma from the decompressor's image to the decompressed kernel's image. The complete DMA region is placed in the init section of the decompressed kernel and immediately relocated below 2GB at start-up before it is needed by other parts of the decompressed kernel. The relocation of the DMA region happens even if the decompressed kernel is already located below 2GB in order to keep the first implementation simple. The relocation should not have any noticeable impact on boot time because the DMA segment is only a couple of pages. After relocating the DMA sections, the kernel has to fix all references which point into it. In order to automate this, place all variables pointing into the DMA sections in a special .dma.refs section. All such variables must be defined using the new __dma_ref macro. Only variables containing addresses within the DMA sections must be placed in the new .dma.refs section. Furthermore, move the initialization of control registers from the decompressor to the decompressed kernel because some control registers reference tables that must be placed in the DMA data section to guarantee that their addresses are below 2G. Because the decompressed kernel relocates the DMA sections at startup, the content of control registers CR2, CR5 and CR15 must be updated with new addresses after the relocation. The decompressed kernel initializes all control registers early at boot and then updates the content of CR2, CR5 and CR15 as soon as the DMA relocation has occurred. This practically reverts the commit a80313ff91ab ("s390/kernel: introduce .dma sections"). Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/ctl_reg: add ctlreg5 and ctlreg15 unionsHeiko Carstens1-0/+17
Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/boot: move EP_OFFSET and EP_STRING to head.SAlexander Egorenkov1-2/+0
Both macros are used only in decompressor's head.S, unnecessary to put them in a global header used in many places like setup.h is. Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/setup: generate asm offsets from struct parmareaAlexander Egorenkov1-9/+0
To reduce duplication, replace error-prone and hard-coded parameter area offsets with auto-generated ones. Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/setup: drop _OFFSET macrosAlexander Egorenkov1-17/+6
The macros * IPL_DEVICE_OFFSET * INITRD_START_OFFSET * INITRD_SIZE_OFFSET * OLDMEM_BASE_OFFSET * OLDMEM_SIZE_OFFSET * KERNEL_VERSION_OFFSET * COMMAND_LINE_OFFSET are no longer necessary and used only to define another set of macros with the same names but w/o the suffix _OFFSET. Therefore, drop this unnecessary indirection. Drop the macro KERNEL_VERSION_OFFSET w/o renaming it to KERNEL_VERSION because it is used nowhere. Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/setup: remove unused symbolic constants for C code from setup.hAlexander Egorenkov1-3/+0
These symbolic constants are used only by assembler code now: * COMMAND_LINE * IPL_DEVICE C code of the decompressed kernel should use boot data passed by the decompressor instead. Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/dump: introduce boot data 'oldmem_data'Alexander Egorenkov1-2/+6
The new boot data struct shall replace global variables OLDMEM_BASE and OLDMEM_SIZE. It is initialized in the decompressor and passed to the decompressed kernel. In comparison to the old solution, this one doesn't access data at fixed physical addresses which will become important when the decompressor becomes relocatable. Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/boot: introduce boot data 'initrd_data'Alexander Egorenkov1-2/+6
The new boot data struct shall replace global variables INITRD_START and INITRD_SIZE. It is initialized in the decompressor and passed to the decompressed kernel. In comparison to the old solution, this one doesn't access data at fixed physical addresses which will become important when the decompressor becomes relocatable. Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/boot: move sclp early buffer from fixed address in asm to CAlexander Egorenkov2-3/+2
To make the decompressor relocatable, the early SCLP buffer with a fixed address must be replaced with a relocatable C buffer of the according size and alignment as required by SCLP. Introduce a new function sclp_early_set_buffer() into the SCLP driver which enables the decompressor to change the SCLP early buffer at any time. This will be useful when the decompressor becomes fully relocatable and might need to change the SCLP early buffer to one with an address < 2G as required by SCLP because it was loaded at an address >= 2G. Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/vdso: use system call functionsHeiko Carstens1-18/+4
Use system call functions instead of open-coding svc inline assemblies. This is mostly to get rid of even more register asm constructs. Besides that, it makes the code also a bit easier to understand. The generated code is identical to what is was before. Reviewed-by: Sven Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/syscall: provide generic system call functionsHeiko Carstens1-0/+59
Provide generic system call functions which should be used whenever a system call needs to be done from user space. The only in-kernel code is vdso, which will be converted with a follow on patch. Reviewed-by: Sven Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/cpacf: get rid of register asmHeiko Carstens1-97/+111
Using register asm statements has been proven to be very error prone, especially when using code instrumentation where gcc may add function calls, which clobbers register contents in an unexpected way. Therefore get rid of register asm statements in cpacf code, and make sure this bug class cannot happen. Reviewed-by: Patrick Steuer <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/debug: remove unused print definesHeiko Carstens1-34/+0
Remove unused print defines from debug feature header file. Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/boot: move uv function declarations to boot/uv.hAlexander Egorenkov1-8/+0
The functions adjust_to_uv_max() and uv_query_info() are used only in the decompressor. Therefore, move the function declarations from the global arch/s390/include/asm/uv.h to arch/s390/boot/uv.h. Signed-off-by: Alexander Egorenkov <[email protected]> Reviewed-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/mm: don't print hashed values for pte_ERROR() & friendsHeiko Carstens1-5/+5
Print the real pte, pmd, etc. values instead of some hashed value. Otherwise debugging would be even more difficult. This also matches what most other architectures are doing. Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/mm: use pr_err() instead of printk() for pte_ERROR & friendsHeiko Carstens1-5/+5
Use pr_err() to use a proper printk level. Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/sclp: use only one sclp early buffer to send commandsAlexander Egorenkov2-3/+7
A buffer that can be used for communication with SCLP is required to lie below 2GB memory address. Therefore, both sclp_info_sccb and sclp_early_sccb must fulfill this requirement if passed directly to the sclp_early_cmd() function. Instead, use only sclp_early_sccb for communication with SCLP. This allows the buffer sclp_info_sccb to be placed anywhere in the memory address space and, therefore, simplifies the process of making the decompressor relocatable later on, one thing less to relocate. And make sure that the length of the new unified early SCLP buffer is no less than the length of the removed sclp_info_sccb buffer which might be larger than the length of the sclp_early_sccb buffer. Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Reviewed-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27s390/cio: remove unused include linux/spinlock.h from cio.hAlexander Egorenkov2-1/+1
* The linux/spinlock.h header was included indirectly by the decompressor and brought unnecessary build dependencies. * Use proper includes in files which either directly or indirectly included cio.h and were hidden until now by the included linux/spinlock.h, e.g. linux/string.h for memcpy() or asm/page.h for PAGE_SIZE. Signed-off-by: Alexander Egorenkov <[email protected]> Acked-by: Heiko Carstens <[email protected]> Acked-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-27Merge 5.14-rc3 into driver-core-nextGreg Kroah-Hartman1-0/+1
We need the driver-core fixes in here as well. Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-07-23Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/netDavid S. Miller1-0/+1
Conflicts are simple overlapping changes. Signed-off-by: David S. Miller <[email protected]>
2021-07-23compat: make linux/compat.h available everywhereArnd Bergmann1-11/+3
Parts of linux/compat.h are under an #ifdef, but we end up using more of those over time, moving things around bit by bit. To get it over with once and for all, make all of this file uncondititonal now so it can be accessed everywhere. There are only a few types left that are in asm/compat.h but not yet in the asm-generic version, so add those in the process. This requires providing a few more types in asm-generic/compat.h that were not already there. The only tricky one is compat_sigset_t, which needs a little help on 32-bit architectures and for x86. Signed-off-by: Arnd Bergmann <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2021-07-21s390/scm: Make struct scm_driver::remove return voidUwe Kleine-König1-1/+1
The driver core ignores the return value of scmdev_remove() (because there is only little it can do when a device disappears). So make it impossible for future drivers to return an unused error code by changing the remove prototype to return void. The real motivation for this change is the quest to make struct bus_type::remove return void, too. Reviewed-by: Cornelia Huck <[email protected]> Acked-by: Vineeth Vijayan <[email protected]> Signed-off-by: Uwe Kleine-König <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2021-07-20s390/qeth: remove OSN supportJulian Wiedmann1-2/+0
Commit fb64de1bc36c ("s390/qeth: phase out OSN support") spelled out why the OSN support in qeth is in a bad shape, and put any remaining interested parties on notice to speak up before it gets ripped out. It's 2021 now, so make true on that promise and remove all the OSN-specific parts from qeth. This also means that we no longer need to export various parts of the cmd & data path internals to the L2 driver. Signed-off-by: Julian Wiedmann <[email protected]> Reviewed-by: Alexandra Winter <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2021-07-15s390/ftrace: fix ftrace_update_ftrace_func implementationVasily Gorbik1-0/+1
s390 enforces DYNAMIC_FTRACE if FUNCTION_TRACER is selected. At the same time implementation of ftrace_caller is not compliant with HAVE_DYNAMIC_FTRACE since it doesn't provide implementation of ftrace_update_ftrace_func() and calls ftrace_trace_function() directly. The subtle difference is that during ftrace code patching ftrace replaces function tracer via ftrace_update_ftrace_func() and activates it back afterwards. Unexpected direct calls to ftrace_trace_function() during ftrace code patching leads to nullptr-dereferences when tracing is activated for one of functions which are used during code patching. Those function currently are: copy_from_kernel_nofault() copy_from_kernel_nofault_allowed() preempt_count_sub() [with debug_defconfig] preempt_count_add() [with debug_defconfig] Corresponding KASAN report: BUG: KASAN: nullptr-dereference in function_trace_call+0x316/0x3b0 Read of size 4 at addr 0000000000001e08 by task migration/0/15 CPU: 0 PID: 15 Comm: migration/0 Tainted: G B 5.13.0-41423-g08316af3644d Hardware name: IBM 3906 M04 704 (LPAR) Stopper: multi_cpu_stop+0x0/0x3e0 <- stop_machine_cpuslocked+0x1e4/0x218 Call Trace: [<0000000001f77caa>] show_stack+0x16a/0x1d0 [<0000000001f8de42>] dump_stack+0x15a/0x1b0 [<0000000001f81d56>] print_address_description.constprop.0+0x66/0x2e0 [<000000000082b0ca>] kasan_report+0x152/0x1c0 [<00000000004cfd8e>] function_trace_call+0x316/0x3b0 [<0000000001fb7082>] ftrace_caller+0x7a/0x7e [<00000000006bb3e6>] copy_from_kernel_nofault_allowed+0x6/0x10 [<00000000006bb42e>] copy_from_kernel_nofault+0x3e/0xd0 [<000000000014605c>] ftrace_make_call+0xb4/0x1f8 [<000000000047a1b4>] ftrace_replace_code+0x134/0x1d8 [<000000000047a6e0>] ftrace_modify_all_code+0x120/0x1d0 [<000000000047a7ec>] __ftrace_modify_code+0x5c/0x78 [<000000000042395c>] multi_cpu_stop+0x224/0x3e0 [<0000000000423212>] cpu_stopper_thread+0x33a/0x5a0 [<0000000000243ff2>] smpboot_thread_fn+0x302/0x708 [<00000000002329ea>] kthread+0x342/0x408 [<00000000001066b2>] __ret_from_fork+0x92/0xf0 [<0000000001fb57fa>] ret_from_fork+0xa/0x30 The buggy address belongs to the page: page:(____ptrval____) refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1 flags: 0x1ffff00000001000(reserved|node=0|zone=0|lastcpupid=0x1ffff) raw: 1ffff00000001000 0000040000000048 0000040000000048 0000000000000000 raw: 0000000000000000 0000000000000000 ffffffff00000001 0000000000000000 page dumped because: kasan: bad access detected Memory state around the buggy address: 0000000000001d00: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 0000000000001d80: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 >0000000000001e00: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 ^ 0000000000001e80: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 0000000000001f00: f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 f7 ================================================================== To fix that introduce ftrace_func callback to be called from ftrace_caller and update it in ftrace_update_ftrace_func(). Fixes: 4cc9bed034d1 ("[S390] cleanup ftrace backend functions") Cc: [email protected] Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]> Signed-off-by: Heiko Carstens <[email protected]>
2021-07-08s390: preempt: Fix preempt_count initializationValentin Schneider1-12/+4
S390's init_idle_preempt_count(p, cpu) doesn't actually let us initialize the preempt_count of the requested CPU's idle task: it unconditionally writes to the current CPU's. This clearly conflicts with idle_threads_init(), which intends to initialize *all* the idle tasks, including their preempt_count (or their CPU's, if the arch uses a per-CPU preempt_count). Unfortunately, it seems the way s390 does things doesn't let us initialize every possible CPU's preempt_count early on, as the pages where this resides are only allocated when a CPU is brought up and are freed when it is brought down. Let the arch-specific code set a CPU's preempt_count when its lowcore is allocated, and turn init_idle_preempt_count() into an empty stub. Fixes: f1a0a376ca0c ("sched/core: Initialize the idle task with preemption disabled") Reported-by: Guenter Roeck <[email protected]> Signed-off-by: Valentin Schneider <[email protected]> Tested-by: Guenter Roeck <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vasily Gorbik <[email protected]>
2021-07-08s390/linkage: increase asm symbols alignment to 16Vasily Gorbik1-1/+1
Both clang and gcc (for -march=z13 and later) align functions to 16 bytes at -O2 to benefit branch prediction. Make asm symbols alignment consistent with that. This also benefits potential ftrace code patching, which is currently able to patch 8 aligned bytes at once. With defconfig this currently increases .text size by 4104 bytes. Reviewed-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
2021-07-08s390: rename CALL_ON_STACK_NORETURN() to call_on_stack_noreturn()Heiko Carstens1-1/+1
Lower case matches the call_on_stack() macro and is easier to read. Reviewed-by: Sven Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
2021-07-08s390: add type checking to CALL_ON_STACK_NORETURN() macroHeiko Carstens1-1/+3
Make sure the to be called function takes no arguments (and returns void). Otherwise usage of CALL_ON_STACK_NORETURN() would generate broken code. Reviewed-by: Sven Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>
2021-07-08s390: remove old CALL_ON_STACK() macroHeiko Carstens1-37/+0
Reviewed-by: Sven Schnelle <[email protected]> Signed-off-by: Heiko Carstens <[email protected]> Signed-off-by: Vasily Gorbik <[email protected]>