[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [XEN PATCH] x86/mce: use offsetof to determine section offset


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Nicola Vetrini <nicola.vetrini@xxxxxxxxxxx>
  • Date: Thu, 15 Jan 2026 11:20:19 +0100
  • Arc-authentication-results: i=1; bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Arc-message-signature: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; c=relaxed/relaxed; t=1768472419; h=MIME-Version:Date:From:To:Cc:Subject:In-Reply-To:References: Message-ID:X-Sender:Organization:Content-Type: Content-Transfer-Encoding; bh=KnZWE/vN7WeQU73j9OaHH+BojkCuakSF/uLVTudYhn0=; b=3bgOhu7Ph01dRdQxpdMgUNqORM0609FxToNqmyN5ixQuhBUartQXy5g3isPf1ghxyXwE OFlURCEBalwvtIIhQS2z9doa5BvvtEB0ZYAsK97GZ3LU3xWsda+6G3zsBdN7Z8vL4aA04 qy1AxAs67xow5c10QDPZKP77pwIwF8Aw6i0dpylSk22G/Py75skVHUmjAHwgM1FDsnsXG 2ke2mClh2wYowB8FJCoQnXDMMKVqf4Iv8H3A+8DUMAE/TgZzIDkoW4Gf68dCmZx6g/J6/ aOzV69T1E4UTw28vLAd42FoGP5mfotw3WwXJrHAeJQNLpkqdepAtOZpnkKC+atFMYy2K6 H8Qln3ZUU3GadKjgyadb2+j3T2eNPyDiyZRysZLyxOorISn0VJOy3ManomgOJhDferR57 MVYyJDqqEB4Hho1CXjhHCc3A4Xes7TSnvxtxy7QVzLTEK71FA8yS1yJuArv3gU/R8GQV4 1qPl0l5YzhYvbXhI4EDFUX5vhRKnVpIdnNPk/GrFOCWJhngmmnsq1sEDP2SyoY60N7Oq7 VCBLskBNQKa46sKANTp6ytUJiLbxAYR54ap6p19bXA1Dy+un8Vl1pWwipXtrHPQHyUTt+ Xt3KC6+KLSW5XC3s/KgUNKe/81nR/2TcAFy4vSlBSinwwqlhnm/bVGxT8p70wNg=
  • Arc-seal: i=1; d=bugseng.com; s=openarc; a=rsa-sha256; cv=none; t=1768472419; b=0mGEsviCTbWlTn4WtRtz6ZUjfkjA+M06fgi2UMLfSsRyoAZbKmwRQdCdV1SMtPx8X9Ak XRS0fUjdimDjPcKnJx5nymP/Tuu9DopmzSlXeP25JdmlELYysLqInz36KC+ArK0f0abzw 0+vJEw4rtaudrEoHtsmyYt8UzIYQedg0jp7Zrqhx3vGUshCrD7CFfIi6wTs7uSspQSZh0 BVcCz1hKLS5tbUJo/K9wYy8B6RaQJpgZeeODEwfD62SJIN4w9ZH1eTeLWj0+Z8HA8ljLc gf6V7qVzlZEbMluko2mmIjcXPuBHHLgovTzTl5s91d3HQ9O1wjO7xUZim1arSvhGjt+hp yK4ko9NC74SXEZOBIpHT5o1OP/hSaf7w3+NmUK1+M5GA4qxl9+XjrlRl/vHqOtdBiDoLw 8QT/8rRF7Z5EWTYpsUXPoV+pN6QKlxsj6B9GWslFbWhZNCG8qGB+TMH3JJL6JyXQNyr/t FGLpQ3i7SVRsaFiCsrjIdAqnsF60Ylp3xH6ugnS4XZ0ux/wLJWZUTdaOTopC67kgdb+HH 4RO1ConPDKL8WGDcYulNccst/tzrd6FKl405R6eX49/uiXi7WIpbgY1iV1rFND2cWDtQl wFxiqSYSi5hOBQ77xc9FYVdtm9eIJ3pUXhCSYD/NZREb59L3SincOzpk0Nbv9TQ=
  • Authentication-results: bugseng.com; arc=none smtp.remote-ip=162.55.131.47
  • Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jason Andryuk <jason.andryuk@xxxxxxx>
  • Delivery-date: Thu, 15 Jan 2026 10:20:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2026-01-15 11:17, Jan Beulich wrote:
On 14.01.2026 21:56, Nicola Vetrini wrote:
On 2026-01-14 21:40, Jason Andryuk wrote:
On 2026-01-14 13:27, Nicola Vetrini wrote:
--- a/xen/arch/x86/cpu/mcheck/mce-apei.c
+++ b/xen/arch/x86/cpu/mcheck/mce-apei.c
@@ -74,7 +74,8 @@ int apei_write_mce(struct mce *m)
        rcd.hdr.record_id = cper_next_record_id();
        rcd.hdr.flags = CPER_HW_ERROR_FLAGS_PREVERR;
  -     rcd.sec_hdr.section_offset = (void *)&rcd.mce - (void *)&rcd;
+ rcd.sec_hdr.section_offset = offsetof(struct cper_mce_record, mce) -
+                                    offsetof(struct cper_mce_record, hdr);

"= offsetof(struct cper_mce_record, mce);" should be sufficient since
the offset of hdr is 0?

Yeah, makes sense. Given that the struct layout is coming from the UEFI
spec it's not likely to change either.

It's okay either way, but I'm happy to adjust to the simpler form while
committing (I'd slightly prefer that, precisely for being simpler, and it
being close to what was there originally):
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
(ftaod: either way).

Jan

Thanks

--
Nicola Vetrini, B.Sc.
Software Engineer
BUGSENG (https://bugseng.com)
LinkedIn: https://www.linkedin.com/in/nicola-vetrini-a42471253



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.