From: "Marek Marczykowski-Górecki" <marmarek@invisiblethingslab.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org, "Jan Beulich" <jbeulich@suse.com>,
"Roger Pau Monné" <roger.pau@citrix.com>,
"Anthony PERARD" <anthony.perard@vates.tech>,
"Michal Orzel" <michal.orzel@amd.com>,
"Julien Grall" <julien@xen.org>,
"Stefano Stabellini" <sstabellini@kernel.org>
Subject: Re: [PATCH v1 1/5] console: add relocation hook
Date: Mon, 26 May 2025 17:39:32 +0200 [thread overview]
Message-ID: <aDSLNeFRZWoxMTEt@mail-itl> (raw)
In-Reply-To: <0b17da9c-57db-4a8b-90af-e53e45cb1243@citrix.com>
[-- Attachment #1: Type: text/plain, Size: 2735 bytes --]
On Mon, May 26, 2025 at 04:08:17PM +0100, Andrew Cooper wrote:
> On 25/05/2025 3:15 pm, Marek Marczykowski-Górecki wrote:
> > diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
> > index 25189541244d..3ef819a252e4 100644
> > --- a/xen/arch/x86/setup.c
> > +++ b/xen/arch/x86/setup.c
> > @@ -1481,6 +1481,8 @@ void asmlinkage __init noreturn __start_xen(void)
> > highmem_start &= ~((1UL << L3_PAGETABLE_SHIFT) - 1);
> > #endif
> >
> > + console_init_pre_relocate();
> > +
> > /*
> > * Iterate backwards over all superpage-aligned RAM regions.
> > *
> > @@ -1606,6 +1608,12 @@ void asmlinkage __init noreturn __start_xen(void)
> > if ( !xen_phys_start )
> > panic("Not enough memory to relocate Xen\n");
> >
> > + /*
> > + * Notify console drivers about relocation, before reusing old Xen's
> > + * memory.
> > + */
> > + console_init_post_relocate();
> > +
>
> With reference to the next patch, there are printk()'s in this region
> which want to work (in case something goes very wrong), so I don't think
> setting dbc->suspended is the best approach.
I guess the post_relocate hook might be moved a bit earlier, but still,
once relocation happens, the xhci console is not functional until it
gets relocated too (for example - it would post new TRBs into a ring
that isn't actually monitored by the controller).
> In dbc_uart_init_pre_relocate(), you just wait for all transfers to
> complete. Can't this be merged with post_relocate(), at which point the
> intermediate printk()'s will work too?
Not really, because the structure that driver watches is not the one
that the controller DMA into anymore... The driver would need to watch
the old physical pages (specifically, the event ring buffer there).
> It will also remove a hook.
>
> Meanwhile, we have things like:
>
> /* Cache {,compat_}gdt_l1e now that physically relocation is done. */
> this_cpu(gdt_l1e) =
> l1e_from_pfn(virt_to_mfn(boot_gdt), __PAGE_HYPERVISOR_RW);
> if ( IS_ENABLED(CONFIG_PV32) )
> this_cpu(compat_gdt_l1e) =
> l1e_from_pfn(virt_to_mfn(boot_compat_gdt), __PAGE_HYPERVISOR_RW);
>
>
> in traps_init() which really doesn't belong here, but does belong in
> some kind of general "relocation done" mechanism.
>
> I wonder if we want a new type of initcall for this, allowing individual
> areas of code to opt in with less boilerpate?
Maybe? But for the console specifically, we also need pre-relocation
hook (more context also in the next patch description).
--
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2025-05-26 15:39 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-25 14:15 [PATCH v1 0/5] Fix XHCI console on legacy MB2 boot Marek Marczykowski-Górecki
2025-05-25 14:15 ` [PATCH v1 1/5] console: add relocation hook Marek Marczykowski-Górecki
2025-05-26 15:08 ` Andrew Cooper
2025-05-26 15:39 ` Marek Marczykowski-Górecki [this message]
2025-06-05 14:42 ` Jan Beulich
2025-06-05 14:51 ` Marek Marczykowski-Górecki
2025-06-05 16:05 ` Jan Beulich
2025-06-05 16:08 ` Marek Marczykowski-Górecki
2025-06-06 6:26 ` Jan Beulich
2025-06-06 15:54 ` Marek Marczykowski-Górecki
2025-06-10 7:52 ` Jan Beulich
2025-06-10 12:54 ` Andrew Cooper
2025-06-10 13:01 ` Marek Marczykowski-Górecki
2025-05-25 14:15 ` [PATCH v1 2/5] drivers/char: Handle Xen relocation in the XHCI console driver Marek Marczykowski-Górecki
2025-05-25 14:15 ` [PATCH v1 3/5] drivers/char: make dbc_uart_dump() a bit more useful Marek Marczykowski-Górecki
2025-06-10 12:46 ` Jan Beulich
2025-05-25 14:15 ` [PATCH v1 4/5] drivers/char: remove outdated comment in xhci driver Marek Marczykowski-Górecki
2025-06-05 14:43 ` Jan Beulich
2025-05-25 14:15 ` [PATCH v1 5/5] console: support multiple serial console simultaneously Marek Marczykowski-Górecki
2025-06-10 12:48 ` Jan Beulich
2025-06-10 13:49 ` Marek Marczykowski-Górecki
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=aDSLNeFRZWoxMTEt@mail-itl \
--to=marmarek@invisiblethingslab.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--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.