Re: [PATCH 2/2] RAS: Introduce the FRU Memory Poison Manager

From: Borislav Petkov
Date: Wed Feb 14 2024 - 13:22:14 EST


On Wed, Feb 14, 2024 at 06:50:35PM +0100, Borislav Petkov wrote:
> On Wed, Feb 14, 2024 at 09:28:54AM -0500, Yazen Ghannam wrote:
> > > That's a good thing to have here.
>
> Up to here. __packed still needs clarification.

Yap, that is plain old __packed, as we just established:

---

diff --git a/drivers/ras/amd/fmpm.c b/drivers/ras/amd/fmpm.c
index 99499a37e9d5..a67a4b67cf9d 100644
--- a/drivers/ras/amd/fmpm.c
+++ b/drivers/ras/amd/fmpm.c
@@ -53,8 +53,6 @@
#include <asm/cpu_device_id.h>
#include <asm/mce.h>

-#pragma pack(1)
-
/* Validation Bits */
#define FMP_VALID_ARCH_TYPE BIT_ULL(0)
#define FMP_VALID_ARCH BIT_ULL(1)
@@ -78,7 +76,7 @@ struct cper_sec_fru_mem_poison {
u32 fru_id_type;
u64 fru_id;
u32 nr_entries;
-};
+} __packed;

/* FRU Descriptor ID Types */
#define FPD_HW_ID_TYPE_MCA_IPID 0
@@ -93,7 +91,7 @@ struct cper_fru_poison_desc {
u64 hw_id;
u32 addr_type;
u64 addr;
-};
+} __packed;

/* Collection of headers and sections for easy pointer use. */
struct fru_rec {
@@ -101,10 +99,7 @@ struct fru_rec {
struct cper_section_descriptor sec_desc;
struct cper_sec_fru_mem_poison fmp;
struct cper_fru_poison_desc entries[];
-};
-
-/* Reset to default packing */
-#pragma pack()
+} __packed;

/*
* Pointers to the complete CPER record of each FRU.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette