02 Oct, 2020

4 commits

  • Do not indirect the bitmap printing of these shared_cpu show functions by
    using cpumap_print_to_pagebuf/bitmap_print_to_pagebuf.

    Use the more typical style with the vsnprintf %*pb and %*pbl extensions
    directly so there is no possible mixup about the use of offset_in_page(buf)
    by bitmap_print_to_pagebuf.

    Signed-off-by: Joe Perches
    Link: https://lore.kernel.org/r/80457b467ab6cde13a173cfd8a4f49cd8467a7fd.1600285923.git.joe@perches.com
    Signed-off-by: Greg Kroah-Hartman

    Joe Perches
     
  • Change additional instances that could use sysfs_emit and sysfs_emit_at
    that the coccinelle script could not convert.

    o macros creating show functions with ## concatenation
    o unbound sprintf uses with buf+len for start of output to sysfs_emit_at
    o returns with ?: tests and sprintf to sysfs_emit
    o sysfs output with struct class * not struct device * arguments

    Miscellanea:

    o remove unnecessary initializations around these changes
    o consistently use int len for return length of show functions
    o use octal permissions and not S_
    o rename a few show function names so DEVICE_ATTR_ can be used
    o use DEVICE_ATTR_ADMIN_RO where appropriate
    o consistently use const char *output for strings
    o checkpatch/style neatening

    Signed-off-by: Joe Perches
    Link: https://lore.kernel.org/r/8bc24444fe2049a9b2de6127389b57edfdfe324d.1600285923.git.joe@perches.com
    Signed-off-by: Greg Kroah-Hartman

    Joe Perches
     
  • strcat is no longer necessary for sysfs_emit and sysfs_emit_at uses.

    Convert the strcat uses to sysfs_emit calls and neaten other block
    uses of direct returns to use an intermediate const char *.

    Signed-off-by: Joe Perches
    Link: https://lore.kernel.org/r/5d606519698ce4c8f1203a2b35797d8254c6050a.1600285923.git.joe@perches.com
    Signed-off-by: Greg Kroah-Hartman

    Joe Perches
     
  • Convert the various sprintf fmaily calls in sysfs device show functions
    to sysfs_emit and sysfs_emit_at for PAGE_SIZE buffer safety.

    Done with:

    $ spatch -sp-file sysfs_emit_dev.cocci --in-place --max-width=80 .

    And cocci script:

    $ cat sysfs_emit_dev.cocci
    @@
    identifier d_show;
    identifier dev, attr, buf;
    @@

    ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
    {

    }

    @@
    identifier d_show;
    identifier dev, attr, buf;
    @@

    ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
    {

    }

    @@
    identifier d_show;
    identifier dev, attr, buf;
    @@

    ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
    {

    }

    @@
    identifier d_show;
    identifier dev, attr, buf;
    expression chr;
    @@

    ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
    {

    }

    @@
    identifier d_show;
    identifier dev, attr, buf;
    identifier len;
    @@

    ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
    {

    return len;
    }

    @@
    identifier d_show;
    identifier dev, attr, buf;
    identifier len;
    @@

    ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
    {

    return len;
    }

    @@
    identifier d_show;
    identifier dev, attr, buf;
    identifier len;
    @@

    ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
    {

    return len;
    }

    @@
    identifier d_show;
    identifier dev, attr, buf;
    identifier len;
    @@

    ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
    {

    return len;
    }

    @@
    identifier d_show;
    identifier dev, attr, buf;
    expression chr;
    @@

    ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
    {
    ...
    - strcpy(buf, chr);
    - return strlen(buf);
    + return sysfs_emit(buf, chr);
    }

    Signed-off-by: Joe Perches
    Link: https://lore.kernel.org/r/3d033c33056d88bbe34d4ddb62afd05ee166ab9a.1600285923.git.joe@perches.com
    Signed-off-by: Greg Kroah-Hartman

    Joe Perches
     

13 Jul, 2019

1 commit

  • Pull driver core and debugfs updates from Greg KH:
    "Here is the "big" driver core and debugfs changes for 5.3-rc1

    It's a lot of different patches, all across the tree due to some api
    changes and lots of debugfs cleanups.

    Other than the debugfs cleanups, in this set of changes we have:

    - bus iteration function cleanups

    - scripts/get_abi.pl tool to display and parse Documentation/ABI
    entries in a simple way

    - cleanups to Documenatation/ABI/ entries to make them parse easier
    due to typos and other minor things

    - default_attrs use for some ktype users

    - driver model documentation file conversions to .rst

    - compressed firmware file loading

    - deferred probe fixes

    All of these have been in linux-next for a while, with a bunch of
    merge issues that Stephen has been patient with me for"

    * tag 'driver-core-5.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (102 commits)
    debugfs: make error message a bit more verbose
    orangefs: fix build warning from debugfs cleanup patch
    ubifs: fix build warning after debugfs cleanup patch
    driver: core: Allow subsystems to continue deferring probe
    drivers: base: cacheinfo: Ensure cpu hotplug work is done before Intel RDT
    arch_topology: Remove error messages on out-of-memory conditions
    lib: notifier-error-inject: no need to check return value of debugfs_create functions
    swiotlb: no need to check return value of debugfs_create functions
    ceph: no need to check return value of debugfs_create functions
    sunrpc: no need to check return value of debugfs_create functions
    ubifs: no need to check return value of debugfs_create functions
    orangefs: no need to check return value of debugfs_create functions
    nfsd: no need to check return value of debugfs_create functions
    lib: 842: no need to check return value of debugfs_create functions
    debugfs: provide pr_fmt() macro
    debugfs: log errors when something goes wrong
    drivers: s390/cio: Fix compilation warning about const qualifiers
    drivers: Add generic helper to match by of_node
    driver_find_device: Unify the match function with class_find_device()
    bus_find_device: Unify the match callback with class_find_device
    ...

    Linus Torvalds
     

04 Jul, 2019

1 commit

  • The cacheinfo structures are alloced/freed by cpu online/offline
    callbacks. Originally these were only used by sysfs to expose the
    cache topology to user space. Without any in-kernel dependencies
    CPUHP_AP_ONLINE_DYN was an appropriate choice.

    resctrl has started using these structures to identify CPUs that
    share a cache. It updates its 'domain' structures from cpu
    online/offline callbacks. These depend on the cacheinfo structures
    (resctrl_online_cpu()->domain_add_cpu()->get_cache_id()->
    get_cpu_cacheinfo()).
    These also run as CPUHP_AP_ONLINE_DYN.

    Now that there is an in-kernel dependency, move the cacheinfo
    work earlier so we know its done before resctrl's CPUHP_AP_ONLINE_DYN
    work runs.

    Fixes: 2264d9c74dda1 ("x86/intel_rdt: Build structures for each resource based on cache topology")
    Cc:
    Cc: Fenghua Yu
    Cc: Reinette Chatre
    Signed-off-by: James Morse
    Link: https://lore.kernel.org/r/20190624173656.202407-1-james.morse@arm.com
    Signed-off-by: Greg Kroah-Hartman

    James Morse
     

04 Jun, 2019

1 commit

  • Add coherency_max_size variable to record the maximum cache line size
    for different cache levels. If it is available, we will synchronize
    it as cache line size, otherwise we will use CTR_EL0.CWG reporting
    in cache_line_size() for arm64.

    Cc: "Rafael J. Wysocki"
    Cc: Jeremy Linton
    Cc: Will Deacon
    Reviewed-by: Sudeep Holla
    Reviewed-by: Greg Kroah-Hartman
    Signed-off-by: Shaokun Zhang
    Signed-off-by: Catalin Marinas

    Shaokun Zhang
     

22 Jan, 2019

1 commit

  • Commit 448a5a552f336bd7b847b1951 ("drivers: base: cacheinfo: use OF
    property_read_u32 instead of get_property,read_number") makes cache
    size and number_of_sets be 0 if DT doesn't provide there values. I
    think this is unreasonable so make them keep the old values, which is
    the same as old kernels.

    Fixes: 448a5a552f33 ("drivers: base: cacheinfo: use OF property_read_u32 instead of get_property,read_number")
    Cc: stable@vger.kernel.org
    Signed-off-by: Huacai Chen
    Reviewed-by: Sudeep Holla
    Signed-off-by: Greg Kroah-Hartman

    Huacai Chen
     

05 Oct, 2018

1 commit

  • If a cache has an unknown type because neither the hardware nor the
    firmware told us, an entry in the sysfs tree will be made, but the type
    file will not be present. lscpu depends on the type file being present
    for every entry, and will error out without printing system information
    if lscpu cannot open the type file.

    Presenting information about a cache without indicating its type is not
    useful, therefore if we hit a cache with an unknown type, stop populating
    sysfs so that userspace has the maximum amount of useful information.

    This addresses the following lscpu error, which prevents any output.
    lscpu: cannot open /sys/devices/system/cpu/cpu0/cache/index3/type: No such
    file or directory

    Suggested-by: Sudeep Holla
    Signed-off-by: Jeffrey Hugo
    Reviewed-by: Jeremy Linton
    Reviewed-by: Sudeep Holla
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Rafael J. Wysocki

    Jeffrey Hugo
     

07 Jul, 2018

1 commit


18 May, 2018

4 commits

  • Call ACPI cache parsing routines from base cacheinfo code if ACPI
    is enabled. Also stub out cache_setup_acpi and acpi_find_last_cache_level
    so that individual architectures can enable ACPI topology parsing.

    Tested-by: Ard Biesheuvel
    Tested-by: Vijaya Kumar K
    Tested-by: Xiongfeng Wang
    Tested-by: Tomasz Nowicki
    Acked-by: Sudeep Holla
    Acked-by: Ard Biesheuvel
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Jeremy Linton
    Signed-off-by: Catalin Marinas

    Jeremy Linton
     
  • Rename and change the type of of_node to indicate
    it is a generic pointer which is generally only used
    for comparison purposes. In a later patch we will put
    an ACPI/PPTT token pointer in fw_token so that
    the code which builds the shared cpu masks can be reused.

    Tested-by: Ard Biesheuvel
    Tested-by: Vijaya Kumar K
    Tested-by: Xiongfeng Wang
    Tested-by: Tomasz Nowicki
    Acked-by: Sudeep Holla
    Acked-by: Ard Biesheuvel
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Jeremy Linton
    Signed-off-by: Catalin Marinas

    Jeremy Linton
     
  • The original intent in cacheinfo was that an architecture
    specific populate_cache_leaves() would probe the hardware
    and then cache_shared_cpu_map_setup() and
    cache_override_properties() would provide firmware help to
    extend/expand upon what was probed. Arm64 was really
    the only architecture that was working this way, and
    with the removal of most of the hardware probing logic it
    became clear that it was possible to simplify the logic a bit.

    This patch combines the walk of the DT nodes with the
    code updating the cache size/line_size and nr_sets.
    cache_override_properties() (which was DT specific) is
    then removed. The result is that cacheinfo.of_node is
    no longer used as a temporary place to hold DT references
    for future calls that update cache properties. That change
    helps to clarify its one remaining use (matching
    cacheinfo nodes that represent shared caches) which
    will be used by the ACPI/PPTT code in the following patches.

    Tested-by: Ard Biesheuvel
    Tested-by: Vijaya Kumar K
    Tested-by: Xiongfeng Wang
    Tested-by: Tomasz Nowicki
    Acked-by: Sudeep Holla
    Acked-by: Ard Biesheuvel
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Jeremy Linton
    Signed-off-by: Catalin Marinas

    Jeremy Linton
     
  • In preparation for the next patch, and to aid in
    review of that patch, lets move cache_setup_of_node
    further down in the module without any changes.

    Tested-by: Ard Biesheuvel
    Tested-by: Vijaya Kumar K
    Tested-by: Xiongfeng Wang
    Tested-by: Tomasz Nowicki
    Reviewed-by: Sudeep Holla
    Acked-by: Ard Biesheuvel
    Acked-by: Greg Kroah-Hartman
    Signed-off-by: Jeremy Linton
    Signed-off-by: Catalin Marinas

    Jeremy Linton
     

02 Jan, 2018

1 commit


16 Dec, 2017

1 commit

  • Commit dfea747d2aba ("drivers: base: cacheinfo: support DT overrides for
    cache properties") doesn't initialise the cache type if it's present
    only in DT and the architecture is not aware of it. They are unified
    system level cache which are generally transparent.

    This patch check if the cache type is set to NOCACHE but the DT node
    indicates that it's unified cache and sets the cache type accordingly.

    Fixes: dfea747d2aba ("drivers: base: cacheinfo: support DT overrides for cache properties")
    Reported-and-tested-by: Tan Xiaojun
    Cc: Greg Kroah-Hartman
    Signed-off-by: Sudeep Holla
    Cc: stable
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     

08 Dec, 2017

2 commits

  • Now that the SPDX tag is in all driver core files, that identifies the
    license in a specific and legally-defined manner. So the extra GPL text
    wording can be removed as it is no longer needed at all.

    This is done on a quest to remove the 700+ different ways that files in
    the kernel describe the GPL license text. And there's unneeded stuff
    like the address (sometimes incorrect) for the FSF which is never
    needed.

    No copyright headers or other non-license-description text was removed.

    Cc: Johannes Berg
    Cc: "Luis R. Rodriguez"
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     
  • It's good to have SPDX identifiers in all files to make it easier to
    audit the kernel tree for correct licenses.

    Update the driver core files files with the correct SPDX license
    identifier based on the license text in the file itself. The SPDX
    identifier is a legally binding shorthand, which can be used instead of
    the full boiler plate text.

    This work is based on a script and data from Thomas Gleixner, Philippe
    Ombredanne, and Kate Stewart.

    Cc: Johannes Berg
    Cc: "Luis R. Rodriguez"
    Cc: William Breathitt Gray
    Cc: Thomas Gleixner
    Cc: Kate Stewart
    Cc: Philippe Ombredanne
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

23 Dec, 2016

1 commit

  • Pull x86 cache allocation interface from Thomas Gleixner:
    "This provides support for Intel's Cache Allocation Technology, a cache
    partitioning mechanism.

    The interface is odd, but the hardware interface of that CAT stuff is
    odd as well.

    We tried hard to come up with an abstraction, but that only allows
    rather simple partitioning, but no way of sharing and dealing with the
    per package nature of this mechanism.

    In the end we decided to expose the allocation bitmaps directly so all
    combinations of the hardware can be utilized.

    There are two ways of associating a cache partition:

    - Task

    A task can be added to a resource group. It uses the cache
    partition associated to the group.

    - CPU

    All tasks which are not member of a resource group use the group to
    which the CPU they are running on is associated with.

    That allows for simple CPU based partitioning schemes.

    The main expected user sare:

    - Virtualization so a VM can only trash only the associated part of
    the cash w/o disturbing others

    - Real-Time systems to seperate RT and general workloads.

    - Latency sensitive enterprise workloads

    - In theory this also can be used to protect against cache side
    channel attacks"

    [ Intel RDT is "Resource Director Technology". The interface really is
    rather odd and very specific, which delayed this pull request while I
    was thinking about it. The pull request itself came in early during
    the merge window, I just delayed it until things had calmed down and I
    had more time.

    But people tell me they'll use this, and the good news is that it is
    _so_ specific that it's rather independent of anything else, and no
    user is going to depend on the interface since it's pretty rare. So if
    push comes to shove, we can just remove the interface and nothing will
    break ]

    * 'x86-cache-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (31 commits)
    x86/intel_rdt: Implement show_options() for resctrlfs
    x86/intel_rdt: Call intel_rdt_sched_in() with preemption disabled
    x86/intel_rdt: Update task closid immediately on CPU in rmdir and unmount
    x86/intel_rdt: Fix setting of closid when adding CPUs to a group
    x86/intel_rdt: Update percpu closid immeditately on CPUs affected by changee
    x86/intel_rdt: Reset per cpu closids on unmount
    x86/intel_rdt: Select KERNFS when enabling INTEL_RDT_A
    x86/intel_rdt: Prevent deadlock against hotplug lock
    x86/intel_rdt: Protect info directory from removal
    x86/intel_rdt: Add info files to Documentation
    x86/intel_rdt: Export the minimum number of set mask bits in sysfs
    x86/intel_rdt: Propagate error in rdt_mount() properly
    x86/intel_rdt: Add a missing #include
    MAINTAINERS: Add maintainer for Intel RDT resource allocation
    x86/intel_rdt: Add scheduler hook
    x86/intel_rdt: Add schemata file
    x86/intel_rdt: Add tasks files
    x86/intel_rdt: Add cpus file
    x86/intel_rdt: Add mkdir to resctrl file system
    x86/intel_rdt: Add "info" files to resctrl file system
    ...

    Linus Torvalds
     

14 Dec, 2016

1 commit

  • Pull driver core updates from Greg KH:
    "Here's the new driver core patches for 4.10-rc1.

    Big thing here is the nice addition of "functional dependencies" to
    the driver core. The idea has been talked about for a very long time,
    great job to Rafael for stepping up and implementing it. It's been
    tested for longer than the 4.9-rc1 date, we held off on merging it
    earlier in order to feel more comfortable about it.

    Other than that, it's just a handful of small other patches, some good
    cleanups to the mess that is the firmware class code, and we have a
    test driver for the deferred probe logic.

    All of these have been in linux-next for a while with no reported
    issues"

    * tag 'driver-core-4.10-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (30 commits)
    firmware: Correct handling of fw_state_wait() return value
    driver core: Silence device links sphinx warning
    firmware: remove warning at documentation generation time
    drivers: base: dma-mapping: Fix typo in dmam_alloc_non_coherent comments
    driver core: test_async: fix up typo found by 0-day
    firmware: move fw_state_is_done() into UHM section
    firmware: do not use fw_lock for fw_state protection
    firmware: drop bit ops in favor of simple state machine
    firmware: refactor loading status
    firmware: fix usermode helper fallback loading
    driver core: firmware_class: convert to use class_groups
    driver core: devcoredump: convert to use class_groups
    driver core: class: add class_groups support
    kernfs: Declare two local data structures static
    driver-core: fix platform_no_drv_owner.cocci warnings
    drivers/base/memory.c: Remove unused 'first_page' variable
    driver core: add CLASS_ATTR_WO()
    drivers: base: cacheinfo: support DT overrides for cache properties
    drivers: base: cacheinfo: add pr_fmt logging
    drivers: base: cacheinfo: fix boot error message when acpi is enabled
    ...

    Linus Torvalds
     

11 Nov, 2016

4 commits

  • Few architectures like x86, ia64 and s390 derive the cache topology and
    all the properties using a specific architected mechanism while some
    other architectures like powerpc all those information id derived from
    the device tree.

    On ARM, both the mechanism is used. While all the cache properties can
    be derived in a architected way, it needs to rely on device tree to get
    the cache topology information.

    However there are few platforms where this architected mechanism is
    broken and the device tree properties can be used to override these
    incorrect values.

    This patch adds support for overriding the cache properties values to
    the values specified in the device tree.

    Cc: Alex Van Brunt
    Cc: Greg Kroah-Hartman
    Signed-off-by: Sudeep Holla
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     
  • This cleanup patch just adds pr_fmt style logging for cacheinfo.

    Cc: Greg Kroah-Hartman
    Signed-off-by: Sudeep Holla
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     
  • ARM64 enables both CONFIG_OF and CONFIG_ACPI and the firmware can pass
    both ACPI tables and the device tree. Based on the kernel parameter, one
    of the two will be chosen. If acpi is enabled, then device tree is not
    unflattened.

    Currently ARM64 platforms report:
    "
    Failed to find cpu0 device node
    Unable to detect cache hierarchy from DT for CPU 0
    "
    which is incorrect when booting with ACPI. Also latest ACPI v6.1 has no
    support for cache properties/hierarchy.

    This patch adds check for unflattened device tree and also returns as
    "not supported" if ACPI is runtime enabled.

    It also removes the reference to DT from the error message as the cache
    hierarchy can be detected from the firmware(OF/DT/ACPI)

    Cc: Greg Kroah-Hartman
    Signed-off-by: Sudeep Holla
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     
  • With CONFIG_OF enabled on x86, we get the following error on boot:
    "
    Failed to find cpu0 device node
    Unable to detect cache hierarchy from DT for CPU 0
    "
    and the cacheinfo fails to get populated in the corresponding sysfs
    entries. This is because cache_setup_of_node looks for of_node for
    setting up the shared cpu_map without checking that it's already
    populated in the architecture specific callback.

    In order to indicate that the shared cpu_map is already populated, this
    patch introduces a boolean `cpu_map_populated` in struct cpu_cacheinfo
    that can be used by the generic code to skip cache_shared_cpu_map_setup.

    This patch also sets that boolean for x86.

    Cc: Greg Kroah-Hartman
    Signed-off-by: Sudeep Holla
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     

10 Nov, 2016

1 commit


27 Oct, 2016

1 commit

  • Cache management software needs an id for each instance of a cache of
    a particular type.

    The current cacheinfo structure does not provide any information about
    the underlying hardware so there is no way to expose it.

    Hardware with cache management features provides means (cpuid, enumeration
    etc.) to retrieve the hardware id of a particular cache instance. Cache
    instances which share hardware have the same hardware id.

    Add an 'id' field to struct cacheinfo to store this information. Expose
    this information under the /sys/devices/system/cpu/cpu*/cache/index*/
    directory as well.

    Signed-off-by: Fenghua Yu
    Cc: "Ravi V Shankar"
    Cc: "Tony Luck"
    Cc: "David Carrillo-Cisneros"
    Cc: "Sai Prakhya"
    Cc: "Peter Zijlstra"
    Cc: "Stephane Eranian"
    Cc: "Dave Hansen"
    Cc: "Shaohua Li"
    Cc: "Nilay Vaish"
    Cc: "Vikas Shivappa"
    Cc: "Ingo Molnar"
    Cc: "Borislav Petkov"
    Cc: "H. Peter Anvin"
    Link: http://lkml.kernel.org/r/1477142405-32078-3-git-send-email-fenghua.yu@intel.com
    Signed-off-by: Thomas Gleixner

    Fenghua Yu
     

17 Sep, 2015

1 commit

  • Philip Müller reported a hang when booting 32-bit 4.1 kernel on an AMD
    box. A fragment of the splat was enough to pinpoint the issue:

    task: f58e0000 ti: f58e8000 task.ti: f58e800
    EIP: 0060:[] EFLAGS: 00010206 CPU: 0
    EIP is at free_cache_attributes+0x83/0xd0
    EAX: 00000001 EBX: f589d46c ECX: 00000090 EDX: 360c2000
    ESI: 00000000 EDI: c1724a80 EBP: f58e9ec0 ESP: f58e9ea0
    DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
    CR0: 8005003b CR2: 000000ac CR3: 01731000 CR4: 000006d0

    cache_shared_cpu_map_setup() did check sibling CPUs cacheinfo descriptor
    while the respective teardown path cache_shared_cpu_map_remove() didn't.
    Fix that.

    >From tglx's version: to be on the safe side, move the cacheinfo
    descriptor check to free_cache_attributes(), thus cleaning up the
    hotplug path a little and making this even more robust.

    Reported-and-tested-by: Philip Müller
    Reviewed-by: Thomas Gleixner
    Acked-by: Sudeep Holla
    Cc: # 4.1
    Cc: Andre Przywara
    Cc: Guenter Roeck
    Cc: "H. Peter Anvin"
    Cc: Ingo Molnar
    Cc: linux-kernel@vger.kernel.org
    Cc: manjaro-dev@manjaro.org
    Cc: Philip Müller
    Link: https://lkml.kernel.org/r/55B47BB8.6080202@manjaro.org
    Signed-off-by: Borislav Petkov
    Signed-off-by: Greg Kroah-Hartman

    Borislav Petkov
     

09 Jun, 2015

1 commit


01 Jun, 2015

1 commit

  • 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: # 3.19.x
    Cc: Will Deacon
    Cc: Greg Kroah-Hartman
    Reported-by: William Wang
    Signed-off-by: Sudeep Holla
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     

25 May, 2015

1 commit


25 Mar, 2015

1 commit

  • On architectures that depend on DT for obtaining cache hierarcy, we need
    to validate the device node for all the cache indices, failing to do so
    might result in wrong information being exposed to the userspace.

    This is quite possible on initial/incomplete versions of the device
    trees. In such cases, it's better to bail out if all the required device
    nodes are not present.

    This patch adds checks for the validation of device node for all the
    caches and doesn't initialise the cacheinfo if there's any error.

    Reported-by: Mark Rutland
    Acked-by: Mark Rutland
    Signed-off-by: Sudeep Holla
    Cc: stable # 4.0
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     

25 Nov, 2014

1 commit

  • On systems that don't support cacheinfo, this error message can be
    considered noisy and irrelevant. The error messages can be added to
    the functions that architectures implement overiding the weak default
    definition if really required.

    This patch removes the concerned error message in the generic code.

    Signed-off-by: Sudeep Holla
    Reported-by: Fabio Estevam
    Signed-off-by: Greg Kroah-Hartman

    Sudeep Holla
     

08 Nov, 2014

1 commit

  • 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: Sudeep Holla
    Reviewed-by: Stephen Boyd
    Tested-by: Stephen Boyd
    Cc: Greg Kroah-Hartman
    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: Greg Kroah-Hartman

    Sudeep Holla