From: "Roger Pau Monné" <roger.pau@citrix.com>
To: "Chen, Jiqian" <Jiqian.Chen@amd.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Anthony PERARD <anthony.perard@vates.tech>,
"Orzel, Michal" <Michal.Orzel@amd.com>,
Julien Grall <julien@xen.org>,
Stefano Stabellini <sstabellini@kernel.org>,
"Huang, Ray" <Ray.Huang@amd.com>
Subject: Re: [PATCH v5 04/10] vpci: Refactor REGISTER_VPCI_INIT
Date: Mon, 9 Jun 2025 11:29:48 +0200 [thread overview]
Message-ID: <aEapjHyBxHkkylkh@macbook.local> (raw)
In-Reply-To: <BL1PR12MB5849CA0CBDAE1E49DE54BD03E76BA@BL1PR12MB5849.namprd12.prod.outlook.com>
On Mon, Jun 09, 2025 at 07:50:21AM +0000, Chen, Jiqian wrote:
> On 2025/6/6 17:14, Roger Pau Monné wrote:
> > On Fri, Jun 06, 2025 at 09:05:48AM +0200, Jan Beulich wrote:
> >> On 06.06.2025 08:29, Chen, Jiqian wrote:
> >>> On 2025/6/5 20:50, Roger Pau Monné wrote:
> >>>> On Mon, May 26, 2025 at 05:45:53PM +0800, Jiqian Chen wrote:
> >>>>> + }; \
> >>>>> + static vpci_capability_t *const finit##_entry \
> >>>>> + __used_section(".data.vpci") = &finit##_t
> >>>>
> >>>> IMO this should better use .rodata instead of .data.
> >>> Is below change correct?
> >>>
> >>> + static const vpci_capability_t *const finit##_entry \
> >>> + __used_section(".rodata") = &finit##_t
> >>
> >> No, specifically because ...
> >>
> >>>> Not that it matters much in practice, as we place it in .rodata anyway. Note
> >>>> however you will have to move the placement of the VPCI_ARRAY in the
> >>>> linker script ahead of *(.rodata.*), otherwise that section match will
> >>>> consume the vPCI data.
> >>> I am sorry, how to move it ahead of *(.rodata.*) ?
> >>> Is below change correct?
> >>>
> >>> diff --git a/xen/include/xen/xen.lds.h b/xen/include/xen/xen.lds.h
> >>> index 793d0e11450c..3817642135aa 100644
> >>> --- a/xen/include/xen/xen.lds.h
> >>> +++ b/xen/include/xen/xen.lds.h
> >>> @@ -188,7 +188,7 @@
> >>> #define VPCI_ARRAY \
> >>> . = ALIGN(POINTER_ALIGN); \
> >>> __start_vpci_array = .; \
> >>> - *(SORT(.data.vpci.*)) \
> >>> + *(.rodata) \
> >>
> >> ... this isn't - you'd move _all_ of .rodata into here, which definitely
> >> isn't what you want. What I understand Roger meant was a .rodata-like
> >> section, e.g. .rodata.vpci.* (much like it was .data.vpci.* before).
> >
> > Indeed, my suggestion was merely to use .rodata instead of .data, as
> > that's more accurate IMO. I think it should be *(.rodata.vpci) (and
> > same section change for the __used_section() attribute.
>
> If I understand correctly, the next version will be:
>
> + static const vpci_capability_t *const finit##_entry \
> + __used_section(".rodata.vpci") = &finit##_t
> +
>
> and
>
> #define VPCI_ARRAY \
> . = ALIGN(POINTER_ALIGN); \
> __start_vpci_array = .; \
> - *(SORT(.data.vpci.*)) \
> + *(.rodata.vpci) \
> __end_vpci_array = .;
Did you also move the instances of VPCI_ARRAY in the linker scripts so
it's before the catch-all *(.rodata.*)?
>
> But, that encountered an warning when compiling.
> " {standard input}: Assembler messages:
> {standard input}:1160: Warning: setting incorrect section attributes for .rodata.vpci
> {standard input}: Assembler messages:
> {standard input}:3034: Warning: setting incorrect section attributes for .rodata.vpci
> {standard input}: Assembler messages:
> {standard input}:6686: Warning: setting incorrect section attributes for .rodata.vpci "
What are the attributes for .rodata.vpci in the object files? You can
get those using objdump or readelf, for example:
$ objdump -h xen/drivers/vpci/msi.o
[...]
17 .data.vpci.9 00000008 0000000000000000 0000000000000000 00000a50 2**3
CONTENTS, ALLOC, LOAD, RELOC, DATA
It should be READONLY, otherwise you will get those messages.
> And, during booting Xen, all value of __start_vpci_array is incorrect.
> Do I miss anything?
I think that's likely because you haven't moved the instance of
VPCI_ARRAY in the linker script?
Thanks, Roger.
next prev parent reply other threads:[~2025-06-09 9:30 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-26 9:45 [PATCH v5 00/10] Support hiding capability when its initialization fails Jiqian Chen
2025-05-26 9:45 ` [PATCH v5 01/10] vpci/header: Move emulating cap list logic into new function Jiqian Chen
2025-05-26 9:45 ` [PATCH v5 02/10] vpci/header: Emulate legacy capability list for dom0 Jiqian Chen
2025-06-05 10:54 ` Roger Pau Monné
2025-05-26 9:45 ` [PATCH v5 03/10] vpci/header: Emulate extended " Jiqian Chen
2025-06-05 11:24 ` Roger Pau Monné
2025-06-06 4:05 ` Chen, Jiqian
2025-05-26 9:45 ` [PATCH v5 04/10] vpci: Refactor REGISTER_VPCI_INIT Jiqian Chen
2025-06-05 12:50 ` Roger Pau Monné
2025-06-05 12:59 ` Jan Beulich
2025-06-06 6:29 ` Chen, Jiqian
2025-06-06 7:05 ` Jan Beulich
2025-06-06 9:14 ` Roger Pau Monné
2025-06-09 7:50 ` Chen, Jiqian
2025-06-09 9:29 ` Roger Pau Monné [this message]
2025-06-09 10:18 ` Chen, Jiqian
2025-06-09 10:40 ` Roger Pau Monné
2025-06-10 3:52 ` Chen, Jiqian
2025-06-10 7:08 ` Jan Beulich
2025-06-10 9:03 ` Chen, Jiqian
2025-06-11 10:19 ` Chen, Jiqian
2025-06-11 10:57 ` Roger Pau Monné
2025-05-26 9:45 ` [PATCH v5 05/10] vpci: Hide legacy capability when it fails to initialize Jiqian Chen
2025-06-05 13:35 ` Roger Pau Monné
2025-06-06 7:03 ` Chen, Jiqian
2025-06-06 9:16 ` Roger Pau Monné
2025-05-26 9:45 ` [PATCH v5 06/10] vpci: Hide extended " Jiqian Chen
2025-06-05 14:47 ` Roger Pau Monné
2025-06-06 8:30 ` Chen, Jiqian
2025-06-06 9:18 ` Roger Pau Monné
2025-05-26 9:45 ` [PATCH v5 07/10] vpci: Refactor vpci_remove_register to remove matched registers Jiqian Chen
2025-06-05 15:00 ` Roger Pau Monné
2025-05-26 9:45 ` [PATCH v5 08/10] vpci/rebar: Free Rebar resources when init_rebar() fails Jiqian Chen
2025-06-05 15:14 ` Roger Pau Monné
2025-06-06 8:32 ` Chen, Jiqian
2025-06-06 9:20 ` Roger Pau Monné
2025-05-26 9:45 ` [PATCH v5 09/10] vpci/msi: Free MSI resources when init_msi() fails Jiqian Chen
2025-06-05 15:19 ` Roger Pau Monné
2025-06-06 8:38 ` Chen, Jiqian
2025-06-06 9:21 ` Roger Pau Monné
2025-05-26 9:45 ` [PATCH v5 10/10] vpci/msix: Free MSIX resources when init_msix() fails Jiqian Chen
2025-06-05 15:34 ` Roger Pau Monné
2025-06-06 8:44 ` Chen, Jiqian
2025-06-06 9:23 ` Roger Pau Monné
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aEapjHyBxHkkylkh@macbook.local \
--to=roger.pau@citrix.com \
--cc=Jiqian.Chen@amd.com \
--cc=Michal.Orzel@amd.com \
--cc=Ray.Huang@amd.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.