All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>,
	"Jan Beulich" <jbeulich@suse.com>
Cc: Anthony PERARD <anthony.perard@vates.tech>,
	Michal Orzel <michal.orzel@amd.com>,
	Julien Grall <julien@xen.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH 2/7] x86/wait: prevent duplicated assembly labels
Date: Fri, 14 Mar 2025 11:20:25 +0000	[thread overview]
Message-ID: <0dc20917-831f-4efd-9018-cdf35d2bb0d2@citrix.com> (raw)
In-Reply-To: <Z9QBIEICQIQH2WD9@macbook.local>

On 14/03/2025 10:12 am, Roger Pau Monné wrote:
> On Fri, Mar 14, 2025 at 10:13:07AM +0100, Jan Beulich wrote:
>> But isn't it then going to be enough to latch &wqv->esp into a local variable,
>> and use that in the asm() and in the subsequent if()?
> I have the following diff which seems to prevent the duplication,
> would you both be OK with this approach?
>
> Thanks, Roger.
> ---
> diff --git a/xen/common/wait.c b/xen/common/wait.c
> index cb6f5ff3c20a..60ebd58a0abd 100644
> --- a/xen/common/wait.c
> +++ b/xen/common/wait.c
> @@ -124,6 +124,7 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
>      struct cpu_info *cpu_info = get_cpu_info();
>      struct vcpu *curr = current;
>      unsigned long dummy;
> +    void *esp = NULL;
>  
>      ASSERT(wqv->esp == NULL);
>  
> @@ -166,12 +167,12 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
>          ".L_skip:"
>          "pop %%r15; pop %%r14; pop %%r13;"
>          "pop %%r12; pop %%rbp; pop %%rbx"
> -        : "=&S" (wqv->esp), "=&c" (dummy), "=&D" (dummy)
> +        : "=&S" (esp), "=&c" (dummy), "=&D" (dummy)
>          : "0" (0), "1" (cpu_info), "2" (wqv->stack),
>            [sz] "i" (PAGE_SIZE)
>          : "memory", "rax", "rdx", "r8", "r9", "r10", "r11" );
>  
> -    if ( unlikely(wqv->esp == NULL) )
> +    if ( unlikely(esp == NULL) )
>      {
>          gdprintk(XENLOG_ERR, "Stack too large in %s\n", __func__);
>          domain_crash(curr->domain);
> @@ -179,6 +180,7 @@ static void __prepare_to_wait(struct waitqueue_vcpu *wqv)
>          for ( ; ; )
>              do_softirq();
>      }
> +    wqv->esp = esp;
>  }
>  
>  static void __finish_wait(struct waitqueue_vcpu *wqv)
>

If that works, then fine.  It's certainly less invasive.

The moment I actually get around to (or persuade someone else to) switch
the introspection mappings over to acquire_resource, then wait.c is
going to be deleted.

~Andrew



  parent reply	other threads:[~2025-03-14 11:20 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-13 15:30 [PATCH 0/7] x86/ubsan: fix ubsan on clang + code fixes Roger Pau Monne
2025-03-13 15:30 ` [PATCH 1/7] xen/ubsan: provide helper for clang's -fsanitize=function Roger Pau Monne
2025-03-13 17:18   ` Andrew Cooper
2025-03-13 15:30 ` [PATCH 2/7] x86/wait: prevent duplicated assembly labels Roger Pau Monne
2025-03-13 19:07   ` Andrew Cooper
2025-03-14  8:24   ` Jan Beulich
2025-03-14  8:30     ` Roger Pau Monné
2025-03-14  8:44       ` Jan Beulich
2025-03-14  9:05         ` Andrew Cooper
2025-03-14  9:13           ` Jan Beulich
2025-03-14 10:12             ` Roger Pau Monné
2025-03-14 11:17               ` Jan Beulich
2025-03-14 11:20               ` Andrew Cooper [this message]
2025-03-14  9:06         ` Roger Pau Monné
2025-03-14  9:15           ` Jan Beulich
2025-03-13 15:30 ` [PATCH 3/7] x86/dom0: placate GCC 12 compile-time errors with UBSAN and PVH_GUEST Roger Pau Monne
2025-03-13 19:35   ` Andrew Cooper
2025-03-14  8:10   ` Jan Beulich
2025-03-14  8:27     ` Roger Pau Monné
2025-03-14  8:33       ` Jan Beulich
2025-03-14  9:10         ` Roger Pau Monné
2025-03-13 15:30 ` [PATCH 4/7] xen/ubsan: expand pointer overflow message printing Roger Pau Monne
2025-03-13 17:22   ` Andrew Cooper
2025-03-13 15:30 ` [PATCH 5/7] x86/ioremap: prevent additions against the NULL pointer Roger Pau Monne
2025-03-13 17:21   ` Andrew Cooper
2025-03-14  8:43     ` Roger Pau Monné
2025-03-14 11:25       ` Andrew Cooper
2025-03-13 15:30 ` [PATCH 6/7] x86/vga: fix mapping of the VGA text buffer Roger Pau Monne
2025-03-13 19:39   ` Andrew Cooper
2025-03-14 10:39     ` Roger Pau Monné
2025-03-14 11:23       ` Jan Beulich
2025-03-14 11:58         ` Roger Pau Monné
2025-03-13 15:30 ` [PATCH 7/7] kconfig/randconfig: enable UBSAN for randconfig Roger Pau Monne

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=0dc20917-831f-4efd-9018-cdf35d2bb0d2@citrix.com \
    --to=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.