1. 18 12月, 2017 2 次提交
  2. 05 12月, 2017 2 次提交
  3. 14 11月, 2017 1 次提交
  4. 12 11月, 2017 1 次提交
    • X
      x86/intel_rdt: Fix a silent failure when writing zero value schemata · 2244645a
      Xiaochen Shen 提交于
      Writing an invalid schemata with no domain values (e.g., "(L3|MB):"),
      results in a silent failure, i.e. the last_cmd_status returns OK,
      
      Check for an empty value and set the result string with a proper error
      message and return -EINVAL.
      
      Before the fix:
       # mkdir /sys/fs/resctrl/p1
      
       # echo "L3:" > /sys/fs/resctrl/p1/schemata
       (silent failure)
       # cat /sys/fs/resctrl/info/last_cmd_status
       ok
      
       # echo "MB:" > /sys/fs/resctrl/p1/schemata
       (silent failure)
       # cat /sys/fs/resctrl/info/last_cmd_status
       ok
      
      After the fix:
       # mkdir /sys/fs/resctrl/p1
      
       # echo "L3:" > /sys/fs/resctrl/p1/schemata
       -bash: echo: write error: Invalid argument
       # cat /sys/fs/resctrl/info/last_cmd_status
       Missing 'L3' value
      
       # echo "MB:" > /sys/fs/resctrl/p1/schemata
       -bash: echo: write error: Invalid argument
       # cat /sys/fs/resctrl/info/last_cmd_status
       Missing 'MB' value
      
      [ Tony: This is an unintended side effect of the patch earlier to allow the
          	user to just write the value they want to change.  While allowing
          	user to specify less than all of the values, it also allows an
          	empty value. ]
      
      Fixes: c4026b7b ("x86/intel_rdt: Implement "update" mode when writing schemata file")
      Signed-off-by: NXiaochen Shen <xiaochen.shen@intel.com>
      Signed-off-by: NTony Luck <tony.luck@intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Vikas Shivappa <vikas.shivappa@linux.intel.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Link: https://lkml.kernel.org/r/20171110191624.20280-1-tony.luck@intel.com
      2244645a
  5. 11 11月, 2017 1 次提交
  6. 10 11月, 2017 2 次提交
  7. 08 11月, 2017 1 次提交
    • R
      x86/umip: Enable User-Mode Instruction Prevention at runtime · aa35f896
      Ricardo Neri 提交于
      User-Mode Instruction Prevention (UMIP) is enabled by setting/clearing a
      bit in %cr4.
      
      It makes sense to enable UMIP at some point while booting, before user
      spaces come up. Like SMAP and SMEP, is not critical to have it enabled
      very early during boot. This is because UMIP is relevant only when there is
      a user space to be protected from. Given these similarities, UMIP can be
      enabled along with SMAP and SMEP.
      
      At the moment, UMIP is disabled by default at build time. It can be enabled
      at build time by selecting CONFIG_X86_INTEL_UMIP. If enabled at build time,
      it can be disabled at run time by adding clearcpuid=514 to the kernel
      parameters.
      Signed-off-by: NRicardo Neri <ricardo.neri-calderon@linux.intel.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Andy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Chen Yucong <slaoub@gmail.com>
      Cc: Chris Metcalf <cmetcalf@mellanox.com>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: Denys Vlasenko <dvlasenk@redhat.com>
      Cc: Fenghua Yu <fenghua.yu@intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Huang Rui <ray.huang@amd.com>
      Cc: Jiri Slaby <jslaby@suse.cz>
      Cc: Jonathan Corbet <corbet@lwn.net>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Michael S. Tsirkin <mst@redhat.com>
      Cc: Paolo Bonzini <pbonzini@redhat.com>
      Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ravi V. Shankar <ravi.v.shankar@intel.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Cc: Tony Luck <tony.luck@intel.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      Cc: ricardo.neri@intel.com
      Link: http://lkml.kernel.org/r/1509935277-22138-10-git-send-email-ricardo.neri-calderon@linux.intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      aa35f896
  8. 07 11月, 2017 2 次提交
  9. 03 11月, 2017 2 次提交
    • R
      x86: CPU: Fix up "cpu MHz" in /proc/cpuinfo · 941f5f0f
      Rafael J. Wysocki 提交于
      Commit 890da9cf (Revert "x86: do not use cpufreq_quick_get() for
      /proc/cpuinfo "cpu MHz"") is not sufficient to restore the previous
      behavior of "cpu MHz" in /proc/cpuinfo on x86 due to some changes
      made after the commit it has reverted.
      
      To address this, make the code in question use arch_freq_get_on_cpu()
      which also is used by cpufreq for reporting the current frequency of
      CPUs and since that function doesn't really depend on cpufreq in any
      way, drop the CONFIG_CPU_FREQ dependency for the object file
      containing it.
      
      Also refactor arch_freq_get_on_cpu() somewhat to avoid IPIs and
      return cached values right away if it is called very often over a
      short time (to prevent user space from triggering IPI storms through
      it).
      
      Fixes: 890da9cf (Revert "x86: do not use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz"")
      Cc: stable@kernel.org   # 4.13 - together with 890da9cfSigned-off-by: NRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      941f5f0f
    • L
      Revert "x86: do not use cpufreq_quick_get() for /proc/cpuinfo "cpu MHz"" · 890da9cf
      Linus Torvalds 提交于
      This reverts commit 51204e06.
      
      There wasn't really any good reason for it, and people are complaining
      (rightly) that it broke existing practice.
      
      Cc: Len Brown <len.brown@intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      890da9cf
  10. 02 11月, 2017 5 次提交
    • T
      x86/cpuid: Replace set/clear_bit32() · 06dd688d
      Thomas Gleixner 提交于
      Peter pointed out that the set/clear_bit32() variants are broken in various
      aspects.
      
      Replace them with open coded set/clear_bit() and type cast
      cpu_info::x86_capability as it's done in all other places throughout x86.
      
      Fixes: 0b00de85 ("x86/cpuid: Add generic table for CPUID dependencies")
      Reported-by: NPeter Ziljstra <peterz@infradead.org>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Andi Kleen <ak@linux.intel.com>
      06dd688d
    • G
      License cleanup: add SPDX GPL-2.0 license identifier to files with no license · b2441318
      Greg Kroah-Hartman 提交于
      Many source files in the tree are missing licensing information, which
      makes it harder for compliance tools to determine the correct license.
      
      By default all files without license information are under the default
      license of the kernel, which is GPL version 2.
      
      Update the files which contain no license information with the 'GPL-2.0'
      SPDX license identifier.  The SPDX identifier is a legally binding
      shorthand, which can be used instead of the full boiler plate text.
      
      This patch is based on work done by Thomas Gleixner and Kate Stewart and
      Philippe Ombredanne.
      
      How this work was done:
      
      Patches were generated and checked against linux-4.14-rc6 for a subset of
      the use cases:
       - file had no licensing information it it.
       - file was a */uapi/* one with no licensing information in it,
       - file was a */uapi/* one with existing licensing information,
      
      Further patches will be generated in subsequent months to fix up cases
      where non-standard license headers were used, and references to license
      had to be inferred by heuristics based on keywords.
      
      The analysis to determine which SPDX License Identifier to be applied to
      a file was done in a spreadsheet of side by side results from of the
      output of two independent scanners (ScanCode & Windriver) producing SPDX
      tag:value files created by Philippe Ombredanne.  Philippe prepared the
      base worksheet, and did an initial spot review of a few 1000 files.
      
      The 4.13 kernel was the starting point of the analysis with 60,537 files
      assessed.  Kate Stewart did a file by file comparison of the scanner
      results in the spreadsheet to determine which SPDX license identifier(s)
      to be applied to the file. She confirmed any determination that was not
      immediately clear with lawyers working with the Linux Foundation.
      
      Criteria used to select files for SPDX license identifier tagging was:
       - Files considered eligible had to be source code files.
       - Make and config files were included as candidates if they contained >5
         lines of source
       - File already had some variant of a license header in it (even if <5
         lines).
      
      All documentation files were explicitly excluded.
      
      The following heuristics were used to determine which SPDX license
      identifiers to apply.
      
       - when both scanners couldn't find any license traces, file was
         considered to have no license information in it, and the top level
         COPYING file license applied.
      
         For non */uapi/* files that summary was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0                                              11139
      
         and resulted in the first patch in this series.
      
         If that file was a */uapi/* path one, it was "GPL-2.0 WITH
         Linux-syscall-note" otherwise it was "GPL-2.0".  Results of that was:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|-------
         GPL-2.0 WITH Linux-syscall-note                        930
      
         and resulted in the second patch in this series.
      
       - if a file had some form of licensing information in it, and was one
         of the */uapi/* ones, it was denoted with the Linux-syscall-note if
         any GPL family license was found in the file or had no licensing in
         it (per prior point).  Results summary:
      
         SPDX license identifier                            # files
         ---------------------------------------------------|------
         GPL-2.0 WITH Linux-syscall-note                       270
         GPL-2.0+ WITH Linux-syscall-note                      169
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-2-Clause)    21
         ((GPL-2.0 WITH Linux-syscall-note) OR BSD-3-Clause)    17
         LGPL-2.1+ WITH Linux-syscall-note                      15
         GPL-1.0+ WITH Linux-syscall-note                       14
         ((GPL-2.0+ WITH Linux-syscall-note) OR BSD-3-Clause)    5
         LGPL-2.0+ WITH Linux-syscall-note                       4
         LGPL-2.1 WITH Linux-syscall-note                        3
         ((GPL-2.0 WITH Linux-syscall-note) OR MIT)              3
         ((GPL-2.0 WITH Linux-syscall-note) AND MIT)             1
      
         and that resulted in the third patch in this series.
      
       - when the two scanners agreed on the detected license(s), that became
         the concluded license(s).
      
       - when there was disagreement between the two scanners (one detected a
         license but the other didn't, or they both detected different
         licenses) a manual inspection of the file occurred.
      
       - In most cases a manual inspection of the information in the file
         resulted in a clear resolution of the license that should apply (and
         which scanner probably needed to revisit its heuristics).
      
       - When it was not immediately clear, the license identifier was
         confirmed with lawyers working with the Linux Foundation.
      
       - If there was any question as to the appropriate license identifier,
         the file was flagged for further research and to be revisited later
         in time.
      
      In total, over 70 hours of logged manual review was done on the
      spreadsheet to determine the SPDX license identifiers to apply to the
      source files by Kate, Philippe, Thomas and, in some cases, confirmation
      by lawyers working with the Linux Foundation.
      
      Kate also obtained a third independent scan of the 4.13 code base from
      FOSSology, and compared selected files where the other two scanners
      disagreed against that SPDX file, to see if there was new insights.  The
      Windriver scanner is based on an older version of FOSSology in part, so
      they are related.
      
      Thomas did random spot checks in about 500 files from the spreadsheets
      for the uapi headers and agreed with SPDX license identifier in the
      files he inspected. For the non-uapi files Thomas did random spot checks
      in about 15000 files.
      
      In initial set of patches against 4.14-rc6, 3 files were found to have
      copy/paste license identifier errors, and have been fixed to reflect the
      correct identifier.
      
      Additionally Philippe spent 10 hours this week doing a detailed manual
      inspection and review of the 12,461 patched files from the initial patch
      version early this week with:
       - a full scancode scan run, collecting the matched texts, detected
         license ids and scores
       - reviewing anything where there was a license detected (about 500+
         files) to ensure that the applied SPDX license was correct
       - reviewing anything where there was no detection but the patch license
         was not GPL-2.0 WITH Linux-syscall-note to ensure that the applied
         SPDX license was correct
      
      This produced a worksheet with 20 files needing minor correction.  This
      worksheet was then exported into 3 different .csv files for the
      different types of files to be modified.
      
      These .csv files were then reviewed by Greg.  Thomas wrote a script to
      parse the csv files and add the proper SPDX tag to the file, in the
      format that the file expected.  This script was further refined by Greg
      based on the output to detect more types of files automatically and to
      distinguish between header and source .c files (which need different
      comment types.)  Finally Greg ran the script using the .csv files to
      generate the patches.
      Reviewed-by: NKate Stewart <kstewart@linuxfoundation.org>
      Reviewed-by: NPhilippe Ombredanne <pombredanne@nexb.com>
      Reviewed-by: NThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b2441318
    • A
      x86/entry/64: Stop initializing TSS.sp0 at boot · 20bb8344
      Andy Lutomirski 提交于
      In my quest to get rid of thread_struct::sp0, I want to clean up or
      remove all of its readers.  Two of them are in cpu_init() (32-bit and
      64-bit), and they aren't needed.  This is because we never enter
      userspace at all on the threads that CPUs are initialized in.
      
      Poison the initial TSS.sp0 and stop initializing it on CPU init.
      
      The comment text mostly comes from Dave Hansen.  Thanks!
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Cc: Borislav Petkov <bpetkov@suse.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/ee4a00540ad28c6cff475fbcc7769a4460acc861.1509609304.git.luto@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      20bb8344
    • A
      x86/entry/64: Pass SP0 directly to load_sp0() · da51da18
      Andy Lutomirski 提交于
      load_sp0() had an odd signature:
      
        void load_sp0(struct tss_struct *tss, struct thread_struct *thread);
      
      Simplify it to:
      
        void load_sp0(unsigned long sp0);
      
      Also simplify a few get_cpu()/put_cpu() sequences to
      preempt_disable()/preempt_enable().
      Signed-off-by: NAndy Lutomirski <luto@kernel.org>
      Reviewed-by: NBorislav Petkov <bp@suse.de>
      Cc: Borislav Petkov <bpetkov@suse.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/2655d8b42ed940aa384fe18ee1129bbbcf730a08.1509609304.git.luto@kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      da51da18
    • B
      x86/mcelog: Get rid of RCU remnants · 7298f08e
      Borislav Petkov 提交于
      Jeremy reported a suspicious RCU usage warning in mcelog.
      
      /dev/mcelog is called in process context now as part of the notifier
      chain and doesn't need any of the fancy RCU and lockless accesses which
      it did in atomic context.
      
      Axe it all in favor of a simple mutex synchronization which cures the
      problem reported.
      
      Fixes: 5de97c9f ("x86/mce: Factor out and deprecate the /dev/mcelog driver")
      Reported-by: NJeremy Cline <jcline@redhat.com>
      Signed-off-by: NBorislav Petkov <bp@suse.de>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Reviewed-and-tested-by: NTony Luck <tony.luck@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: linux-edac@vger.kernel.org
      Cc: Laura Abbott <labbott@redhat.com>
      Cc: stable@vger.kernel.org
      Link: https://lkml.kernel.org/r/20171101164754.xzzmskl4ngrqc5br@pd.tnic
      Link: https://bugzilla.redhat.com/show_bug.cgi?id=1498969
      7298f08e
  11. 31 10月, 2017 1 次提交
  12. 21 10月, 2017 3 次提交
    • R
      x86/intel_rdt: Fix potential deadlock during resctrl mount · 87943db7
      Reinette Chatre 提交于
      Sai reported a warning during some MBA tests:
      
      [  236.755559] ======================================================
      [  236.762443] WARNING: possible circular locking dependency detected
      [  236.769328] 4.14.0-rc4-yocto-standard #8 Not tainted
      [  236.774857] ------------------------------------------------------
      [  236.781738] mount/10091 is trying to acquire lock:
      [  236.787071]  (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff8117f892>] static_key_enable+0x12/0x30
      [  236.797058]
                     but task is already holding lock:
      [  236.803552]  (&type->s_umount_key#37/1){+.+.}, at: [<ffffffff81208b2f>] sget_userns+0x32f/0x520
      [  236.813247]
                     which lock already depends on the new lock.
      
      [  236.822353]
                     the existing dependency chain (in reverse order) is:
      [  236.830686]
                     -> #4 (&type->s_umount_key#37/1){+.+.}:
      [  236.837756]        __lock_acquire+0x1100/0x11a0
      [  236.842799]        lock_acquire+0xdf/0x1d0
      [  236.847363]        down_write_nested+0x46/0x80
      [  236.852310]        sget_userns+0x32f/0x520
      [  236.856873]        kernfs_mount_ns+0x7e/0x1f0
      [  236.861728]        rdt_mount+0x30c/0x440
      [  236.866096]        mount_fs+0x38/0x150
      [  236.870262]        vfs_kern_mount+0x67/0x150
      [  236.875015]        do_mount+0x1df/0xd50
      [  236.879286]        SyS_mount+0x95/0xe0
      [  236.883464]        entry_SYSCALL_64_fastpath+0x18/0xad
      [  236.889183]
                     -> #3 (rdtgroup_mutex){+.+.}:
      [  236.895292]        __lock_acquire+0x1100/0x11a0
      [  236.900337]        lock_acquire+0xdf/0x1d0
      [  236.904899]        __mutex_lock+0x80/0x8f0
      [  236.909459]        mutex_lock_nested+0x1b/0x20
      [  236.914407]        intel_rdt_online_cpu+0x3b/0x4a0
      [  236.919745]        cpuhp_invoke_callback+0xce/0xb80
      [  236.925177]        cpuhp_thread_fun+0x1c5/0x230
      [  236.930222]        smpboot_thread_fn+0x11a/0x1e0
      [  236.935362]        kthread+0x152/0x190
      [  236.939536]        ret_from_fork+0x27/0x40
      [  236.944097]
                     -> #2 (cpuhp_state-up){+.+.}:
      [  236.950199]        __lock_acquire+0x1100/0x11a0
      [  236.955241]        lock_acquire+0xdf/0x1d0
      [  236.959800]        cpuhp_issue_call+0x12e/0x1c0
      [  236.964845]        __cpuhp_setup_state_cpuslocked+0x13b/0x2f0
      [  236.971242]        __cpuhp_setup_state+0xa7/0x120
      [  236.976483]        page_writeback_init+0x43/0x67
      [  236.981623]        pagecache_init+0x38/0x3b
      [  236.986281]        start_kernel+0x3c6/0x41a
      [  236.990931]        x86_64_start_reservations+0x2a/0x2c
      [  236.996650]        x86_64_start_kernel+0x72/0x75
      [  237.001793]        verify_cpu+0x0/0xfb
      [  237.005966]
                     -> #1 (cpuhp_state_mutex){+.+.}:
      [  237.012364]        __lock_acquire+0x1100/0x11a0
      [  237.017408]        lock_acquire+0xdf/0x1d0
      [  237.021969]        __mutex_lock+0x80/0x8f0
      [  237.026527]        mutex_lock_nested+0x1b/0x20
      [  237.031475]        __cpuhp_setup_state_cpuslocked+0x54/0x2f0
      [  237.037777]        __cpuhp_setup_state+0xa7/0x120
      [  237.043013]        page_alloc_init+0x28/0x30
      [  237.047769]        start_kernel+0x148/0x41a
      [  237.052425]        x86_64_start_reservations+0x2a/0x2c
      [  237.058145]        x86_64_start_kernel+0x72/0x75
      [  237.063284]        verify_cpu+0x0/0xfb
      [  237.067456]
                     -> #0 (cpu_hotplug_lock.rw_sem){++++}:
      [  237.074436]        check_prev_add+0x401/0x800
      [  237.079286]        __lock_acquire+0x1100/0x11a0
      [  237.084330]        lock_acquire+0xdf/0x1d0
      [  237.088890]        cpus_read_lock+0x42/0x90
      [  237.093548]        static_key_enable+0x12/0x30
      [  237.098496]        rdt_mount+0x406/0x440
      [  237.102862]        mount_fs+0x38/0x150
      [  237.107035]        vfs_kern_mount+0x67/0x150
      [  237.111787]        do_mount+0x1df/0xd50
      [  237.116058]        SyS_mount+0x95/0xe0
      [  237.120233]        entry_SYSCALL_64_fastpath+0x18/0xad
      [  237.125952]
                     other info that might help us debug this:
      
      [  237.134867] Chain exists of:
                       cpu_hotplug_lock.rw_sem --> rdtgroup_mutex --> &type->s_umount_key#37/1
      
      [  237.148425]  Possible unsafe locking scenario:
      
      [  237.155015]        CPU0                    CPU1
      [  237.160057]        ----                    ----
      [  237.165100]   lock(&type->s_umount_key#37/1);
      [  237.169952]                                lock(rdtgroup_mutex);
      [  237.176641]
      lock(&type->s_umount_key#37/1);
      [  237.184287]   lock(cpu_hotplug_lock.rw_sem);
      [  237.189041]
                      *** DEADLOCK ***
      
      When the resctrl filesystem is mounted the locks must be acquired in the
      same order as was done when the cpus came online:
      
           cpu_hotplug_lock before rdtgroup_mutex.
      
      This also requires to switch the static_branch_enable() calls to the
      _cpulocked variant because now cpu hotplug lock is held already.
      
      [ tglx: Switched to cpus_read_[un]lock ]
      Reported-by: NSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Signed-off-by: NReinette Chatre <reinette.chatre@intel.com>
      Tested-by: NSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Acked-by: NVikas Shivappa <vikas.shivappa@linux.intel.com>
      Cc: fenghua.yu@intel.com
      Cc: tony.luck@intel.com
      Link: https://lkml.kernel.org/r/9c41b91bc2f47d9e95b62b213ecdb45623c47a9f.1508490116.git.reinette.chatre@intel.comSigned-off-by: NThomas Gleixner <tglx@linutronix.de>
      87943db7
    • R
      x86/intel_rdt: Fix potential deadlock during resctrl unmount · 36b6f9fc
      Reinette Chatre 提交于
      Lockdep warns about a potential deadlock:
      
      [   66.782842] ======================================================
      [   66.782888] WARNING: possible circular locking dependency detected
      [   66.782937] 4.14.0-rc2-test-test+ #48 Not tainted
      [   66.782983] ------------------------------------------------------
      [   66.783052] umount/336 is trying to acquire lock:
      [   66.783117]  (cpu_hotplug_lock.rw_sem){++++}, at: [<ffffffff81032395>] rdt_kill_sb+0x215/0x390
      [   66.783193]
                     but task is already holding lock:
      [   66.783244]  (rdtgroup_mutex){+.+.}, at: [<ffffffff810321b6>] rdt_kill_sb+0x36/0x390
      [   66.783305]
                     which lock already depends on the new lock.
      
      [   66.783364]
                     the existing dependency chain (in reverse order) is:
      [   66.783419]
                     -> #3 (rdtgroup_mutex){+.+.}:
      [   66.783467]        __lock_acquire+0x1293/0x13f0
      [   66.783509]        lock_acquire+0xaf/0x220
      [   66.783543]        __mutex_lock+0x71/0x9b0
      [   66.783575]        mutex_lock_nested+0x1b/0x20
      [   66.783610]        intel_rdt_online_cpu+0x3b/0x430
      [   66.783649]        cpuhp_invoke_callback+0xab/0x8e0
      [   66.783687]        cpuhp_thread_fun+0x7a/0x150
      [   66.783722]        smpboot_thread_fn+0x1cc/0x270
      [   66.783764]        kthread+0x16e/0x190
      [   66.783794]        ret_from_fork+0x27/0x40
      [   66.783825]
                     -> #2 (cpuhp_state){+.+.}:
      [   66.783870]        __lock_acquire+0x1293/0x13f0
      [   66.783906]        lock_acquire+0xaf/0x220
      [   66.783938]        cpuhp_issue_call+0x102/0x170
      [   66.783974]        __cpuhp_setup_state_cpuslocked+0x154/0x2a0
      [   66.784023]        __cpuhp_setup_state+0xc7/0x170
      [   66.784061]        page_writeback_init+0x43/0x67
      [   66.784097]        pagecache_init+0x43/0x4a
      [   66.784131]        start_kernel+0x3ad/0x3f7
      [   66.784165]        x86_64_start_reservations+0x2a/0x2c
      [   66.784204]        x86_64_start_kernel+0x72/0x75
      [   66.784241]        verify_cpu+0x0/0xfb
      [   66.784270]
                     -> #1 (cpuhp_state_mutex){+.+.}:
      [   66.784319]        __lock_acquire+0x1293/0x13f0
      [   66.784355]        lock_acquire+0xaf/0x220
      [   66.784387]        __mutex_lock+0x71/0x9b0
      [   66.784419]        mutex_lock_nested+0x1b/0x20
      [   66.784454]        __cpuhp_setup_state_cpuslocked+0x52/0x2a0
      [   66.784497]        __cpuhp_setup_state+0xc7/0x170
      [   66.784535]        page_alloc_init+0x28/0x30
      [   66.784569]        start_kernel+0x148/0x3f7
      [   66.784602]        x86_64_start_reservations+0x2a/0x2c
      [   66.784642]        x86_64_start_kernel+0x72/0x75
      [   66.784678]        verify_cpu+0x0/0xfb
      [   66.784707]
                     -> #0 (cpu_hotplug_lock.rw_sem){++++}:
      [   66.784759]        check_prev_add+0x32f/0x6e0
      [   66.784794]        __lock_acquire+0x1293/0x13f0
      [   66.784830]        lock_acquire+0xaf/0x220
      [   66.784863]        cpus_read_lock+0x3d/0xb0
      [   66.784896]        rdt_kill_sb+0x215/0x390
      [   66.784930]        deactivate_locked_super+0x3e/0x70
      [   66.784968]        deactivate_super+0x40/0x60
      [   66.785003]        cleanup_mnt+0x3f/0x80
      [   66.785034]        __cleanup_mnt+0x12/0x20
      [   66.785070]        task_work_run+0x8b/0xc0
      [   66.785103]        exit_to_usermode_loop+0x94/0xa0
      [   66.786804]        syscall_return_slowpath+0xe8/0x150
      [   66.788502]        entry_SYSCALL_64_fastpath+0xab/0xad
      [   66.790194]
                     other info that might help us debug this:
      
      [   66.795139] Chain exists of:
                       cpu_hotplug_lock.rw_sem --> cpuhp_state --> rdtgroup_mutex
      
      [   66.800035]  Possible unsafe locking scenario:
      
      [   66.803267]        CPU0                    CPU1
      [   66.804867]        ----                    ----
      [   66.806443]   lock(rdtgroup_mutex);
      [   66.808002]                                lock(cpuhp_state);
      [   66.809565]                                lock(rdtgroup_mutex);
      [   66.811110]   lock(cpu_hotplug_lock.rw_sem);
      [   66.812608]
                      *** DEADLOCK ***
      
      [   66.816983] 2 locks held by umount/336:
      [   66.818418]  #0:  (&type->s_umount_key#35){+.+.}, at: [<ffffffff81229738>] deactivate_super+0x38/0x60
      [   66.819922]  #1:  (rdtgroup_mutex){+.+.}, at: [<ffffffff810321b6>] rdt_kill_sb+0x36/0x390
      
      When the resctrl filesystem is unmounted the locks should be obtain in the
      locks in the same order as was done when the cpus came online:
      
            cpu_hotplug_lock before rdtgroup_mutex.
      
      This also requires to switch the static_branch_disable() calls to the
      _cpulocked variant because now cpu hotplug lock is held already.
      
      [ tglx: Switched to cpus_read_[un]lock ]
      Signed-off-by: NReinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Tested-by: NSai Praneeth Prakhya <sai.praneeth.prakhya@intel.com>
      Acked-by: NVikas Shivappa <vikas.shivappa@linux.intel.com>
      Acked-by: NFenghua Yu <fenghua.yu@intel.com>
      Acked-by: NTony Luck <tony.luck@intel.com>
      Link: https://lkml.kernel.org/r/cc292e76be073f7260604651711c47b09fd0dc81.1508490116.git.reinette.chatre@intel.com
      36b6f9fc
    • R
      x86/intel_rdt: Initialize bitmask of shareable resource if CDP enabled · 95953034
      Reinette Chatre 提交于
      The platform informs via CPUID.(EAX=0x10, ECX=res#):EBX[31:0] (valid res#
      are only 1 for L3 and 2 for L2) which unit of the allocation may be used by
      other entities in the platform. This information is valid whether CDP (Code
      and Data Prioritization) is enabled or not.
      
      Ensure that the bitmask of shareable resource is initialized when CDP is
      enabled.
      
      Fixes: 0dd2d749 ("x86/intel_rdt: Show bitmask of shareable resource with other executing units"
      Signed-off-by: NReinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: NThomas Gleixner <tglx@linutronix.de>
      Acked-by: NFenghua Yu <fenghua.yu@intel.com>
      Acked-by: NVikas Shivappa <vikas.shivappa@linux.intel.com>
      Acked-by: NTony Luck <tony.luck@intel.com>
      Link: https://lkml.kernel.org/r/815747bddc820ca221a8924edaf4d1a7324547e4.1508490116.git.reinette.chatre@intel.com
      95953034
  13. 19 10月, 2017 1 次提交
  14. 18 10月, 2017 1 次提交
  15. 17 10月, 2017 2 次提交
  16. 16 10月, 2017 1 次提交
  17. 14 10月, 2017 1 次提交
  18. 05 10月, 2017 4 次提交
  19. 04 10月, 2017 1 次提交
    • J
      x86/boot: Spell out "boot CPU" for BP · a1652bb8
      Jean Delvare 提交于
      It's not obvious to everybody that BP stands for boot processor. At
      least it was not for me. And BP is also a CPU register on x86, so it
      is ambiguous. Spell out "boot CPU" everywhere instead.
      Signed-off-by: NJean Delvare <jdelvare@suse.de>
      Cc: Alok Kataria <akataria@vmware.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      a1652bb8
  20. 27 9月, 2017 5 次提交
  21. 18 9月, 2017 1 次提交