1. 15 3月, 2022 8 次提交
  2. 12 3月, 2022 5 次提交
  3. 10 3月, 2022 2 次提交
    • G
      selftests: pmtu.sh: Kill nettest processes launched in subshell. · 94a4a4fe
      Guillaume Nault 提交于
      When using "run_cmd <command> &", then "$!" refers to the PID of the
      subshell used to run <command>, not the command itself. Therefore
      nettest_pids actually doesn't contain the list of the nettest commands
      running in the background. So cleanup() can't kill them and the nettest
      processes run until completion (fortunately they have a 5s timeout).
      
      Fix this by defining a new command for running processes in the
      background, for which "$!" really refers to the PID of the command run.
      
      Also, double quote variables on the modified lines, to avoid shellcheck
      warnings.
      
      Fixes: ece1278a ("selftests: net: add ESP-in-UDP PMTU test")
      Signed-off-by: NGuillaume Nault <gnault@redhat.com>
      Reviewed-by: NShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      94a4a4fe
    • G
      selftests: pmtu.sh: Kill tcpdump processes launched by subshell. · 18dfc667
      Guillaume Nault 提交于
      The cleanup() function takes care of killing processes launched by the
      test functions. It relies on variables like ${tcpdump_pids} to get the
      relevant PIDs. But tests are run in their own subshell, so updated
      *_pids values are invisible to other shells. Therefore cleanup() never
      sees any process to kill:
      
      $ ./tools/testing/selftests/net/pmtu.sh -t pmtu_ipv4_exception
      TEST: ipv4: PMTU exceptions                                         [ OK ]
      TEST: ipv4: PMTU exceptions - nexthop objects                       [ OK ]
      
      $ pgrep -af tcpdump
      6084 tcpdump -s 0 -i veth_A-R1 -w pmtu_ipv4_exception_veth_A-R1.pcap
      6085 tcpdump -s 0 -i veth_R1-A -w pmtu_ipv4_exception_veth_R1-A.pcap
      6086 tcpdump -s 0 -i veth_R1-B -w pmtu_ipv4_exception_veth_R1-B.pcap
      6087 tcpdump -s 0 -i veth_B-R1 -w pmtu_ipv4_exception_veth_B-R1.pcap
      6088 tcpdump -s 0 -i veth_A-R2 -w pmtu_ipv4_exception_veth_A-R2.pcap
      6089 tcpdump -s 0 -i veth_R2-A -w pmtu_ipv4_exception_veth_R2-A.pcap
      6090 tcpdump -s 0 -i veth_R2-B -w pmtu_ipv4_exception_veth_R2-B.pcap
      6091 tcpdump -s 0 -i veth_B-R2 -w pmtu_ipv4_exception_veth_B-R2.pcap
      6228 tcpdump -s 0 -i veth_A-R1 -w pmtu_ipv4_exception_veth_A-R1.pcap
      6229 tcpdump -s 0 -i veth_R1-A -w pmtu_ipv4_exception_veth_R1-A.pcap
      6230 tcpdump -s 0 -i veth_R1-B -w pmtu_ipv4_exception_veth_R1-B.pcap
      6231 tcpdump -s 0 -i veth_B-R1 -w pmtu_ipv4_exception_veth_B-R1.pcap
      6232 tcpdump -s 0 -i veth_A-R2 -w pmtu_ipv4_exception_veth_A-R2.pcap
      6233 tcpdump -s 0 -i veth_R2-A -w pmtu_ipv4_exception_veth_R2-A.pcap
      6234 tcpdump -s 0 -i veth_R2-B -w pmtu_ipv4_exception_veth_R2-B.pcap
      6235 tcpdump -s 0 -i veth_B-R2 -w pmtu_ipv4_exception_veth_B-R2.pcap
      
      Fix this by running cleanup() in the context of the test subshell.
      Now that each test cleans the environment after completion, there's no
      need for calling cleanup() again when the next test starts. So let's
      drop it from the setup() function. This is okay because cleanup() is
      also called when pmtu.sh starts, so even the first test starts in a
      clean environment.
      
      Also, use tcpdump's immediate mode. Otherwise it might not have time to
      process buffered packets, resulting in missing packets or even empty
      pcap files for short tests.
      
      Note: PAUSE_ON_FAIL is still evaluated before cleanup(), so one can
      still inspect the test environment upon failure when using -p.
      
      Fixes: a92a0a7b ("selftests: pmtu: Simplify cleanup and namespace names")
      Signed-off-by: NGuillaume Nault <gnault@redhat.com>
      Reviewed-by: NShuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      18dfc667
  4. 06 3月, 2022 4 次提交
  5. 04 3月, 2022 2 次提交
    • A
      selftests: mlxsw: resource_scale: Fix return value · 196f9bc0
      Amit Cohen 提交于
      The test runs several test cases and is supposed to return an error in
      case at least one of them failed.
      
      Currently, the check of the return value of each test case is in the
      wrong place, which can result in the wrong return value. For example:
      
       # TESTS='tc_police' ./resource_scale.sh
       TEST: 'tc_police' [default] 968                                     [FAIL]
               tc police offload count failed
       Error: mlxsw_spectrum: Failed to allocate policer index.
       We have an error talking to the kernel
       Command failed /tmp/tmp.i7Oc5HwmXY:969
       TEST: 'tc_police' [default] overflow 969                            [ OK ]
       ...
       TEST: 'tc_police' [ipv4_max] overflow 969                           [ OK ]
      
       $ echo $?
       0
      
      Fix this by moving the check to be done after each test case.
      
      Fixes: 059b18e2 ("selftests: mlxsw: Return correct error code in resource scale test")
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: NPetr Machata <petrm@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      196f9bc0
    • A
      selftests: mlxsw: tc_police_scale: Make test more robust · dc975207
      Amit Cohen 提交于
      The test adds tc filters and checks how many of them were offloaded by
      grepping for 'in_hw'.
      
      iproute2 commit f4cd4f127047 ("tc: add skip_hw and skip_sw to control
      action offload") added offload indication to tc actions, producing the
      following output:
      
       $ tc filter show dev swp2 ingress
       ...
       filter protocol ipv6 pref 1000 flower chain 0 handle 0x7c0
         eth_type ipv6
         dst_ip 2001:db8:1::7bf
         skip_sw
         in_hw in_hw_count 1
               action order 1:  police 0x7c0 rate 10Mbit burst 100Kb mtu 2Kb action drop overhead 0b
               ref 1 bind 1
               not_in_hw
               used_hw_stats immediate
      
      The current grep expression matches on both 'in_hw' and 'not_in_hw',
      resulting in incorrect results.
      
      Fix that by using JSON output instead.
      
      Fixes: 5061e773 ("selftests: mlxsw: Add scale test for tc-police")
      Signed-off-by: NAmit Cohen <amcohen@nvidia.com>
      Reviewed-by: NPetr Machata <petrm@nvidia.com>
      Signed-off-by: NIdo Schimmel <idosch@nvidia.com>
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      dc975207
  6. 01 3月, 2022 1 次提交
  7. 27 2月, 2022 2 次提交
    • M
      selftests/memfd: clean up mapping in mfd_fail_write · fda153c8
      Mike Kravetz 提交于
      Running the memfd script ./run_hugetlbfs_test.sh will often end in error
      as follows:
      
          memfd-hugetlb: CREATE
          memfd-hugetlb: BASIC
          memfd-hugetlb: SEAL-WRITE
          memfd-hugetlb: SEAL-FUTURE-WRITE
          memfd-hugetlb: SEAL-SHRINK
          fallocate(ALLOC) failed: No space left on device
          ./run_hugetlbfs_test.sh: line 60: 166855 Aborted                 (core dumped) ./memfd_test hugetlbfs
          opening: ./mnt/memfd
          fuse: DONE
      
      If no hugetlb pages have been preallocated, run_hugetlbfs_test.sh will
      allocate 'just enough' pages to run the test.  In the SEAL-FUTURE-WRITE
      test the mfd_fail_write routine maps the file, but does not unmap.  As a
      result, two hugetlb pages remain reserved for the mapping.  When the
      fallocate call in the SEAL-SHRINK test attempts allocate all hugetlb
      pages, it is short by the two reserved pages.
      
      Fix by making sure to unmap in mfd_fail_write.
      
      Link: https://lkml.kernel.org/r/20220219004340.56478-1-mike.kravetz@oracle.comSigned-off-by: NMike Kravetz <mike.kravetz@oracle.com>
      Cc: Joel Fernandes <joel@joelfernandes.org>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      fda153c8
    • A
      selftest/vm: fix map_fixed_noreplace test failure · f39c5800
      Aneesh Kumar K.V 提交于
      On the latest RHEL the test fails due to executable mapped at 256MB
      address
      
           # ./map_fixed_noreplace
          mmap() @ 0x10000000-0x10050000 p=0xffffffffffffffff result=File exists
          10000000-10010000 r-xp 00000000 fd:04 34905657                           /root/rpmbuild/BUILD/kernel-5.14.0-56.el9/linux-5.14.0-56.el9.ppc64le/tools/testing/selftests/vm/map_fixed_noreplace
          10010000-10020000 r--p 00000000 fd:04 34905657                           /root/rpmbuild/BUILD/kernel-5.14.0-56.el9/linux-5.14.0-56.el9.ppc64le/tools/testing/selftests/vm/map_fixed_noreplace
          10020000-10030000 rw-p 00010000 fd:04 34905657                           /root/rpmbuild/BUILD/kernel-5.14.0-56.el9/linux-5.14.0-56.el9.ppc64le/tools/testing/selftests/vm/map_fixed_noreplace
          10029b90000-10029bc0000 rw-p 00000000 00:00 0                            [heap]
          7fffbb510000-7fffbb750000 r-xp 00000000 fd:04 24534                      /usr/lib64/libc.so.6
          7fffbb750000-7fffbb760000 r--p 00230000 fd:04 24534                      /usr/lib64/libc.so.6
          7fffbb760000-7fffbb770000 rw-p 00240000 fd:04 24534                      /usr/lib64/libc.so.6
          7fffbb780000-7fffbb7a0000 r--p 00000000 00:00 0                          [vvar]
          7fffbb7a0000-7fffbb7b0000 r-xp 00000000 00:00 0                          [vdso]
          7fffbb7b0000-7fffbb800000 r-xp 00000000 fd:04 24514                      /usr/lib64/ld64.so.2
          7fffbb800000-7fffbb810000 r--p 00040000 fd:04 24514                      /usr/lib64/ld64.so.2
          7fffbb810000-7fffbb820000 rw-p 00050000 fd:04 24514                      /usr/lib64/ld64.so.2
          7fffd93f0000-7fffd9420000 rw-p 00000000 00:00 0                          [stack]
          Error: couldn't map the space we need for the test
      
      Fix this by finding a free address using mmap instead of hardcoding
      BASE_ADDRESS.
      
      Link: https://lkml.kernel.org/r/20220217083417.373823-1-aneesh.kumar@linux.ibm.comSigned-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Jann Horn <jannh@google.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      f39c5800
  8. 26 2月, 2022 3 次提交
  9. 25 2月, 2022 2 次提交
  10. 23 2月, 2022 6 次提交
    • G
      perf script: Fix error when printing 'weight' field · 13e741b8
      German Gomez 提交于
      In SPE traces the 'weight' field can't be printed in 'perf script'
      because the 'dummy:u' event doesn't have the WEIGHT attribute set.
      
      Use evsel__do_check_stype(..) to check this field, as it's done with
      other fields such as "phys_addr".
      
      Before:
      
        $ perf record -e arm_spe_0// -- sleep 1
        $ perf script -F event,ip,weight
        Samples for 'dummy:u' event do not have WEIGHT attribute set. Cannot print 'weight' field.
      
      After:
      
        $ perf script -F event,ip,weight
           l1d-access:               12 ffffaf629d4cb320
           tlb-access:               12 ffffaf629d4cb320
               memory:               12 ffffaf629d4cb320
      
      Fixes: b0fde9c6 ("perf arm-spe: Add SPE total latency as PERF_SAMPLE_WEIGHT")
      Signed-off-by: NGerman Gomez <german.gomez@arm.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: https://lore.kernel.org/r/20220221171707.62960-1-german.gomez@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      13e741b8
    • A
      tools arch x86: Sync the msr-index.h copy with the kernel sources · 5b061a32
      Arnaldo Carvalho de Melo 提交于
      To pick up the changes in:
      
        39150352 ("KVM: x86: SVM: move avic definitions from AMD's spec to svm.h")
      
      Addressing these tools/perf build warnings:
      
          diff -u tools/arch/x86/include/asm/msr-index.h arch/x86/include/asm/msr-index.h
          Warning: Kernel ABI header at 'tools/arch/x86/include/asm/msr-index.h' differs from latest version at 'arch/x86/include/asm/msr-index.h'
      
      That makes the beautification scripts to pick some new entries:
      
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > before
        $ cp arch/x86/include/asm/msr-index.h tools/arch/x86/include/asm/msr-index.h
        $ tools/perf/trace/beauty/tracepoints/x86_msr.sh > after
        $ diff -u before after
        --- before	2022-02-22 17:35:36.996271430 -0300
        +++ after	2022-02-22 17:35:46.258503347 -0300
        @@ -287,6 +287,7 @@
         	[0xc0010114 - x86_AMD_V_KVM_MSRs_offset] = "VM_CR",
         	[0xc0010115 - x86_AMD_V_KVM_MSRs_offset] = "VM_IGNNE",
         	[0xc0010117 - x86_AMD_V_KVM_MSRs_offset] = "VM_HSAVE_PA",
        +	[0xc001011b - x86_AMD_V_KVM_MSRs_offset] = "AMD64_SVM_AVIC_DOORBELL",
         	[0xc001011e - x86_AMD_V_KVM_MSRs_offset] = "AMD64_VM_PAGE_FLUSH",
         	[0xc001011f - x86_AMD_V_KVM_MSRs_offset] = "AMD64_VIRT_SPEC_CTRL",
         	[0xc0010130 - x86_AMD_V_KVM_MSRs_offset] = "AMD64_SEV_ES_GHCB",
        $
      
      And this gets rebuilt:
      
        CC      /tmp/build/perf/trace/beauty/tracepoints/x86_msr.o
        LD      /tmp/build/perf/trace/beauty/tracepoints/perf-in.o
        LD      /tmp/build/perf/trace/beauty/perf-in.o
        CC      /tmp/build/perf/util/amd-sample-raw.o
        LD      /tmp/build/perf/util/perf-in.o
        LD      /tmp/build/perf/perf-in.o
        LINK    /tmp/build/perf/perf
      
      Now one can trace systemwide asking to see backtraces to where those
      MSRs are being read/written with:
      
        # perf trace -e msr:*_msr/max-stack=32/ --filter="msr>=AMD64_SVM_AVIC_DOORBELL && msr<=AMD64_SEV_ES_GHCB"
        ^C#
      
      If we use -v (verbose mode) we can see what it does behind the scenes:
      
        # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr>=AMD64_SVM_AVIC_DOORBELL && msr<=AMD64_SEV_ES_GHCB"
        Using CPUID AuthenticAMD-25-21-0
        0xc001011b
        0xc0010130
        New filter for msr:read_msr: (msr>=0xc001011b && msr<=0xc0010130) && (common_pid != 1019953 && common_pid != 3629)
        0xc001011b
        0xc0010130
        New filter for msr:write_msr: (msr>=0xc001011b && msr<=0xc0010130) && (common_pid != 1019953 && common_pid != 3629)
        mmap size 528384B
        ^C#
      
        Example with a frequent msr:
      
          # perf trace -v -e msr:*_msr/max-stack=32/ --filter="msr==IA32_SPEC_CTRL" --max-events 2
          Using CPUID AuthenticAMD-25-21-0
          0x48
          New filter for msr:read_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
          0x48
          New filter for msr:write_msr: (msr==0x48) && (common_pid != 2612129 && common_pid != 3841)
          mmap size 528384B
          Looking at the vmlinux_path (8 entries long)
          symsrc__init: build id mismatch for vmlinux.
          Using /proc/kcore for kernel data
          Using /proc/kallsyms for symbols
             0.000 Timer/2525383 msr:write_msr(msr: IA32_SPEC_CTRL, val: 6)
                                               do_trace_write_msr ([kernel.kallsyms])
                                               do_trace_write_msr ([kernel.kallsyms])
                                               __switch_to_xtra ([kernel.kallsyms])
                                               __switch_to ([kernel.kallsyms])
                                               __schedule ([kernel.kallsyms])
                                               schedule ([kernel.kallsyms])
                                               futex_wait_queue_me ([kernel.kallsyms])
                                               futex_wait ([kernel.kallsyms])
                                               do_futex ([kernel.kallsyms])
                                               __x64_sys_futex ([kernel.kallsyms])
                                               do_syscall_64 ([kernel.kallsyms])
                                               entry_SYSCALL_64_after_hwframe ([kernel.kallsyms])
                                               __futex_abstimed_wait_common64 (/usr/lib64/libpthread-2.33.so)
             0.030 :0/0 msr:write_msr(msr: IA32_SPEC_CTRL, val: 2)
                                               do_trace_write_msr ([kernel.kallsyms])
                                               do_trace_write_msr ([kernel.kallsyms])
                                               __switch_to_xtra ([kernel.kallsyms])
                                               __switch_to ([kernel.kallsyms])
                                               __schedule ([kernel.kallsyms])
                                               schedule_idle ([kernel.kallsyms])
                                               do_idle ([kernel.kallsyms])
                                               cpu_startup_entry ([kernel.kallsyms])
                                               secondary_startup_64_no_verify ([kernel.kallsyms])
        #
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Maxim Levitsky <mlevitsk@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Link: http://lore.kernel.org/lkml/YhVKxaft+z8rpOfy@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5b061a32
    • A
      perf data: Fix double free in perf_session__delete() · 69560e36
      Alexey Bayduraev 提交于
      When perf_data__create_dir() fails, it calls close_dir(), but
      perf_session__delete() also calls close_dir() and since dir.version and
      dir.nr were initialized by perf_data__create_dir(), a double free occurs.
      
      This patch moves the initialization of dir.version and dir.nr after
      successful initialization of dir.files, that prevents double freeing.
      This behavior is already implemented in perf_data__open_dir().
      
      Fixes: 14552063 ("perf data: Add perf_data__(create_dir|close_dir) functions")
      Signed-off-by: NAlexey Bayduraev <alexey.v.bayduraev@linux.intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Antonov <alexander.antonov@linux.intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Budankov <abudankov@huawei.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220218152341.5197-2-alexey.v.bayduraev@linux.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      69560e36
    • M
      linkage: remove SYM_FUNC_{START,END}_ALIAS() · be9aea74
      Mark Rutland 提交于
      Now that all aliases are defined using SYM_FUNC_ALIAS(), remove the old
      SYM_FUNC_{START,END}_ALIAS() macros.
      
      There should be no functional change as a result of this patch.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Acked-by: NArd Biesheuvel <ardb@kernel.org>
      Acked-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: NMark Brown <broonie@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220216162229.1076788-5-mark.rutland@arm.comSigned-off-by: NWill Deacon <will@kernel.org>
      be9aea74
    • M
      x86: clean up symbol aliasing · 7be2e319
      Mark Rutland 提交于
      Now that we have SYM_FUNC_ALIAS() and SYM_FUNC_ALIAS_WEAK(), use those
      to simplify the definition of function aliases across arch/x86.
      
      For clarity, where there are multiple annotations such as
      EXPORT_SYMBOL(), I've tried to keep annotations grouped by symbol. For
      example, where a function has a name and an alias which are both
      exported, this is organised as:
      
      	SYM_FUNC_START(func)
      	    ... asm insns ...
      	SYM_FUNC_END(func)
      	EXPORT_SYMBOL(func)
      
      	SYM_FUNC_ALIAS(alias, func)
      	EXPORT_SYMBOL(alias)
      
      Where there are only aliases and no exports or other annotations, I have
      not bothered with line spacing, e.g.
      
      	SYM_FUNC_START(func)
      	    ... asm insns ...
      	SYM_FUNC_END(func)
      	SYM_FUNC_ALIAS(alias, func)
      
      The tools/perf/ copies of memset_64.S and memset_64.S are updated
      likewise to avoid the build system complaining these are mismatched:
      
      | Warning: Kernel ABI header at 'tools/arch/x86/lib/memcpy_64.S' differs from latest version at 'arch/x86/lib/memcpy_64.S'
      | diff -u tools/arch/x86/lib/memcpy_64.S arch/x86/lib/memcpy_64.S
      | Warning: Kernel ABI header at 'tools/arch/x86/lib/memset_64.S' differs from latest version at 'arch/x86/lib/memset_64.S'
      | diff -u tools/arch/x86/lib/memset_64.S arch/x86/lib/memset_64.S
      
      There should be no functional change as a result of this patch.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Acked-by: NArd Biesheuvel <ardb@kernel.org>
      Acked-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: NMark Brown <broonie@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220216162229.1076788-4-mark.rutland@arm.comSigned-off-by: NWill Deacon <will@kernel.org>
      7be2e319
    • M
      linkage: add SYM_FUNC_ALIAS{,_LOCAL,_WEAK}() · e0891269
      Mark Rutland 提交于
      Currently aliasing an asm function requires adding START and END
      annotations for each name, as per Documentation/asm-annotations.rst:
      
      	SYM_FUNC_START_ALIAS(__memset)
      	SYM_FUNC_START(memset)
      	    ... asm insns ...
      	SYM_FUNC_END(memset)
      	SYM_FUNC_END_ALIAS(__memset)
      
      This is more painful than necessary to maintain, especially where a
      function has many aliases, some of which we may wish to define
      conditionally. For example, arm64's memcpy/memmove implementation (which
      uses some arch-specific SYM_*() helpers) has:
      
      	SYM_FUNC_START_ALIAS(__memmove)
      	SYM_FUNC_START_ALIAS_WEAK_PI(memmove)
      	SYM_FUNC_START_ALIAS(__memcpy)
      	SYM_FUNC_START_WEAK_PI(memcpy)
      	    ... asm insns ...
      	SYM_FUNC_END_PI(memcpy)
      	EXPORT_SYMBOL(memcpy)
      	SYM_FUNC_END_ALIAS(__memcpy)
      	EXPORT_SYMBOL(__memcpy)
      	SYM_FUNC_END_ALIAS_PI(memmove)
      	EXPORT_SYMBOL(memmove)
      	SYM_FUNC_END_ALIAS(__memmove)
      	EXPORT_SYMBOL(__memmove)
      	SYM_FUNC_START(name)
      
      It would be much nicer if we could define the aliases *after* the
      standard function definition. This would avoid the need to specify each
      symbol name twice, and would make it easier to spot the canonical
      function definition.
      
      This patch adds new macros to allow us to do so, which allows the above
      example to be rewritten more succinctly as:
      
      	SYM_FUNC_START(__pi_memcpy)
      	    ... asm insns ...
      	SYM_FUNC_END(__pi_memcpy)
      
      	SYM_FUNC_ALIAS(__memcpy, __pi_memcpy)
      	EXPORT_SYMBOL(__memcpy)
      	SYM_FUNC_ALIAS_WEAK(memcpy, __memcpy)
      	EXPORT_SYMBOL(memcpy)
      
      	SYM_FUNC_ALIAS(__pi_memmove, __pi_memcpy)
      	SYM_FUNC_ALIAS(__memmove, __pi_memmove)
      	EXPORT_SYMBOL(__memmove)
      	SYM_FUNC_ALIAS_WEAK(memmove, __memmove)
      	EXPORT_SYMBOL(memmove)
      
      The reduction in duplication will also make it possible to replace some
      uses of WEAK with more accurate Kconfig guards, e.g.
      
      	#ifndef CONFIG_KASAN
      	SYM_FUNC_ALIAS(memmove, __memmove)
      	EXPORT_SYMBOL(memmove)
      	#endif
      
      ... which should make it easier to ensure that symbols are neither used
      nor overidden unexpectedly.
      
      The existing SYM_FUNC_START_ALIAS() and SYM_FUNC_START_LOCAL_ALIAS() are
      marked as deprecated, and will be removed once existing users are moved
      over to the new scheme.
      
      The tools/perf/ copy of linkage.h is updated to match. A subsequent
      patch will depend upon this when updating the x86 asm annotations.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Acked-by: NArd Biesheuvel <ardb@kernel.org>
      Acked-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Acked-by: NMark Brown <broonie@kernel.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Acked-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Link: https://lore.kernel.org/r/20220216162229.1076788-2-mark.rutland@arm.comSigned-off-by: NWill Deacon <will@kernel.org>
      e0891269
  11. 22 2月, 2022 1 次提交
  12. 21 2月, 2022 2 次提交
    • R
      tools/cgroup/slabinfo: update to work with struct slab · 22194473
      Roman Gushchin 提交于
      After the introduction of the dedicated struct slab to describe slab
      pages by commit d122019b ("mm: Split slab into its own type") and
      the following removal of the corresponding struct page's fields by
      commit 07f910f9 ("mm: Remove slab from struct page") the
      memcg_slabinfo tool broke. An attempt to run it produces a trace like
      this:
      Traceback (most recent call last):
        File "/usr/bin/drgn", line 33, in <module>
          sys.exit(load_entry_point('drgn==0.0.16', 'console_scripts', 'drgn')())
        File "/usr/lib64/python3.9/site-packages/drgn/internal/cli.py", line 133, in main
          runpy.run_path(args.script[0], init_globals=init_globals, run_name="__main__")
        File "/usr/lib64/python3.9/runpy.py", line 268, in run_path
          return _run_module_code(code, init_globals, run_name,
        File "/usr/lib64/python3.9/runpy.py", line 97, in _run_module_code
          _run_code(code, mod_globals, init_globals,
        File "/usr/lib64/python3.9/runpy.py", line 87, in _run_code
          exec(code, run_globals)
        File "memcg_slabinfo.py", line 226, in <module>
          main()
        File "memcg_slabinfo.py", line 199, in main
          cache = page.slab_cache
      AttributeError: 'struct page' has no member 'slab_cache'
      
      The problem can be fixed by explicitly casting struct page * to struct
      slab * for slab pages. The tools works as expected with this fix, e.g.:
      
      cred_jar             776    776    192   21    1 : tunables    0    0    0 : slabdata    547    547      0
      kmalloc-cg-32          6      6     32  128    1 : tunables    0    0    0 : slabdata      9      9      0
      files_cache            3      3    832   39    8 : tunables    0    0    0 : slabdata      8      8      0
      kmalloc-cg-512         1      1    512   32    4 : tunables    0    0    0 : slabdata     10     10      0
      task_struct           10     10   6720    4    8 : tunables    0    0    0 : slabdata     63     63      0
      mm_struct              3      3   1664   19    8 : tunables    0    0    0 : slabdata      9      9      0
      kmalloc-cg-16          1      1     16  256    1 : tunables    0    0    0 : slabdata      8      8      0
      pde_opener             1      1     40  102    1 : tunables    0    0    0 : slabdata      8      8      0
      anon_vma_chain       375    375     64   64    1 : tunables    0    0    0 : slabdata     81     81      0
      radix_tree_node        3      3    584   28    4 : tunables    0    0    0 : slabdata    419    419      0
      dentry                98     98    312   26    2 : tunables    0    0    0 : slabdata   1420   1420      0
      btrfs_inode            3      3   2368   13    8 : tunables    0    0    0 : slabdata    730    730      0
      signal_cache           3      3   1600   20    8 : tunables    0    0    0 : slabdata     17     17      0
      sighand_cache          3      3   2240   14    8 : tunables    0    0    0 : slabdata     20     20      0
      filp                  90     90    512   32    4 : tunables    0    0    0 : slabdata     95     95      0
      anon_vma             214    214    200   20    1 : tunables    0    0    0 : slabdata    162    162      0
      kmalloc-cg-1k          1      1   1024   32    8 : tunables    0    0    0 : slabdata     22     22      0
      pid                   10     10    256   32    2 : tunables    0    0    0 : slabdata     14     14      0
      kmalloc-cg-64          2      2     64   64    1 : tunables    0    0    0 : slabdata      8      8      0
      kmalloc-cg-96          3      3     96   42    1 : tunables    0    0    0 : slabdata      8      8      0
      sock_inode_cache       5      5   1408   23    8 : tunables    0    0    0 : slabdata     29     29      0
      UNIX                   7      7   1920   17    8 : tunables    0    0    0 : slabdata     21     21      0
      inode_cache           36     36   1152   28    8 : tunables    0    0    0 : slabdata    680    680      0
      proc_inode_cache      26     26   1224   26    8 : tunables    0    0    0 : slabdata     64     64      0
      kmalloc-cg-2k          2      2   2048   16    8 : tunables    0    0    0 : slabdata      9      9      0
      
      v2: change naming and count_partial()/count_free()/for_each_slab()
          signatures to work with slabs, suggested by Matthew Wilcox
      
      Fixes: 07f910f9 ("mm: Remove slab from struct page")
      Reported-by: NVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: NRoman Gushchin <guro@fb.com>
      Tested-by: NVasily Averin <vvs@virtuozzo.com>
      Signed-off-by: NVlastimil Babka <vbabka@suse.cz>
      Link: https://lore.kernel.org/linux-patches/Yg2cKKnIboNu7j+p@carbon.DHCP.thefacebook.com/
      22194473
    • P
      x86/speculation: Rename RETPOLINE_AMD to RETPOLINE_LFENCE · d45476d9
      Peter Zijlstra (Intel) 提交于
      The RETPOLINE_AMD name is unfortunate since it isn't necessarily
      AMD only, in fact Hygon also uses it. Furthermore it will likely be
      sufficient for some Intel processors. Therefore rename the thing to
      RETPOLINE_LFENCE to better describe what it is.
      
      Add the spectre_v2=retpoline,lfence option as an alias to
      spectre_v2=retpoline,amd to preserve existing setups. However, the output
      of /sys/devices/system/cpu/vulnerabilities/spectre_v2 will be changed.
      
        [ bp: Fix typos, massage. ]
      Co-developed-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NJosh Poimboeuf <jpoimboe@redhat.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      d45476d9
  13. 19 2月, 2022 2 次提交