49 Commits
Author SHA1 Message Date
Mamatha Inamdar bbba19df30 powerpc/perf/vpa-dtl: Add documentation for VPA dispatch trace log PMU
JIRA: https://issues.redhat.com/browse/RHEL-53366

commit 4a774b39e68fac7d6c7c9cffeb6a4ea4b6dc8b41
Author: Athira Rajeev <atrajeev@linux.ibm.com>
Date:   Mon Sep 15 15:59:47 2025 +0530

    powerpc/perf/vpa-dtl: Add documentation for VPA dispatch trace log PMU

    Documentation for vpa-dtl (Virtual Processor Area - Dispatch Trace Log)
    PMU interface. And how it can be used to collect the distrace trace log
    entries in perf data, how to process/report as part of perf report/perf
    script.

    Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
    Tested-by: Tejas Manhas <tejas05@linux.ibm.com>
    Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20250915102947.26681-8-atrajeev@linux.ibm.com

Signed-off-by: Mamatha Inamdar <minamdar@redhat.com>
2026-07-07 01:06:10 -04:00
Jaroslav Kysela 0ba7651896 docs: fix 're-use' -> 'reuse' in documentation
JIRA: https://issues.redhat.com/browse/RHEL-168091

commit 78a00cac1e962aacfe67ffa0ce295e709e0e6c5b
Author: Rhys Tumelty <rhys@tumelty.co.uk>
Date: Wed Jan 28 22:02:31 2026 +0000

    docs: fix 're-use' -> 'reuse' in documentation

    Signed-off-by: Rhys Tumelty <rhys@tumelty.co.uk>
    Acked-by: Randy Dunlap <rdunlap@infradead.org>
    Signed-off-by: Jonathan Corbet <corbet@lwn.net>
    Message-ID: <20260128220233.179439-1-rhys@tumelty.co.uk>

Signed-off-by: Jaroslav Kysela <jkysela@redhat.com>
2026-04-27 14:26:00 +02:00
CKI KWF Bot b46fd9a12b Merge: TDX: kexec support + enable host support
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7224

# Merge Request Required Information

## Summary of Changes

This finally adds the last missing piece for enabling TDX on RHEL 9 hosts, namely kexec support; it's a forward port from RHEL 9.7.

The patches are in the Linus's tree.

Conflicts: the only major differences with the upstream posting are in "x86/sme: Use percpu boolean to control WBINVD during kexec". Here I decided to leave out a cleanup patch in order to have a much smaller (and easier to review) backport.

## Approved Development Ticket(s)

```
JIRA: https://issues.redhat.com/browse/RHEL-115482
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
```

Approved-by: Steve Best <sbest@redhat.com>
Approved-by: Lucas Zampieri <lcasmz54@gmail.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2026-01-27 11:40:59 +00:00
CKI KWF Bot 61086733eb Merge: x86/bugs: Attack vector controls and proactive bug fixes
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7449

JIRA: https://issues.redhat.com/browse/RHEL-119225
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7449
Omitted-fix: 84dfce65a7ae ("x86/bugs: Remove dead code which might prevent from building")
Omitted-fix: 204ced4108f5 ("x86/bugs: Qualify RETBLEED_INTEL_MSG")
These are minor issues.

Attack vector options [1] are designed to make it easier to select
appropriate mitigations based on the usage of the system.  While many
users may not be intimately familiar with the details of these CPU
vulnerabilities, they are likely better able to understand the intended
usage of their system.  As a result, unneeded mitigations may be
disabled, allowing users to recoup more performance.  New documentation
is included with recommendations on what to consider when choosing
which attack vectors to enable/disable.

Attack vector options are chosen using the mitigations=
command line.  Attack vectors may be individually disabled such as
'mitigations=auto;no_user_kernel,no_user_user'.  The 'mitigations=off'
option is equivalent to disabling all attack vectors.  'mitigations=off'
therefore disables all mitigations, unless bug-specific command line
options are used to re-enable some.

Note that this MR also contains some other proactive backports of fixes
in mitigation or related code.

[1] https://docs.kernel.org/next/admin-guide/hw-vuln/attack_vector_controls.html

Signed-off-by: Waiman Long <longman@redhat.com>

Approved-by: Rafael Aquini <raquini@redhat.com>
Approved-by: Mark Langsdorf <mlangsdo@redhat.com>
Approved-by: Steve Best <sbest@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: CKI GitLab Kmaint Pipeline Bot <26919896-cki-kmaint-pipeline-bot@users.noreply.gitlab.com>
2026-01-22 11:16:10 +00:00
Mamatha Inamdar 332b710963 powerpc/pseries/htmdump: Add documentation for H_HTM debugfs interface
JIRA: https://issues.redhat.com/browse/RHEL-52755

commit ab1456c5aa7a63d5145547fc644bd4580dd253f2
Author: Athira Rajeev <atrajeev@linux.ibm.com>
Date:   Sun Apr 20 23:38:44 2025 +0530

    powerpc/pseries/htmdump: Add documentation for H_HTM debugfs interface

    Documentation for HTM (Hardware Trace Macro) debugfs interface
    and how it can be used to configure/control the HTM operations.

    Signed-off-by: Athira Rajeev <atrajeev@linux.ibm.com>
    Tested-by: Venkat Rao Bagalkote <venkat88@linux.ibm.com>
    Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
    Link: https://patch.msgid.link/20250420180844.53128-10-atrajeev@linux.ibm.com

Signed-off-by: Mamatha Inamdar <minamdar@redhat.com>
2025-11-28 04:35:39 -05:00
Paolo Bonzini f17096e944 x86/virt/tdx: Update the kexec section in the TDX documentation
JIRA: https://issues.redhat.com/browse/RHEL-115482

TDX host kernel now supports kexec/kdump.  Update the documentation to
reflect that.

Opportunistically, remove the parentheses in "Kexec()" and move this
section under the "Erratum" section because the updated "Kexec" section
now refers to that erratum.

Signed-off-by: Kai Huang <kai.huang@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
Reviewed-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Tested-by: Farrah Chen <farrah.chen@intel.com>
Link: https://lore.kernel.org/all/20250901160930.1785244-7-pbonzini%40redhat.com
(cherry picked from commit 5f9b5bd0c82925e4a71c5790a37b3142fec946d4)
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-11-27 12:08:21 +00:00
David Arcari c217b46cd7 x86,fs/resctrl: Move the resctrl filesystem code to live in /fs/resctrl
JIRA: https://issues.redhat.com/browse/RHEL-118965

commit 7168ae330e8105296210b2b2d31d791d5c073345
Author: James Morse <james.morse@arm.com>
Date:   Thu May 15 16:58:54 2025 +0000

    x86,fs/resctrl: Move the resctrl filesystem code to live in /fs/resctrl

    Resctrl is a filesystem interface to hardware that provides cache
    allocation policy and bandwidth control for groups of tasks or CPUs.

    To support more than one architecture, resctrl needs to live in /fs/.

    Move the code that is concerned with the filesystem interface to
    /fs/resctrl.

    Signed-off-by: James Morse <james.morse@arm.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Fenghua Yu <fenghuay@nvidia.com>
    Tested-by: Fenghua Yu <fenghuay@nvidia.com>
    Tested-by: Tony Luck <tony.luck@intel.com>
    Link: https://lore.kernel.org/20250515165855.31452-25-james.morse@arm.com

Signed-off-by: David Arcari <darcari@redhat.com>
2025-10-03 14:30:18 -04:00
Waiman Long 9517bc3872 Documentation/x86: Update the naming of CPU features for /proc/cpuinfo
JIRA: https://issues.redhat.com/browse/RHEL-119225

commit af76f7d57ee9a3be7b3840595ce3e2bdedd594a7
Author: Naveen N Rao (AMD) <naveen@kernel.org>
Date:   Wed, 9 Apr 2025 13:13:41 +0200

    Documentation/x86: Update the naming of CPU features for /proc/cpuinfo

    Commit:

      78ce84b9e0a5 ("x86/cpufeatures: Flip the /proc/cpuinfo appearance logic")

    changed how CPU feature names should be specified. Update document to
    reflect the same.

    Signed-off-by: Naveen N Rao (AMD) <naveen@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Link: https://lore.kernel.org/r/20250409111341.GDZ_ZWZS4LckBcirLE@fat_crate.local

Signed-off-by: Waiman Long <longman@redhat.com>
2025-10-03 12:53:33 -04:00
David Arcari bd873cce63 x86/resctrl: Document the new "mba_MBps_event" file
JIRA: https://issues.redhat.com/browse/RHEL-118965

commit faf6ef673787956ec4d33ac8bf56f8ea929abf37
Author: Tony Luck <tony.luck@intel.com>
Date:   Fri Dec 6 08:31:48 2024 -0800

    x86/resctrl: Document the new "mba_MBps_event" file

    Add a section to document a new read/write file that shows/sets the memory
    bandwidth event used to control bandwidth used by each CTRL_MON group.

    Signed-off-by: Tony Luck <tony.luck@intel.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Tested-by: Babu Moger <babu.moger@amd.com>
    Link: https://lore.kernel.org/r/20241206163148.83828-9-tony.luck@intel.com

Signed-off-by: David Arcari <darcari@redhat.com>
2025-10-03 10:06:59 -04:00
Patrick Talbert 9b7fdef7cf Merge: Update platform/x86/amd/hsmp
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7124

Newer AMD Fam19h and Fam1Ah EPYC processors from AMD support system
management functionality via HSMP (Host System Management Port). The
Host System Management Port (HSMP) is an interface to provide OS-level
software with access to system management functions via a set of mailbox
registers.

Update the driver to support the latest functions.

JIRA: https://issues.redhat.com/browse/RHEL-102859

Signed-off-by: David Arcari <darcari@redhat.com>

Approved-by: Tony Camuso <tcamuso@redhat.com>
Approved-by: Lenny Szubowicz <lszubowi@redhat.com>
Approved-by: Rafael Aquini <raquini@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Patrick Talbert <ptalbert@redhat.com>
2025-09-20 09:46:08 -04:00
David Arcari f2ce01bd05 platform/x86/amd/hsmp: acpi: Add sysfs files to display HSMP telemetry
JIRA: https://issues.redhat.com/browse/RHEL-102859
Conflicts: upstream d96c78684166 has already been applied and RHEL
	   RHEL is missing upstream 8fa1a2e1053a

commit 511a4a5ea2b6f1d4e0c719f27db6b627b2b52e49
Author: Suma Hegde <suma.hegde@amd.com>
Date:   Tue May 6 10:15:42 2025 +0000

    platform/x86/amd/hsmp: acpi: Add sysfs files to display HSMP telemetry

    Make frequently fetched telemetry available via sysfs. These parameters
    do not fit in hwmon sensor model, hence make them available via sysfs.

    Create following sysfs files per acpi device node.
    * c0_residency_input
    * prochot_status
    * smu_fw_version
    * protocol_version
    * ddr_max_bw(GB/s)
    * ddr_utilised_bw_input(GB/s)
    * ddr_utilised_bw_perc_input(%)
    * mclk_input(MHz)
    * fclk_input(MHz)
    * clk_fmax(MHz)
    * clk_fmin(MHz)
    * cclk_freq_limit_input(MHz)
    * pwr_current_active_freq_limit(MHz)
    * pwr_current_active_freq_limit_source

    Signed-off-by: Suma Hegde <suma.hegde@amd.com>
    Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Link: https://lore.kernel.org/r/20250506101542.200811-3-suma.hegde@amd.com
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Assisted-by: Patchpal AI
Signed-off-by: David Arcari <darcari@redhat.com>
2025-09-15 08:55:57 -04:00
David Arcari 4292862394 platform/x86/amd/hsmp: Report power via hwmon sensors
JIRA: https://issues.redhat.com/browse/RHEL-102859
Conflicts: includes include file fix from merge 1193e205dbb6
	   RHEL doesn't have upstream cdd30ebb1b9f

commit 92c025db52bb94a032eb3d473bb81e62c19ddbd3
Author: Suma Hegde <suma.hegde@amd.com>
Date:   Tue May 6 10:15:41 2025 +0000

    platform/x86/amd/hsmp: Report power via hwmon sensors

    Expose power reading and power limits via hwmon power sensors.

    Signed-off-by: Suma Hegde <suma.hegde@amd.com>
    Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
    Link: https://lore.kernel.org/r/20250506101542.200811-2-suma.hegde@amd.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-09-15 08:55:57 -04:00
David Arcari 0864b4a28e platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers
JIRA: https://issues.redhat.com/browse/RHEL-102859
Conflicts: RHEL has remove_new, not remove

commit 7d3135d16356f1f0adda7e76d4a747f618263db4
Author: Suma Hegde <suma.hegde@amd.com>
Date:   Mon Oct 21 11:14:25 2024 +0000

    platform/x86/amd/hsmp: Create separate ACPI, plat and common drivers

    Separate the probes for HSMP ACPI and platform device drivers.

    Provide a Kconfig option to choose between ACPI or the platform device
    based driver. The common code which is the core part of the HSMP driver
    maintained at hsmp.c is guarded by AMD_HSMP config and is selected by
    these two driver configs. This will be built into separate hsmp_common.ko
    module and acpi as hsmp_acpi and plat as amd_hsmp respectively.

    Also add "|| COMPILE_TEST" clause in Kconfig to get build coverage for
    HSMP.

    Signed-off-by: Suma Hegde <suma.hegde@amd.com>
    Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@amd.com>
    Link: https://lore.kernel.org/r/20241021111428.2676884-8-suma.hegde@amd.com
    [ij: Fixed doc to use pre-formatted text for the ACPI dump.]
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-09-15 08:55:53 -04:00
David Arcari 72363026ca Documentation/x86/amd/hsmp: Updating urls
JIRA: https://issues.redhat.com/browse/RHEL-102859

commit e9df5436fd61c8cf375ac086d936f90385cd6888
Author: Erwan Velu <erwanaliasr1@gmail.com>
Date:   Thu Mar 7 14:35:59 2024 +0100

    Documentation/x86/amd/hsmp: Updating urls

    When reading this page, some links were broken.
    This commit updates links to get documentation actually pointing the
    intended content.

    Signed-off-by: Erwan Velu <e.velu@criteo.com>
    Link: https://lore.kernel.org/r/20240307133601.103521-1-e.velu@criteo.com
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2025-09-15 08:55:52 -04:00
Waiman Long 77bebd8da4 x86/bugs: Rename MDS machinery to something more generic
JIRA: https://issues.redhat.com/browse/RHEL-83897
JIRA: https://issues.redhat.com/browse/RHEL-83906
CVE: CVE-2024-36350
CVE: CVE-2024-36357
Conflicts:
  The mmio_apply_mitigation() hunk of arch/x86/kernel/cpu/bugs.c is
  applied to mmio_select_mitigation() with some context diff due to
  missing upstream commit 4a5a04e61d7f ("x86/bugs: Restructure MMIO
  mitigation").

commit f9af88a3d384c8b55beb5dc5483e5da0135fadbd
Author: Borislav Petkov (AMD) <bp@alien8.de>
Date:   Wed, 11 Sep 2024 05:13:46 +0200

    x86/bugs: Rename MDS machinery to something more generic

    It will be used by other x86 mitigations.

    No functional changes.

    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>

Signed-off-by: Waiman Long <longman@redhat.com>
2025-08-27 15:05:12 -04:00
Augusto Caringi 30cdfb9ec6 Merge: perf: Enable core RAPL counters and per-core energy tracking support for AMD
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6991

JIRA: https://issues.redhat.com/browse/RHEL-52654

JIRA: https://issues.redhat.com/browse/RHEL-23496

This brings several refinements of the RAPL driver and mainly adds
the core energy support for AMD.

Signed-off-by: Michael Petlan <mpetlan@redhat.com>

Approved-by: David Arcari <darcari@redhat.com>
Approved-by: ashelat <ashelat@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Augusto Caringi <acaringi@redhat.com>
2025-07-03 12:51:59 -03:00
Augusto Caringi 9d635ba352 Merge: Print AMD last reset reason into the kernel logs
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6996

JIRA: https://issues.redhat.com/browse/RHEL-89441

This patch series will will print the last reset reason into the kernel
logs. This is very helpful information for finding patterns of problems
so that they can be reproduced and debugged.

Signed-off-by: David Arcari <darcari@redhat.com>

Approved-by: Tony Camuso <tcamuso@redhat.com>
Approved-by: Prarit Bhargava <prarit@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Augusto Caringi <acaringi@redhat.com>
2025-06-23 11:03:07 -03:00
David Arcari 507df76129 x86/CPU/AMD: Print the reason for the last reset
JIRA: https://issues.redhat.com/browse/RHEL-89441

commit ab8131028710d009ab93d6bffd2a2749ade909b0
Author: Yazen Ghannam <yazen.ghannam@amd.com>
Date:   Tue Apr 22 18:48:30 2025 -0500

    x86/CPU/AMD: Print the reason for the last reset

    The following register contains bits that indicate the cause for the
    previous reset.

      PMx000000C0 (FCH::PM::S5_RESET_STATUS)

    This is useful for debug. The reasons for reset are broken into 6 high level
    categories. Decode it by category and print during boot.

    Specifics within a category are split off into debugging documentation.

    The register is accessed indirectly through a "PM" port in the FCH. Use
    MMIO access in order to avoid restrictions with legacy port access.

    Use a late_initcall() to ensure that MMIO has been set up before trying to
    access the register.

    This register was introduced with AMD Family 17h, so avoid access on older
    families. There is no CPUID feature bit for this register.

      [ bp: Simplify the reason dumping loop.
        - merge a fix to not access an array element after the last one:
          https://lore.kernel.org/r/20250505133609.83933-1-superm1@kernel.org
          Reported-by: James Dutton <james.dutton@gmail.com>
          ]

      [ mingo:
        - Use consistent .rst formatting
        - Fix 'Sleep' class field to 'ACPI-State'
        - Standardize pin messages around the 'tripped' verbiage
        - Remove reference to ring-buffer printing & simplify the wording
        - Use curly braces for multi-line conditional statements ]

    Signed-off-by: Yazen Ghannam <yazen.ghannam@amd.com>
    Co-developed-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Signed-off-by: Ingo Molnar <mingo@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/20250422234830.2840784-6-superm1@kernel.org

Signed-off-by: David Arcari <darcari@redhat.com>
2025-06-13 09:45:30 -04:00
David Arcari 33e5a59d14 Documentation: Add AMD Zen debugging document
JIRA: https://issues.redhat.com/browse/RHEL-89441

commit cafb22242bfb7fad10fde6f9b99853fc924e691a
Author: Mario Limonciello <mario.limonciello@amd.com>
Date:   Tue Apr 22 18:48:26 2025 -0500

    Documentation: Add AMD Zen debugging document

    Debugging issues on AMD hardware can be challenging for users without
    proper documentation and tools.

    Introduce a document that includes techniques for debugging s2idle
    issues. It will be expanded for debugging other issues later.

    Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
    Link: https://lore.kernel.org/20250422234830.2840784-2-superm1@kernel.org

Signed-off-by: David Arcari <darcari@redhat.com>
2025-06-13 09:45:30 -04:00
Michael Petlan e4ac05f437 x86/topology: Introduce topology_logical_core_id()
JIRA: https://issues.redhat.com/browse/RHEL-23496

upstream
========
commit e4b444347795a1ecc083895582bc2e7f288a22e4
Author: K Prateek Nayak <kprateek.nayak@amd.com>
Date: Fri Nov 15 06:07:58 2024 +0000

description
===========
On x86, topology_core_id() returns a unique core ID within the PKG
domain. Looking at match_smt() suggests that a core ID just needs to be
unique within a LLC domain. For use cases such as the core RAPL PMU,
there exists a need for a unique core ID across the entire system with
multiple PKG domains. Introduce topology_logical_core_id() to derive a
unique core ID across the system.

    Signed-off-by: K Prateek Nayak <kprateek.nayak@amd.com>
    Signed-off-by: Dhananjay Ugwekar <Dhananjay.Ugwekar@amd.com>
    Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
    Reviewed-by: Zhang Rui <rui.zhang@intel.com>
    Reviewed-by: "Gautham R. Shenoy" <gautham.shenoy@amd.com>
    Tested-by: K Prateek Nayak <kprateek.nayak@amd.com>
    Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name>
    Link: https://lore.kernel.org/r/20241115060805.447565-3-Dhananjay.Ugwekar@amd.com

Signed-off-by: Michael Petlan <mpetlan@redhat.com>
2025-06-12 10:05:02 +02:00
Thomas Huth 83064ec231 s390/vfio-ap: Driver feature advertisement
JIRA: https://issues.redhat.com/browse/RHEL-73321

commit 2d8721364ce83956d0a184a64052928589ef15df
Author: Jason J. Herne <jjherne@linux.ibm.com>
Date:   Mon Sep 16 08:01:23 2024 -0400

    s390/vfio-ap: Driver feature advertisement

    Advertise features of the driver for the benefit of automated tooling
    like Libvirt and mdevctl.

    Signed-off-by: Jason J. Herne <jjherne@linux.ibm.com>
    Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
    Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
    Link: https://lore.kernel.org/r/20240916120123.11484-1-jjherne@linux.ibm.com
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

Signed-off-by: Thomas Huth <thuth@redhat.com>
2025-05-12 13:03:09 +02:00
Thomas Huth b9454e6c71 docs: Update s390 vfio-ap doc for ap_config sysfs attribute
JIRA: https://issues.redhat.com/browse/RHEL-73321

commit 3113a29e25fe072d6eb0abccd695d7cc72ac9b6f
Author: Jason J. Herne <jjherne@linux.ibm.com>
Date:   Mon Apr 15 11:25:55 2024 -0400

    docs: Update s390 vfio-ap doc for ap_config sysfs attribute

    A new sysfs attribute, ap_config, for the vfio_ap driver is
    documented.

    Signed-off-by: "Jason J. Herne" <jjherne@linux.ibm.com>
    Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
    Link: https://lore.kernel.org/r/20240415152555.13152-6-jjherne@linux.ibm.com
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>

Signed-off-by: Thomas Huth <thuth@redhat.com>
2025-05-12 13:03:09 +02:00
Thomas Huth b0e3825d73 s390/mm: Uncouple physical vs virtual address spaces
JIRA: https://issues.redhat.com/browse/RHEL-86670

commit c98d2ecae08f02bd2dccd24e7e485e9f0211db65
Author: Alexander Gordeev <agordeev@linux.ibm.com>
Date:   Fri Mar 1 07:15:22 2024 +0100

    s390/mm: Uncouple physical vs virtual address spaces

    The uncoupling physical vs virtual address spaces brings
    the following benefits to s390:

    - virtual memory layout flexibility;
    - closes the address gap between kernel and modules, it
      caused s390-only problems in the past (e.g. 'perf' bugs);
    - allows getting rid of trampolines used for module calls
      into kernel;
    - allows simplifying BPF trampoline;
    - minor performance improvement in branch prediction;
    - kernel randomization entropy is magnitude bigger, as it is
      derived from the amount of available virtual, not physical
      memory;

    The whole change could be described in two pictures below:
    before and after the change.

    Some aspects of the virtual memory layout setup are not
    clarified (number of page levels, alignment, DMA memory),
    since these are not a part of this change or secondary
    with regard to how the uncoupling itself is implemented.

    The focus of the pictures is to explain why __va() and __pa()
    macros are implemented the way they are.

            Memory layout in V==R mode:

    |    Physical      |    Virtual       |
    +- 0 --------------+- 0 --------------+ identity mapping start
    |                  | S390_lowcore     | Low-address memory
    |                  +- 8 KB -----------+
    |                  |                  |
    |                  | identity         | phys == virt
    |                  | mapping          | virt == phys
    |                  |                  |
    +- AMODE31_START --+- AMODE31_START --+ .amode31 rand. phys/virt start
    |.amode31 text/data|.amode31 text/data|
    +- AMODE31_END ----+- AMODE31_END ----+ .amode31 rand. phys/virt start
    |                  |                  |
    |                  |                  |
    +- __kaslr_offset, __kaslr_offset_phys| kernel rand. phys/virt start
    |                  |                  |
    | kernel text/data | kernel text/data | phys == kvirt
    |                  |                  |
    +------------------+------------------+ kernel phys/virt end
    |                  |                  |
    |                  |                  |
    |                  |                  |
    |                  |                  |
    +- ident_map_size -+- ident_map_size -+ identity mapping end
                       |                  |
                       |  ... unused gap  |
                       |                  |
                       +---- vmemmap -----+ 'struct page' array start
                       |                  |
                       | virtually mapped |
                       | memory map       |
                       |                  |
                       +- __abs_lowcore --+
                       |                  |
                       | Absolute Lowcore |
                       |                  |
                       +- __memcpy_real_area
                       |                  |
                       |  Real Memory Copy|
                       |                  |
                       +- VMALLOC_START --+ vmalloc area start
                       |                  |
                       |  vmalloc area    |
                       |                  |
                       +- MODULES_VADDR --+ modules area start
                       |                  |
                       |  modules area    |
                       |                  |
                       +------------------+ UltraVisor Secure Storage limit
                       |                  |
                       |  ... unused gap  |
                       |                  |
                       +KASAN_SHADOW_START+ KASAN shadow memory start
                       |                  |
                       |   KASAN shadow   |
                       |                  |
                       +------------------+ ASCE limit

            Memory layout in V!=R mode:

    |    Physical      |    Virtual       |
    +- 0 --------------+- 0 --------------+
    |                  | S390_lowcore     | Low-address memory
    |                  +- 8 KB -----------+
    |                  |                  |
    |                  |                  |
    |                  | ... unused gap   |
    |                  |                  |
    +- AMODE31_START --+- AMODE31_START --+ .amode31 rand. phys/virt start
    |.amode31 text/data|.amode31 text/data|
    +- AMODE31_END ----+- AMODE31_END ----+ .amode31 rand. phys/virt end (<2GB)
    |                  |                  |
    |                  |                  |
    +- __kaslr_offset_phys               | kernel rand. phys start
    |                  |                  |
    | kernel text/data |                  |
    |                  |                  |
    +------------------+                 | kernel phys end
    |                  |                  |
    |                  |                  |
    |                  |                  |
    |                  |                  |
    +- ident_map_size -+                 |
                       |                  |
                       |  ... unused gap  |
                       |                  |
                       +- __identity_base + identity mapping start (>= 2GB)
                       |                  |
                       | identity         | phys == virt - __identity_base
                       | mapping          | virt == phys + __identity_base
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       |                  |
                       +---- vmemmap -----+ 'struct page' array start
                       |                  |
                       | virtually mapped |
                       | memory map       |
                       |                  |
                       +- __abs_lowcore --+
                       |                  |
                       | Absolute Lowcore |
                       |                  |
                       +- __memcpy_real_area
                       |                  |
                       |  Real Memory Copy|
                       |                  |
                       +- VMALLOC_START --+ vmalloc area start
                       |                  |
                       |  vmalloc area    |
                       |                  |
                       +- MODULES_VADDR --+ modules area start
                       |                  |
                       |  modules area    |
                       |                  |
                       +- __kaslr_offset -+ kernel rand. virt start
                       |                  |
                       | kernel text/data | phys == (kvirt - __kaslr_offset) +
                       |                  |         __kaslr_offset_phys
                       +- kernel .bss end + kernel rand. virt end
                       |                  |
                       |  ... unused gap  |
                       |                  |
                       +------------------+ UltraVisor Secure Storage limit
                       |                  |
                       |  ... unused gap  |
                       |                  |
                       +KASAN_SHADOW_START+ KASAN shadow memory start
                       |                  |
                       |   KASAN shadow   |
                       |                  |
                       +------------------+ ASCE limit

    Unused gaps in the virtual memory layout could be present
    or not - depending on how partucular system is configured.
    No page tables are created for the unused gaps.

    The relative order of vmalloc, modules and kernel image in
    virtual memory is defined by following considerations:

    - start of the modules area and end of the kernel should reside
      within 4GB to accommodate relative 32-bit jumps. The best way
      to achieve that is to place kernel next to modules;

    - vmalloc and module areas should locate next to each other
      to prevent failures and extra reworks in user level tools
      (makedumpfile, crash, etc.) which treat vmalloc and module
      addresses similarily;

    - kernel needs to be the last area in the virtual memory
      layout to easily distinguish between kernel and non-kernel
      virtual addresses. That is needed to (again) simplify
      handling of addresses in user level tools and make __pa()
      macro faster (see below);

    Concluding the above, the relative order of the considered
    virtual areas in memory is: vmalloc - modules - kernel.
    Therefore, the only change to the current memory layout is
    moving kernel to the end of virtual address space.

    With that approach the implementation of __pa() macro is
    straightforward - all linear virtual addresses less than
    kernel base are considered identity mapping:

            phys == virt - __identity_base

    All addresses greater than kernel base are kernel ones:

            phys == (kvirt - __kaslr_offset) + __kaslr_offset_phys

    By contrast, __va() macro deals only with identity mapping
    addresses:

            virt == phys + __identity_base

    .amode31 section is mapped separately and is not covered by
    __pa() macro. In fact, it could have been handled easily by
    checking whether a virtual address is within the section or
    not, but there is no need for that. Thus, let __pa() code
    do as little machine cycles as possible.

    The KASAN shadow memory is located at the very end of the
    virtual memory layout, at addresses higher than the kernel.
    However, that is not a linear mapping and no code other than
    KASAN instrumentation or API is expected to access it.

    When KASLR mode is enabled the kernel base address randomized
    within a memory window that spans whole unused virtual address
    space. The size of that window depends from the amount of
    physical memory available to the system, the limit imposed by
    UltraVisor (if present) and the vmalloc area size as provided
    by vmalloc= kernel command line parameter.

    In case the virtual memory is exhausted the minimum size of
    the randomization window is forcefully set to 2GB, which
    amounts to in 15 bits of entropy if KASAN is enabled or 17
    bits of entropy in default configuration.

    The default kernel offset 0x100000 is used as a magic value
    both in the decompressor code and vmlinux linker script, but
    it will be removed with a follow-up change.

    Acked-by: Heiko Carstens <hca@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>

Signed-off-by: Thomas Huth <thuth@redhat.com>
2025-05-12 13:03:08 +02:00
Thomas Huth 67fb598b36 s390/ap: modularize ap bus
JIRA: https://issues.redhat.com/browse/RHEL-86670

commit 123760841a2e5977d4e97f86999b3784df58801d
Author: Holger Dengler <dengler@linux.ibm.com>
Date:   Mon Feb 19 18:10:19 2024 +0100

    s390/ap: modularize ap bus

    There is no hard requirement to have the ap bus statically in the
    kernel, so add an option to compile it as module.

    Cc: Tony Krowiak <akrowiak@linux.ibm.com>
    Cc: Halil Pasic <pasic@linux.ibm.com>
    Signed-off-by: Holger Dengler <dengler@linux.ibm.com>
    Reviewed-by: Harald Freudenberger <freude@linux.ibm.com>
    Reviewed-by: Anthony Krowiak <akrowiak@linux.ibm.com>
    Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>

Signed-off-by: Thomas Huth <thuth@redhat.com>
2025-05-12 13:03:07 +02:00
Augusto Caringi b7c939cfb2 Merge: x86, jump_label: Improve text patching and assembly code support
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5875

JIRA: https://issues.redhat.com/browse/RHEL-68940
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5875
Omitted-fix: 213aa670153e ("parisc: Delay write-protection until mark_rodata_ro() call")
Omitted-fix: 14ab4792ee12 ("net/tcp: Disable TCP-AO static key after RCU grace period")

The main focus of this MR is to backport various upstream patches related
to static_call/jump_label processing to fix potential issues in text
patching. It also includes more recent x86's alternative, callthunks,
percpu and asm related support headers to support better code patching
in x86 as well as easing backport of future x86 mitigation patches with
assembly code.

The last documentation patch backports the remaining pieces of commit
ff61f0791ce9 ("docs: move x86 documentation into Documentation/arch/") to
complete the migration of x86 documentation to Documentation/arch/x86 to
reduce conflicts in future backports.

Signed-off-by: Waiman Long <longman@redhat.com>

Approved-by: Herton R. Krzesinski <herton@redhat.com>
Approved-by: Phil Auld <pauld@redhat.com>
Approved-by: Eder Zulian <ezulian@redhat.com>
Approved-by: David Arcari <darcari@redhat.com>
Approved-by: Rafael Aquini <raquini@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Augusto Caringi <acaringi@redhat.com>
2025-04-29 18:49:37 -03:00
Waiman Long ddbc819170 docs: move x86 documentation into Documentation/arch/
JIRA: https://issues.redhat.com/browse/RHEL-68940
Conflicts:
  1) The Documentation/x86/boot.rst file and hunks related to this
     file are dropped due to a partial backport of this commit in
     RHEL commit a146bb42fb ("docs: move x86 documentation into
     Documentation/arch/"). In part
  2) The x86/resctrl.rst and x86/topology.rst files are also dropped as
     they have been moved earlier by other RHEL commits.
  3) Some files are renamed and some are missing.

commit ff61f0791ce969d2db6c9f3b71d74ceec0a2e958
Author: Jonathan Corbet <corbet@lwn.net>
Date:   Tue, 14 Mar 2023 17:06:44 -0600

    docs: move x86 documentation into Documentation/arch/

    Move the x86 documentation under Documentation/arch/ as a way of cleaning
    up the top-level directory and making the structure of our docs more
    closely match the structure of the source directories it describes.

    All in-kernel references to the old paths have been updated.

    Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: linux-arch@vger.kernel.org
    Cc: x86@kernel.org
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/lkml/20230315211523.108836-1-corbet@lwn.net/
    Signed-off-by: Jonathan Corbet <corbet@lwn.net>

Signed-off-by: Waiman Long <longman@redhat.com>
2025-04-20 20:01:19 -04:00
Štěpán Horáček 1272459080 x86/shstk: Add ARCH_SHSTK_STATUS
JIRA: https://issues.redhat.com/browse/RHEL-15599

Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

commit 67840ad0fa14ad49a605074b12d5b0f3c3113ed1
Author: Rick Edgecombe <rick.p.edgecombe@intel.com>
Date:   Mon Jun 12 17:11:08 2023 -0700

    x86/shstk: Add ARCH_SHSTK_STATUS

    CRIU and GDB need to get the current shadow stack and WRSS enablement
    status. This information is already available via /proc/pid/status, but
    this is inconvenient for CRIU because it involves parsing the text output
    in an area of the code where this is difficult. Provide a status
    arch_prctl(), ARCH_SHSTK_STATUS for retrieving the status. Have arg2 be a
    userspace address, and make the new arch_prctl simply copy the features
    out to userspace.

    Suggested-by: Mike Rapoport <rppt@kernel.org>
    Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
    Tested-by: Pengfei Xu <pengfei.xu@intel.com>
    Tested-by: John Allen <john.allen@amd.com>
    Tested-by: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/all/20230613001108.3040476-43-rick.p.edgecombe%40intel.com

Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
2025-03-18 13:29:05 +01:00
Štěpán Horáček 0df37ba0ad x86/shstk: Add ARCH_SHSTK_UNLOCK
JIRA: https://issues.redhat.com/browse/RHEL-15599

Upstream Status: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

commit 680ed2f15e70d079c8148589a3ce9426fc0ff914
Author: Mike Rapoport <rppt@kernel.org>
Date:   Mon Jun 12 17:11:07 2023 -0700

    x86/shstk: Add ARCH_SHSTK_UNLOCK

    Userspace loaders may lock features before a CRIU restore operation has
    the chance to set them to whatever state is required by the process
    being restored. Allow a way for CRIU to unlock features. Add it as an
    arch_prctl() like the other shadow stack operations, but restrict it being
    called by the ptrace arch_pctl() interface.

    [Merged into recent API changes, added commit log and docs]

    Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
    Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Reviewed-by: David Hildenbrand <david@redhat.com>
    Tested-by: Pengfei Xu <pengfei.xu@intel.com>
    Tested-by: John Allen <john.allen@amd.com>
    Tested-by: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/all/20230613001108.3040476-42-rick.p.edgecombe%40intel.com

Signed-off-by: Štěpán Horáček <shoracek@redhat.com>
2025-03-18 13:29:05 +01:00
Baoquan He 6697702ca5 kexec: Allocate kernel above bzImage's pref_address
JIRA: https://issues.redhat.com/browse/RHEL-58641

Upstream Status: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git

commit 43b1d3e68ee7f41c494ee5558d8def3d3d0b7f1b
Author: Chris Koch <chrisko@google.com>
Date:   Fri Dec 15 11:05:21 2023 -0800

    kexec: Allocate kernel above bzImage's pref_address

    A relocatable kernel will relocate itself to pref_address if it is
    loaded below pref_address. This means a booted kernel may be relocating
    itself to an area with reserved memory on modern systems, potentially
    clobbering arbitrary data that may be important to the system.

    This is often the case, as the default value of PHYSICAL_START is
    0x1000000 and kernels are typically loaded at 0x100000 or above by
    bootloaders like iPXE or kexec. GRUB behaves like the approach
    implemented here.

    Also fixes the documentation around pref_address and PHYSICAL_START to
    be accurate.

    [ dhansen: changelog tweak ]

    Co-developed-by: Cloud Hsu <cloudhsu@google.com>
    Signed-off-by: Cloud Hsu <cloudhsu@google.com>
    Signed-off-by: Chris Koch <chrisko@google.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: H. Peter Anvin (Intel) <hpa@zytor.com>
    Link: https://lore.kernel.org/all/20231215190521.3796022-1-chrisko%40google.com

Signed-off-by: Baoquan He <bhe@redhat.com>
2024-12-23 09:35:34 +08:00
Rafael Aquini a3b1b0c5f4 Documentation/x86: Add CET shadow stack description
JIRA: https://issues.redhat.com/browse/RHEL-27743
Conflicts:
  * Documentation/arch/x86/index.rst: hunk dropped as RHEL-9 misses upstream
    commit 4f1bb0386dfc ("docs: create a top-level arch/ directory"), and
    backport ff61f0791ce9 ("docs: move x86 documentation into Documentation/arch/")
    is only a partial port.

This patch is a backport of the following upstream commit:
commit 1eb2b7841c37c6aed20b50551902330c28618415
Author: Rick Edgecombe <rick.p.edgecombe@intel.com>
Date:   Mon Jun 12 17:10:49 2023 -0700

    Documentation/x86: Add CET shadow stack description

    Introduce a new document on Control-flow Enforcement Technology (CET).

    Co-developed-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
    Signed-off-by: Yu-cheng Yu <yu-cheng.yu@intel.com>
    Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
    Signed-off-by: Dave Hansen <dave.hansen@linux.intel.com>
    Reviewed-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Kees Cook <keescook@chromium.org>
    Acked-by: Mike Rapoport (IBM) <rppt@kernel.org>
    Tested-by: Pengfei Xu <pengfei.xu@intel.com>
    Tested-by: John Allen <john.allen@amd.com>
    Tested-by: Kees Cook <keescook@chromium.org>
    Link: https://lore.kernel.org/all/20230613001108.3040476-24-rick.p.edgecombe%40intel.com

Signed-off-by: Rafael Aquini <raquini@redhat.com>
2024-10-01 11:17:07 -04:00
Rado Vrbovsky eedd67c9a3 Merge: Refresh s390x subsystem to upstream kernel 6.7
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/5019

JIRA: https://issues.redhat.com/browse/RHEL-54248

Ignore-duplicate: 41ae003b76  
This commit was reverted in !3687  

Signed-off-by: Thomas Huth <thuth@redhat.com>

Approved-by: Tony Camuso <tcamuso@redhat.com>
Approved-by: Vladis Dronov <vdronov@redhat.com>
Approved-by: John W. Linville <linville@redhat.com>
Approved-by: Audra Mitchell <aubaker@redhat.com>
Approved-by: Cornelia Huck <cohuck@redhat.com>
Approved-by: Jerry Snitselaar <jsnitsel@redhat.com>
Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com>

Merged-by: Rado Vrbovsky <rvrbovsk@redhat.com>
2024-09-26 17:55:24 +00:00
David Arcari 63c8ffefdc x86/resctrl: Update documentation with Sub-NUMA cluster changes
JIRA: https://issues.redhat.com/browse/RHEL-20790

commit ea34999f41873c96ac89e861e5fdfc7d0403f9e3
Author: Tony Luck <tony.luck@intel.com>
Date:   Fri Jun 28 14:56:19 2024 -0700

    x86/resctrl: Update documentation with Sub-NUMA cluster changes

    With Sub-NUMA Cluster (SNC) mode enabled, the scope of monitoring resources
    is per-NODE instead of per-L3 cache. Backwards compatibility is maintained
    by providing files in the mon_L3_XX directories that sum event counts
    for all SNC nodes sharing an L3 cache.

    New files provide per-SNC node event counts.

    Users should be aware that SNC mode also affects the amount of L3 cache
    available for allocation within each SNC node.

    Signed-off-by: Tony Luck <tony.luck@intel.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Tested-by: Babu Moger <babu.moger@amd.com>
    Link: https://lore.kernel.org/r/20240628215619.76401-20-tony.luck@intel.com

Signed-off-by: David Arcari <darcari@redhat.com>
2024-09-16 07:40:32 -04:00
David Arcari a380c5e88c x86/resctrl: Add tracepoint for llc_occupancy tracking
JIRA: https://issues.redhat.com/browse/RHEL-20790

commit 931be446c6cbc15691dd499957e961f4e1d56afb
Author: Haifeng Xu <haifeng.xu@shopee.com>
Date:   Mon Apr 8 17:23:03 2024 +0800

    x86/resctrl: Add tracepoint for llc_occupancy tracking

    In our production environment, after removing monitor groups, those
    unused RMIDs get stuck in the limbo list forever because their
    llc_occupancy is always larger than the threshold. But the unused RMIDs
    can be successfully freed by turning up the threshold.

    In order to know how much the threshold should be, perf can be used to
    acquire the llc_occupancy of RMIDs in each rdt domain.

    Instead of using perf tool to track llc_occupancy and filter the log
    manually, it is more convenient for users to use tracepoint to do this
    work. So add a new tracepoint that shows the llc_occupancy of busy RMIDs
    when scanning the limbo list.

    Suggested-by: Reinette Chatre <reinette.chatre@intel.com>
    Suggested-by: James Morse <james.morse@arm.com>
    Signed-off-by: Haifeng Xu <haifeng.xu@shopee.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: James Morse <james.morse@arm.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Link: https://lore.kernel.org/r/20240408092303.26413-3-haifeng.xu@shopee.com

Signed-off-by: David Arcari <darcari@redhat.com>
2024-09-16 07:37:46 -04:00
Thomas Huth ba994843de docs: move s390 under arch
JIRA: https://issues.redhat.com/browse/RHEL-54248

commit 37002bc6b6039e1491140869c6801e0a2deee43e
Author: Costa Shulyupin <costa.shul@redhat.com>
Date:   Tue Jul 18 07:55:02 2023 +0300

    docs: move s390 under arch

    and fix all in-tree references.

    Architecture-specific documentation is being moved into Documentation/arch/
    as a way of cleaning up the top-level documentation directory and making
    the docs hierarchy more closely match the source hierarchy.

    Signed-off-by: Costa Shulyupin <costa.shul@redhat.com>
    Reviewed-by: Tony Krowiak <akrowiak@linux.ibm.com>
    Acked-by: Jonathan Corbet <corbet@lwn.net>
    Acked-by: Heiko Carstens <hca@linux.ibm.com>
    Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
    Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
    Link: https://lore.kernel.org/r/20230718045550.495428-1-costa.shul@redhat.com
    Signed-off-by: Heiko Carstens <hca@linux.ibm.com>

Conflicts:
    Documentation/admin-guide/kernel-parameters.txt
    Documentation/arch/index.rst
    MAINTAINERS
    (contextual conflicts due to missing other patches in downstream)
Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-09-06 17:33:51 +02:00
Thomas Huth 6550b6dbfd docs: create a top-level arch/ directory
JIRA: https://issues.redhat.com/browse/RHEL-54248

commit 4f1bb0386dfc0bda78ddad0e4fb3cd519b2886ab
Author: Jonathan Corbet <corbet@lwn.net>
Date:   Tue Mar 14 16:39:37 2023 -0600

    docs: create a top-level arch/ directory

    As the first step in bringing some order to our architecture-specific
    documentation, create a top-level arch/ directory and move arch.rst as its
    index.rst file.

    There is no change in the rendered docs at this point.

    Signed-off-by: Jonathan Corbet <corbet@lwn.net>

Conflicts:
    Documentation/arch.rst
    (no "arc" and "loongarch" docs in downstream, so skipped these lines)
Signed-off-by: Thomas Huth <thuth@redhat.com>
2024-09-06 17:33:51 +02:00
David Arcari 02f71a7e33 x86/cpu/topology: Get rid of cpuinfo::x86_max_cores
JIRA: https://issues.redhat.com/browse/RHEL-43147

commit 89b0f15f408f7c4ee98c1ec4c3224852fcbc3274
Author: Thomas Gleixner <tglx@linutronix.de>
Date:   Tue Feb 13 22:06:16 2024 +0100

    x86/cpu/topology: Get rid of cpuinfo::x86_max_cores

    Now that __num_cores_per_package and __num_threads_per_package are
    available, cpuinfo::x86_max_cores and the related math all over the place
    can be replaced with the ready to consume data.

    Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
    Tested-by: Michael Kelley <mhklinux@outlook.com>
    Tested-by: Sohil Mehta <sohil.mehta@intel.com>
    Link: https://lore.kernel.org/r/20240213210253.176147806@linutronix.de

Signed-off-by: David Arcari <darcari@redhat.com>
2024-08-29 08:19:51 -04:00
David Arcari cabaad010a docs: move x86 documentation into Documentation/arch/ [partial]
JIRA: https://issues.redhat.com/browse/RHEL-43147
Conflicts: limited to topology.rst

commit ff61f0791ce969d2db6c9f3b71d74ceec0a2e958
Author: Jonathan Corbet <corbet@lwn.net>
Date:   Tue Mar 14 17:06:44 2023 -0600

    docs: move x86 documentation into Documentation/arch/

    Move the x86 documentation under Documentation/arch/ as a way of cleaning
    up the top-level directory and making the structure of our docs more
    closely match the structure of the source directories it describes.

    All in-kernel references to the old paths have been updated.

    Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: linux-arch@vger.kernel.org
    Cc: x86@kernel.org
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/lkml/20230315211523.108836-1-corbet@lwn.net/
    Signed-off-by: Jonathan Corbet <corbet@lwn.net>

Signed-off-by: David Arcari <darcari@redhat.com>
2024-08-29 08:19:51 -04:00
Ryan Sullivan 88d7cfcdaa docs: automarkup: linkify git revs
JIRA: https://issues.redhat.com/browse/RHEL-31518

There aren't a ton of references to commits in the documentation, but
they do exist, and we can use automarkup to linkify them to make them
easier to follow.

Use something like this to find references to commits:

  git grep -P 'commit.*[0-9a-f]{8,}' Documentation/

Also fix a few of these to standardize on the exact format that is
already used in changelogs.

Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Jonathan Corbet <corbet@lwn.net>
Link: https://lore.kernel.org/r/20231027115420.205279-1-vegard.nossum@oracle.com
(cherry picked from commit 86b17aaf2e887355e4f70dd9c4897f6a06fa9b32)
Signed-off-by: Ryan Sullivan <rysulliv@redhat.com>
2024-04-17 16:42:26 -04:00
Lenny Szubowicz df0a9a1586 x86/efistub: Simplify and clean up handover entry code
JIRA: https://issues.redhat.com/browse/RHEL-15513

commit df9215f15206c2a81909ccf60f21d170801dce38
Author: Ard Biesheuvel <ardb@kernel.org>
Date:   Mon Aug 7 18:27:01 2023 +0200

    x86/efistub: Simplify and clean up handover entry code

    Now that the EFI entry code in assembler is only used by the optional
    and deprecated EFI handover protocol, and given that the EFI stub C code
    no longer returns to it, most of it can simply be dropped.

    While at it, clarify the symbol naming, by merging efi_main() and
    efi_stub_entry(), making the latter the shared entry point for all
    different boot modes that enter via the EFI stub.

    The efi32_stub_entry() and efi64_stub_entry() names are referenced
    explicitly by the tooling that populates the setup header, so these must
    be retained, but can be emitted as aliases of efi_stub_entry() where
    appropriate.

    Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Link: https://lore.kernel.org/r/20230807162720.545787-5-ardb@kernel.org

Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
2024-01-04 15:12:24 -05:00
Lenny Szubowicz a146bb42fb docs: move x86 documentation into Documentation/arch/
JIRA: https://issues.redhat.com/browse/RHEL-15513

Conflicts:
    This is a partial backport of the referenced upstream commit
    that just includes the move of Documentation/x86/boot.rst
    to Documentation/arch/x86/boot.rst and its in-kernel references.

    Additionally, since Documentation/x86/index.rst has not been
    moved, its reference to boot.rst is updated to its new location.

commit ff61f0791ce969d2db6c9f3b71d74ceec0a2e958
Author: Jonathan Corbet <corbet@lwn.net>
Date:   Tue Mar 14 17:06:44 2023 -0600

    docs: move x86 documentation into Documentation/arch/

    Move the x86 documentation under Documentation/arch/ as a way of cleaning
    up the top-level directory and making the structure of our docs more
    closely match the structure of the source directories it describes.

    All in-kernel references to the old paths have been updated.

    Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: linux-arch@vger.kernel.org
    Cc: x86@kernel.org
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/lkml/20230315211523.108836-1-corbet@lwn.net/
    Signed-off-by: Jonathan Corbet <corbet@lwn.net>

Signed-off-by: Lenny Szubowicz <lszubowi@redhat.com>
2024-01-04 15:12:23 -05:00
David Arcari ff0ff6c57d platform/x86/amd/hsmp: add support for metrics tbl
JIRA: https://issues.redhat.com/browse/RHEL-16017

commit 5150542b8ec5fb561be080ed0ef3bab8598154c3
Author: Suma Hegde <suma.hegde@amd.com>
Date:   Tue Oct 10 12:03:09 2023 +0000

    platform/x86/amd/hsmp: add support for metrics tbl

    AMD MI300 MCM provides GET_METRICS_TABLE message to retrieve
    all the system management information from SMU.

    The metrics table is made available as hexadecimal sysfs binary file
    under per socket sysfs directory created at
    /sys/devices/platform/amd_hsmp/socket%d/metrics_bin

    Metrics table definitions will be documented as part of Public PPR.
    The same is defined in the amd_hsmp.h header.

    Signed-off-by: Suma Hegde <suma.hegde@amd.com>
    Reviewed-by: Naveen Krishna Chatradhi <nchatrad@amd.com>
    Link: https://lore.kernel.org/r/20231010120310.3464066-2-suma.hegde@amd.com
    [ij: lseek -> lseek(), dram -> DRAM in dev_err()]
    [ij: added period to terminate a documentation sentence]
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-12-09 07:27:51 -05:00
David Arcari be6a49e19f docs: move x86 documentation into Documentation/arch/
JIRA: https://issues.redhat.com/browse/RHEL-16017
Conflicts: partial - limited to amd_hsmp

commit ff61f0791ce969d2db6c9f3b71d74ceec0a2e958
Author: Jonathan Corbet <corbet@lwn.net>
Date:   Tue Mar 14 17:06:44 2023 -0600

    docs: move x86 documentation into Documentation/arch/

    Move the x86 documentation under Documentation/arch/ as a way of cleaning
    up the top-level directory and making the structure of our docs more
    closely match the structure of the source directories it describes.

    All in-kernel references to the old paths have been updated.

    Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: linux-arch@vger.kernel.org
    Cc: x86@kernel.org
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/lkml/20230315211523.108836-1-corbet@lwn.net/
    Signed-off-by: Jonathan Corbet <corbet@lwn.net>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-12-09 07:27:51 -05:00
David Arcari dbd04f91b1 Documentation/x86: Document resctrl's new sparse_masks
JIRA: https://issues.redhat.com/browse/RHEL-15551

commit aaa5fa35743ab9f0726568611a85e3e15349b9bf
Author: Fenghua Yu <fenghua.yu@intel.com>
Date:   Tue Oct 10 12:42:39 2023 +0200

    Documentation/x86: Document resctrl's new sparse_masks

    The documentation mentions that non-contiguous bit masks are not
    supported in Intel Cache Allocation Technology (CAT).

    Update the documentation on how to determine if sparse bit masks are
    allowed in L2 and L3 CAT.

    Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
    Signed-off-by: Maciej Wieczor-Retman <maciej.wieczor-retman@intel.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Reviewed-by: Peter Newman <peternewman@google.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Babu Moger <babu.moger@amd.com>
    Tested-by: Peter Newman <peternewman@google.com>
    Link: https://lore.kernel.org/r/3e9610997164f648e15c5c2e90d4944ce36504fe.1696934091.git.maciej.wieczor-retman@intel.com

Signed-off-by: David Arcari <darcari@redhat.com>
2023-11-28 07:45:28 -05:00
David Arcari ad39cd7767 Documentation/x86: Documentation for MON group move feature
JIRA: https://issues.redhat.com/browse/RHEL-15551

commit e0a6ede2dd884adb73a7dde80444185b655f7c79
Author: Peter Newman <peternewman@google.com>
Date:   Wed Apr 19 14:50:15 2023 +0200

    Documentation/x86: Documentation for MON group move feature

    Describe new support for moving MON groups to a new parent CTRL_MON
    group and its restrictions.

    Signed-off-by: Peter Newman <peternewman@google.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Tested-by: Babu Moger <babu.moger@amd.com>
    Link: https://lore.kernel.org/r/20230419125015.693566-4-peternewman@google.com

Signed-off-by: David Arcari <darcari@redhat.com>
2023-11-28 07:45:28 -05:00
David Arcari 3b77c04f1d x86/resctrl: Display RMID of resource group
JIRA: https://issues.redhat.com/browse/RHEL-15551

commit 4cee14bcb14881aae81d60f106a335c68553ac1f
Author: Babu Moger <babu.moger@amd.com>
Date:   Mon Oct 16 19:23:08 2023 -0500

    x86/resctrl: Display RMID of resource group

    In x86, hardware uses RMID to identify a monitoring group. When a user
    creates a monitor group these details are not visible. These details
    can help resctrl debugging.

    Add RMID(mon_hw_id) to the monitor groups display in the resctrl interface.
    Users can see these details when resctrl is mounted with "-o debug" option.

    Add RFTYPE_MON_BASE that complements existing RFTYPE_CTRL_BASE and
    represents files belonging to monitoring groups.

    Other architectures do not use "RMID". Use the name mon_hw_id to refer
    to "RMID" in an effort to keep the naming generic.

    For example:
      $cat /sys/fs/resctrl/mon_groups/mon_grp1/mon_hw_id
      3

    Signed-off-by: Babu Moger <babu.moger@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Peter Newman <peternewman@google.com>
    Reviewed-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Peter Newman <peternewman@google.com>
    Tested-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
    Link: https://lore.kernel.org/r/20231017002308.134480-10-babu.moger@amd.com

Signed-off-by: David Arcari <darcari@redhat.com>
2023-11-28 07:45:28 -05:00
David Arcari daddc83115 x86/resctrl: Display CLOSID for resource group
JIRA: https://issues.redhat.com/browse/RHEL-15551

commit ca8dad225e237493f19b1c5d4a8531f13a9b078f
Author: Babu Moger <babu.moger@amd.com>
Date:   Mon Oct 16 19:23:06 2023 -0500

    x86/resctrl: Display CLOSID for resource group

    In x86, hardware uses CLOSID to identify a control group. When a user
    creates a control group this information is not visible to the user. It
    can help resctrl debugging.

    Add CLOSID(ctrl_hw_id) to the control groups display in the resctrl
    interface. Users can see this detail when resctrl is mounted with the
    "-o debug" option.

    Other architectures do not use "CLOSID". Use the names ctrl_hw_id to refer
    to "CLOSID" in an effort to keep the naming generic.

    For example:
      $cat /sys/fs/resctrl/ctrl_grp1/ctrl_hw_id
      1

    Signed-off-by: Babu Moger <babu.moger@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Peter Newman <peternewman@google.com>
    Reviewed-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Peter Newman <peternewman@google.com>
    Tested-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
    Link: https://lore.kernel.org/r/20231017002308.134480-8-babu.moger@amd.com

Signed-off-by: David Arcari <darcari@redhat.com>
2023-11-28 07:45:28 -05:00
David Arcari 265bc5c87a x86/resctrl: Introduce "-o debug" mount option
JIRA: https://issues.redhat.com/browse/RHEL-15551

commit cb07d71f01017b7c2885ed629da9b973cb56b1d2
Author: Babu Moger <babu.moger@amd.com>
Date:   Mon Oct 16 19:23:05 2023 -0500

    x86/resctrl: Introduce "-o debug" mount option

    Add "-o debug" option to mount resctrl filesystem in debug mode.  When
    in debug mode resctrl displays files that have the new RFTYPE_DEBUG flag
    to help resctrl debugging.

    Signed-off-by: Babu Moger <babu.moger@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Peter Newman <peternewman@google.com>
    Reviewed-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Peter Newman <peternewman@google.com>
    Tested-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
    Link: https://lore.kernel.org/r/20231017002308.134480-7-babu.moger@amd.com

Signed-off-by: David Arcari <darcari@redhat.com>
2023-11-28 07:45:28 -05:00
David Arcari 1dcc13af24 x86/resctrl: Add multiple tasks to the resctrl group at once
JIRA: https://issues.redhat.com/browse/RHEL-15551

commit fe2a20ea0b0953189e57740debc7dcc789d1ea55
Author: Babu Moger <babu.moger@amd.com>
Date:   Mon Oct 16 19:23:00 2023 -0500

    x86/resctrl: Add multiple tasks to the resctrl group at once

    The resctrl task assignment for monitor or control group needs to be
    done one at a time. For example:

      $mount -t resctrl resctrl /sys/fs/resctrl/
      $mkdir /sys/fs/resctrl/ctrl_grp1
      $echo 123 > /sys/fs/resctrl/ctrl_grp1/tasks
      $echo 456 > /sys/fs/resctrl/ctrl_grp1/tasks
      $echo 789 > /sys/fs/resctrl/ctrl_grp1/tasks

    This is not user-friendly when dealing with hundreds of tasks.

    Support multiple task assignment in one command with tasks ids separated
    by commas. For example:

      $echo 123,456,789 > /sys/fs/resctrl/ctrl_grp1/tasks

    Signed-off-by: Babu Moger <babu.moger@amd.com>
    Signed-off-by: Borislav Petkov (AMD) <bp@alien8.de>
    Reviewed-by: Peter Newman <peternewman@google.com>
    Reviewed-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
    Reviewed-by: Fenghua Yu <fenghua.yu@intel.com>
    Reviewed-by: Reinette Chatre <reinette.chatre@intel.com>
    Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
    Tested-by: Peter Newman <peternewman@google.com>
    Tested-by: Tan Shaopeng <tan.shaopeng@jp.fujitsu.com>
    Link: https://lore.kernel.org/r/20231017002308.134480-2-babu.moger@amd.com

Signed-off-by: David Arcari <darcari@redhat.com>
2023-11-28 07:45:28 -05:00
David Arcari 3d9ab3b761 docs: move x86 documentation into Documentation/arch/
JIRA: https://issues.redhat.com/browse/RHEL-15551
Conflicts: limited to resctrl

commit ff61f0791ce969d2db6c9f3b71d74ceec0a2e958
Author: Jonathan Corbet <corbet@lwn.net>
Date:   Tue Mar 14 17:06:44 2023 -0600

    docs: move x86 documentation into Documentation/arch/

    Move the x86 documentation under Documentation/arch/ as a way of cleaning
    up the top-level directory and making the structure of our docs more
    closely match the structure of the source directories it describes.

    All in-kernel references to the old paths have been updated.

    Acked-by: Dave Hansen <dave.hansen@linux.intel.com>
    Cc: linux-arch@vger.kernel.org
    Cc: x86@kernel.org
    Cc: Borislav Petkov <bp@alien8.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Link: https://lore.kernel.org/lkml/20230315211523.108836-1-corbet@lwn.net/
    Signed-off-by: Jonathan Corbet <corbet@lwn.net>

Signed-off-by: David Arcari <darcari@redhat.com>
2023-11-28 07:45:19 -05:00