1. 19 Jun, 2023 1 commit
    • Yazen Ghannam's avatar
      EDAC/amd64: Cache and use GPU node map · 4251566e
      Yazen Ghannam authored
      AMD systems have historically provided an "AMD Node ID" that is a unique
      identifier for each die in a multi-die package. This was associated with
      a unique instance of the AMD Northbridge on a legacy system. And now it
      is associated with a unique instance of the AMD Data Fabric on modern
      systems. Each instance is referred to as a "Node"; this is an
      AMD-specific term not to be confused with NUMA nodes.
      
      The data fabric provides a number of interfaces accessible through a set
      of functions in a single PCI device. There is one PCI device per Data
      Fabric (AMD Node), and multi-die systems will see multiple such PCI
      devices. The AMD Node ID matches a Node's position in the PCI hierarchy.
      For example, the Node 0 is accessed using the first PCI device, Node 1
      is accessed using the second, and so on. A logical CPU can find its AMD
      Node ID using CPUID. Furthermore, the AMD Node ID is used within the
      hardware fabric, so it is not purely a logical value.
      
      Heterogeneous AMD systems, with a CPU Data Fabric connected to GPU data
      fabrics, follow a similar convention. Each CPU and GPU die has a unique
      AMD Node ID value, and each Node ID corresponds to PCI devices in
      sequential order.
      
      However, there are two caveats:
      1) GPUs are not x86, and they don't have CPUID to read their AMD Node ID
      like on CPUs. This means the value is more implicit and based on PCI
      enumeration and hardware-specifics.
      2) There is a gap in the hardware values for AMD Node IDs. Values 0-7
      are for CPUs and values 8-15 are for GPUs.
      
      For example, a system with one CPU die and two GPUs dies will have the
      following values:
        CPU0 -> AMD Node 0
        GPU0 -> AMD Node 8
        GPU1 -> AMD Node 9
      
      EDAC is the only subsystem where this has a practical effect. Memory
      errors on AMD systems are commonly reported through MCA to a CPU on the
      local AMD Node. The error information is passed along to EDAC where the
      AMD EDAC modules use the AMD Node ID of reporting logical CPU to access
      AMD Node information.
      
      However, memory errors from a GPU die will be reported to the CPU die.
      Therefore, the logical CPU's AMD Node ID can't be used since it won't
      match the AMD Node ID of the GPU die. The AMD Node ID of the GPU die is
      provided as part of the MCA information, and the value will match the
      hardware enumeration (e.g. 8-15).
      
      Handle this situation by discovering GPU dies the same way as CPU dies
      in the AMD NB code. But do a "node id" fixup in AMD64 EDAC where it's
      needed.
      
      The GPU data fabrics provide a register with the base AMD Node ID for
      their local "type", i.e. GPU data fabric. This value is the same for all
      fabrics of the same type in a system.
      
      Read and cache the base AMD Node ID from one of the GPU devices during
      module initialization. Use this to fixup the "node id" when reporting
      memory errors at runtime.
      
        [ bp: Squash a fix making gpu_node_map static as reported by
              Tom Rix <trix@redhat.com>.
          Link: https://lore.kernel.org/r/20230610210930.174074-1-trix@redhat.com ]
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Co-developed-by: default avatarMuralidhara M K <muralidhara.mk@amd.com>
      Signed-off-by: default avatarMuralidhara M K <muralidhara.mk@amd.com>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Link: https://lore.kernel.org/r/20230515113537.1052146-6-muralimk@amd.com
      4251566e
  2. 05 Jun, 2023 5 commits
  3. 16 May, 2023 2 commits
  4. 14 May, 2023 13 commits
  5. 13 May, 2023 17 commits
  6. 12 May, 2023 2 commits
    • Borislav Petkov (AMD)'s avatar
      x86/retbleed: Fix return thunk alignment · 9a48d604
      Borislav Petkov (AMD) authored
      SYM_FUNC_START_LOCAL_NOALIGN() adds an endbr leading to this layout
      (leaving only the last 2 bytes of the address):
      
        3bff <zen_untrain_ret>:
        3bff:       f3 0f 1e fa             endbr64
        3c03:       f6                      test   $0xcc,%bl
      
        3c04 <__x86_return_thunk>:
        3c04:       c3                      ret
        3c05:       cc                      int3
        3c06:       0f ae e8                lfence
      
      However, "the RET at __x86_return_thunk must be on a 64 byte boundary,
      for alignment within the BTB."
      
      Use SYM_START instead.
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Reviewed-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9a48d604
    • Linus Torvalds's avatar
      Merge tag 'for-6.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 76c7f887
      Linus Torvalds authored
      Pull more btrfs fixes from David Sterba:
      
       - fix incorrect number of bitmap entries for space cache if loading is
         interrupted by some error
      
       - fix backref walking, this breaks a mode of LOGICAL_INO_V2 ioctl that
         is used in deduplication tools
      
       - zoned mode fixes:
            - properly finish zone reserved for relocation
            - correctly calculate super block zone end on ZNS
            - properly initialize new extent buffer for redirty
      
       - make mount option clear_cache work with block-group-tree, to rebuild
         free-space-tree instead of temporarily disabling it that would lead
         to a forced read-only mount
      
       - fix alignment check for offset when printing extent item
      
      * tag 'for-6.4-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: make clear_cache mount option to rebuild FST without disabling it
        btrfs: zero the buffer before marking it dirty in btrfs_redirty_list_add
        btrfs: zoned: fix full zone super block reading on ZNS
        btrfs: zoned: zone finish data relocation BG with last IO
        btrfs: fix backref walking not returning all inode refs
        btrfs: fix space cache inconsistency after error loading it from disk
        btrfs: print-tree: parent bytenr must be aligned to sector size
      76c7f887