# git rev-parse -q --verify d899987759d5c18c26204a3defc15a3fb55048c0^{commit} d899987759d5c18c26204a3defc15a3fb55048c0 already have revision, skipping fetch # git checkout -q -f -B kisskb d899987759d5c18c26204a3defc15a3fb55048c0 # git clean -qxdf # < git log -1 # commit d899987759d5c18c26204a3defc15a3fb55048c0 # Author: Nicholas Piggin # Date: Thu Aug 2 17:36:57 2018 +1000 # # powerpc/64s: reimplement book3s idle code in C # # Reimplement Book3S idle code in C, moving POWER7/8/9 implementation # speific HV idle code to the powernv platform code. # # Book3S assembly stubs are kept in common code and used only to save # the stack frame and non-volatile GPRs before executing architected # idle instructions, and restoring the stack and reloading GPRs then # returning to C after waking from idle. # # The complex logic dealing with threads and subcores, locking, SPRs, # HMIs, timebase resync, etc., is all done in C which makes it more # maintainable. # # This is not a strict translation to C code, there are some # significant differences: # # - Idle wakeup no longer uses the ->cpu_restore call to reinit SPRs, # but saves and restores them itself. # # - The optimisation where EC=ESL=0 idle modes did not have to save GPRs # or change MSR is restored, because it's now simple to do. ESL=1 # sleeps that do not lose GPRs can use this optimization too. # # - KVM secondary entry and cede is now more of a call/return style # rather than branchy. nap_state_lost is not required because KVM # always returns via NVGPR restoring path. # # Reviewed-by: Gautham R. Shenoy # Signed-off-by: Nicholas Piggin # # Left to do: # - KVM could use more review, it's pretty tricky. Not sure if what # I'm doing with the emergency stack is kosher. But it runs pretty fine # here with a POWER8 SMP+SMT guest. Possible to streamline # KVM cede code now that idle function saves nv gprs for us? # # Open question: # - Why does P9 restore some of the PMU SPRs (but not others), and # P8 only zeroes them? (A: Unclear. First pass conversion patch will not # try to tidy this up, but it will become much easier to do afterward). # # Since RFC v1: # - Now tested and working with POWER9 hash and radix. # - KVM support added. This took a bit of work to untangle and might # still have some issues, but POWER9 seems to work including hash on # radix with dependent threads mode. # - This snowballed a bit because of KVM and other details making it # not feasible to leave POWER7/8 code alone. That's only half done # at the moment. # - So far this trades about 800 lines of asm for 500 of C. With POWER7/8 # support done it might be another hundred or so lines of C. # # Since RFC v2: # - Fixed deep state SLB reloading # - Now tested and working with POWER8. # - Accounted for most feedback. # # Since RFC v3: # - Rebased to powerpc merge + idle state bugfix # - Split SLB flush/restore code out and shared with MCE code (pseries # MCE patches can also use). # - More testing on POWER8 including KVM with secondaries. # - Performance testing looks good. EC=ESL=0 is about 5% faster, other # stop states look a little faster too. # - Adjusted SPR saving to handler POWER7, haven't tested it. # # Since submission v1: # - More review comments from Gautham. # - Rename isa3_ to isa300_ prefix. # - Tinkered with some comments, copyright notice, changelog. # - Cede and regular idle do not go via KVM secondary wakeup code path, # so hwthread_state stores and barriers can be simplified, and some # KVM code paths simplified a little. # # Since v2: # - Rebase, SLB reload patch has been merged. # - More testing. Tested machine check idle wakeup path with mambo stepping # through instructions. # < /opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux-gcc --version # < git log --format=%s --max-count=1 d899987759d5c18c26204a3defc15a3fb55048c0 # < make -s -j 80 ARCH=powerpc O=/kisskb/build/npiggin_ppc64e_defconfig_powerpc CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- ppc64e_defconfig # make -s -j 80 ARCH=powerpc O=/kisskb/build/npiggin_ppc64e_defconfig_powerpc CROSS_COMPILE=/opt/cross/kisskb/gcc-4.6.3-nolibc/powerpc-linux/bin/powerpc-linux- /kisskb/src/kernel/cgroup/cgroup-v1.c: In function 'cgroup1_mount': /kisskb/src/kernel/cgroup/cgroup-v1.c:1256:20: warning: 'root' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/kernel/printk/printk.c: In function 'devkmsg_sysctl_set_loglvl': /kisskb/src/kernel/printk/printk.c:186:16: warning: 'old' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function 'regmap_raw_read': /kisskb/src/drivers/base/regmap/regmap.c:2511:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/base/regmap/regmap.c: In function '_regmap_raw_write': /kisskb/src/drivers/base/regmap/regmap.c:1833:6: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/net/bridge/br_netlink.c: In function 'br_afspec': /kisskb/src/net/bridge/br_netlink.c:647:7: warning: 'err' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c: In function 'univ8250_release_irq': /kisskb/src/drivers/tty/serial/8250/8250_core.c:251:18: warning: 'i' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/tty/serial/8250/8250_core.c:231:19: note: 'i' was declared here /kisskb/src/drivers/i2c/i2c-core-base.c: In function 'i2c_generic_scl_recovery': /kisskb/src/drivers/i2c/i2c-core-base.c:235:5: warning: 'ret' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c: In function 'proc_reg_open': /kisskb/src/include/linux/list.h:65:12: warning: 'pdeo' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/proc/inode.c:341:21: note: 'pdeo' was declared here /kisskb/src/fs/nfsd/nfs4xdr.c: In function 'nfsd4_encode_components_esc': /kisskb/src/fs/nfsd/nfs4xdr.c:2069:9: warning: 'str' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/fs/udf/unicode.c: In function 'udf_name_conv_char': /kisskb/src/fs/udf/unicode.c:132:8: warning: 'c' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/net/tun.c: In function 'tun_get_user': /kisskb/src/drivers/net/tun.c:1836:30: warning: 'copylen' may be used uninitialized in this function [-Wuninitialized] /kisskb/src/drivers/net/tun.c:1746:46: warning: 'linear' may be used uninitialized in this function [-Wuninitialized] WARNING: vmlinux.o (.PPC.EMB.apuinfo): unexpected non-allocatable section. Did you forget to use "ax"/"aw" in a .S file? Note that for example contains section definitions for use in .S files. INFO: Uncompressed kernel (size 0xd957e8) overlaps the address of the wrapper(0x400000) INFO: Fixing the link_address of wrapper to (0xe00000) Image Name: Linux-4.18.0-gd899987759d5c Created: Sun Sep 9 22:29:12 2018 Image Type: PowerPC Linux Kernel Image (gzip compressed) Data Size: 5828575 Bytes = 5691.97 KiB = 5.56 MiB Load Address: 00000000 Entry Point: 00000000 Completed OK # rm -rf /kisskb/build/npiggin_ppc64e_defconfig_powerpc # Build took: 0:01:28.917335