1. 03 Aug, 2018 1 commit
    • Thomas Gleixner's avatar
      x86/intel_rdt: Disable PMU access · 4a7a54a5
      Thomas Gleixner authored
      Peter is objecting to the direct PMU access in RDT. Right now the PMU usage
      is broken anyway as it is not coordinated with perf.
      
      Until this discussion settled, disable the PMU mechanics by simply
      rejecting the type '2' measurement in the resctrl file.
      Reported-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: Reinette Chatre <reinette.chatre@intel.com>
      Cc: Dave Hansen <dave.hansen@intel.com>
      Cc: fenghua.yu@intel.com
      Cc: tony.luck@intel.com
      Cc: vikas.shivappa@linux.intel.com
      CC: gavin.hindman@intel.com
      Cc: jithu.joseph@intel.com
      Cc: hpa@zytor.com
      4a7a54a5
  2. 12 Jul, 2018 1 commit
    • Reinette Chatre's avatar
      x86/intel_rdt: Fix possible circular lock dependency · 2989360d
      Reinette Chatre authored
      Lockdep is reporting a possible circular locking dependency:
      
       ======================================================
       WARNING: possible circular locking dependency detected
       4.18.0-rc1-test-test+ #4 Not tainted
       ------------------------------------------------------
       user_example/766 is trying to acquire lock:
       0000000073479a0f (rdtgroup_mutex){+.+.}, at: pseudo_lock_dev_mmap
      
       but task is already holding lock:
       000000001ef7a35b (&mm->mmap_sem){++++}, at: vm_mmap_pgoff+0x9f/0x
      
       which lock already depends on the new lock.
      
       the existing dependency chain (in reverse order) is:
      
       -> #2 (&mm->mmap_sem){++++}:
              _copy_to_user+0x1e/0x70
              filldir+0x91/0x100
              dcache_readdir+0x54/0x160
              iterate_dir+0x142/0x190
              __x64_sys_getdents+0xb9/0x170
              do_syscall_64+0x86/0x200
              entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
       -> #1 (&sb->s_type->i_mutex_key#3){++++}:
              start_creating+0x60/0x100
              debugfs_create_dir+0xc/0xc0
              rdtgroup_pseudo_lock_create+0x217/0x4d0
              rdtgroup_schemata_write+0x313/0x3d0
              kernfs_fop_write+0xf0/0x1a0
              __vfs_write+0x36/0x190
              vfs_write+0xb7/0x190
              ksys_write+0x52/0xc0
              do_syscall_64+0x86/0x200
              entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
       -> #0 (rdtgroup_mutex){+.+.}:
              __mutex_lock+0x80/0x9b0
              pseudo_lock_dev_mmap+0x2f/0x170
              mmap_region+0x3d6/0x610
              do_mmap+0x387/0x580
              vm_mmap_pgoff+0xcf/0x110
              ksys_mmap_pgoff+0x170/0x1f0
              do_syscall_64+0x86/0x200
              entry_SYSCALL_64_after_hwframe+0x49/0xbe
      
       other info that might help us debug this:
      
       Chain exists of:
         rdtgroup_mutex --> &sb->s_type->i_mutex_key#3 --> &mm->mmap_sem
      
        Possible unsafe locking scenario:
      
              CPU0                    CPU1
              ----                    ----
         lock(&mm->mmap_sem);
                                      lock(&sb->s_type->i_mutex_key#3);
                                      lock(&mm->mmap_sem);
         lock(rdtgroup_mutex);
      
        *** DEADLOCK ***
      
       1 lock held by user_example/766:
        #0: 000000001ef7a35b (&mm->mmap_sem){++++}, at: vm_mmap_pgoff+0x9f/0x110
      
      rdtgroup_mutex is already being released temporarily during pseudo-lock
      region creation to prevent the potential deadlock between rdtgroup_mutex
      and mm->mmap_sem that is obtained during device_create(). Move the
      debugfs creation into this area to avoid the same circular dependency.
      Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: fenghua.yu@intel.com
      Cc: tony.luck@intel.com
      Cc: vikas.shivappa@linux.intel.com
      Cc: gavin.hindman@intel.com
      Cc: jithu.joseph@intel.com
      Cc: hpa@zytor.com
      Link: https://lkml.kernel.org/r/fffb57f9c6b8285904c9a60cc91ce21591af17fe.1531332480.git.reinette.chatre@intel.com
      2989360d
  3. 03 Jul, 2018 4 commits
    • Reinette Chatre's avatar
      x86/intel_rdt: Make CPU information accessible for pseudo-locked regions · 33dc3e41
      Reinette Chatre authored
      When a resource group enters pseudo-locksetup mode it reflects that the
      platform supports cache pseudo-locking and the resource group is unused,
      ready to be used for a pseudo-locked region. Until it is set up as a
      pseudo-locked region the resource group is "locked down" such that no new
      tasks or cpus can be assigned to it. This is accomplished in a user visible
      way by making the cpus, cpus_list, and tasks resctrl files inaccassible
      (user cannot read from or write to these files).
      
      When the resource group changes to pseudo-locked mode it represents a cache
      pseudo-locked region. While not appropriate to make any changes to the cpus
      assigned to this region it is useful to make it easy for the user to see
      which cpus are associated with the pseudo-locked region.
      
      Modify the permissions of the cpus/cpus_list file when the resource group
      changes to pseudo-locked mode to support reading (not writing).  The
      information presented to the user when reading the file are the cpus
      associated with the pseudo-locked region.
      Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: fenghua.yu@intel.com
      Cc: tony.luck@intel.com
      Cc: vikas.shivappa@linux.intel.com
      Cc: gavin.hindman@intel.com
      Cc: jithu.joseph@intel.com
      Cc: dave.hansen@intel.com
      Cc: hpa@zytor.com
      Link: https://lkml.kernel.org/r/12756b7963b6abc1bffe8fb560b87b75da827bd1.1530421961.git.reinette.chatre@intel.com
      33dc3e41
    • Reinette Chatre's avatar
      x86/intel_rdt: Support restoration of subset of permissions · 392487de
      Reinette Chatre authored
      As the mode of a resource group changes, the operations it can support may
      also change. One way in which the supported operations are managed is to
      modify the permissions of the files within the resource group's resctrl
      directory.
      
      At the moment only two possible permissions are supported: the default
      permissions or no permissions in support for when the operation is "locked
      down". It is possible where an operation on a resource group may have more
      possibilities. For example, if by default changes can be made to the
      resource group by writing to a resctrl file while the current settings can
      be obtained by reading from the file, then it may be possible that in
      another mode it is only possible to read the current settings, and not
      change them.
      
      Make it possible to modify some of the permissions of a resctrl file in
      support of a more flexible way to manage the operations on a resource
      group. In this preparation work the original behavior is maintained where
      all permissions are restored.
      Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: fenghua.yu@intel.com
      Cc: tony.luck@intel.com
      Cc: vikas.shivappa@linux.intel.com
      Cc: gavin.hindman@intel.com
      Cc: jithu.joseph@intel.com
      Cc: dave.hansen@intel.com
      Cc: hpa@zytor.com
      Link: https://lkml.kernel.org/r/8773aadfade7bcb2c48a45fa294a04d2c03bb0a1.1530421961.git.reinette.chatre@intel.com
      392487de
    • Reinette Chatre's avatar
      x86/intel_rdt: Fix cleanup of plr structure on error · 546d3c74
      Reinette Chatre authored
      When a resource group enters pseudo-locksetup mode a pseudo_lock_region is
      associated with it. When the user writes to the resource group's schemata
      file the CBM of the requested pseudo-locked region is entered into the
      pseudo_lock_region struct. If any part of pseudo-lock region creation fails
      the resource group will remain in pseudo-locksetup mode with the
      pseudo_lock_region associated with it.
      
      In case of failure during pseudo-lock region creation care needs to be
      taken to ensure that the pseudo_lock_region struct associated with the
      resource group is cleared from any pseudo-locking data - especially the
      CBM. This is because the existence of a pseudo_lock_region struct with a
      CBM is significant in other areas of the code, for example, the display of
      bit_usage and initialization of a new resource group.
      
      Fix the error path of pseudo-lock region creation to ensure that the
      pseudo_lock_region struct is cleared at each error exit.
      
      Fixes: 018961ae ("x86/intel_rdt: Pseudo-lock region creation/removal core")
      Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: fenghua.yu@intel.com
      Cc: tony.luck@intel.com
      Cc: vikas.shivappa@linux.intel.com
      Cc: gavin.hindman@intel.com
      Cc: jithu.joseph@intel.com
      Cc: dave.hansen@intel.com
      Cc: hpa@zytor.com
      Link: https://lkml.kernel.org/r/49b4782f6d204d122cee3499e642b2772a98d2b4.1530421026.git.reinette.chatre@intel.com
      546d3c74
    • Reinette Chatre's avatar
      x86/intel_rdt: Move pseudo_lock_region_clear() · ce730f1c
      Reinette Chatre authored
      The pseudo_lock_region_clear() function is moved to earlier in the file in
      preparation for its use in functions that currently appear before it. No
      functional change.
      Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: fenghua.yu@intel.com
      Cc: tony.luck@intel.com
      Cc: vikas.shivappa@linux.intel.com
      Cc: gavin.hindman@intel.com
      Cc: jithu.joseph@intel.com
      Cc: dave.hansen@intel.com
      Cc: hpa@zytor.com
      Link: https://lkml.kernel.org/r/ef098ec2a45501e23792289bff80ae3152141e2f.1530421026.git.reinette.chatre@intel.com
      ce730f1c
  4. 24 Jun, 2018 4 commits
  5. 23 Jun, 2018 30 commits