1. 01 6月, 2015 1 次提交
    • S
      drivers/base: cacheinfo: handle absence of caches · 3370e13a
      Sudeep Holla 提交于
      On some simulators like GEM5, caches may not be simulated. In those
      cases, the cache levels and leaves will be zero and will result in
      following exception:
      
      Unable to handle kernel NULL pointer dereference at virtual address 0040
      pgd = ffffffc0008fa000
      [00000040] *pgd=00000009f6807003, *pud=00000009f6807003,
      	   *pmd=00000009f6808003, *pte=006000002c010707
      Internal error: Oops: 96000005 [#1] PREEMPT SMP
      Modules linked in:
      CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.1.0-rc5 #198
      task: ffffffc9768a0000 ti: ffffffc9768a8000 task.ti: ffffffc9768a8000
      PC is at detect_cache_attributes+0x98/0x2c8
      LR is at detect_cache_attributes+0x88/0x2c8
      
      kcalloc(0) returns a special value ZERO_SIZE_PTR which is non-NULL value
      but results in fault only on any attempt to dereferencing it. So
      checking for the non-NULL pointer will not suffice.
      
      This patch checks for non-zero cache leaf nodes and returns error if
      there are no cache leaves in detect_cache_attributes.
      
      Cc: <stable@vger.kernel.org> # 3.19.x
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Reported-by: NWilliam Wang <william.wang@arm.com>
      Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      3370e13a
  2. 25 3月, 2015 1 次提交
  3. 25 11月, 2014 1 次提交
  4. 08 11月, 2014 1 次提交
    • S
      drivers: base: support cpu cache information interface to userspace via sysfs · 246246cb
      Sudeep Holla 提交于
      This patch adds initial support for providing processor cache information
      to userspace through sysfs interface. This is based on already existing
      implementations(x86, ia64, s390 and powerpc) and hence the interface is
      intended to be fully compatible.
      
      The main purpose of this generic support is to avoid further code
      duplication to support new architectures and also to unify all the existing
      different implementations.
      
      This implementation maintains the hierarchy of cache objects which reflects
      the system's cache topology. Cache devices are instantiated as needed as
      CPUs come online. The cache information is replicated per-cpu even if they are
      shared. A per-cpu array of cache information maintained is used mainly for
      sysfs-related book keeping.
      
      It also implements the shared_cpu_map attribute, which is essential for
      enabling both kernel and user-space to discover the system's overall cache
      topology.
      
      This patch also add the missing ABI documentation for the cacheinfo sysfs
      interface already, which is well defined and widely used.
      Signed-off-by: NSudeep Holla <sudeep.holla@arm.com>
      Reviewed-by: NStephen Boyd <sboyd@codeaurora.org>
      Tested-by: NStephen Boyd <sboyd@codeaurora.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: linux-api@vger.kernel.org
      Cc: linux390@de.ibm.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-ia64@vger.kernel.org
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: linux-s390@vger.kernel.org
      Cc: x86@kernel.org
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      246246cb