mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Juergen Gross <jgross@suse.com>, linux-kernel@vger.kernel.org
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v2 1/2] xen: don't allow gnttab_dma_[alloc|free]_pages() in PV guest
Date: Tue, 10 Nov 2026 09:59:53 +0000	[thread overview]
Message-ID: <b17bbf33-1b4a-4491-b9dd-4ca1bad1876f@citrix.com> (raw)
In-Reply-To: <20261110095605.369848-2-jgross@suse.com>

On 10/11/2026 9:56 am, Juergen Gross wrote:
> Today gnttab_dma_alloc_pages() or gnttab_dma_free_pages are never
> called when running as a PV guest, but this holds for in-tree callers
> only.
>
> Bail out early when being called in PV mode in order to ensure no out
> of tree module or future use cases are violating this assumption.
>
> This enables to safely remove PV-only code from both functions.
>
> Signed-off-by: Juergen Gross <jgross@suse.com>
> ---
>  drivers/xen/grant-table.c | 11 ++++++-----
>  1 file changed, 6 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c
> index 604c4eea5930..56a497987942 100644
> --- a/drivers/xen/grant-table.c
> +++ b/drivers/xen/grant-table.c
> @@ -1063,6 +1063,9 @@ int gnttab_dma_alloc_pages(struct gnttab_dma_alloc_args *args)
>  	size_t size;
>  	int i, ret;
>  
> +	if (WARN_ON(xen_pv_domain()))
> +		return -EINVAL;

This will get very spammy if hit.  WARN_ON_ONCE() ?

~Andrew

  reply	other threads:[~2026-11-10 10:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  9:56 [PATCH v2 0/2] Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages() Juergen Gross
2026-11-10  9:56 ` [PATCH v2 1/2] xen: don't allow gnttab_dma_[alloc|free]_pages() in PV guest Juergen Gross
2026-11-10  9:59   ` Andrew Cooper [this message]
2026-11-10 10:07     ` Jürgen Groß
2026-11-10  9:56 ` [PATCH v2 2/2] Xen/gnttab: improve error handling in gnttab_dma_{alloc,free}_pages() Juergen Gross
2026-11-10 10:20 ` [PATCH v2 0/2] " Jan Beulich

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=b17bbf33-1b4a-4491-b9dd-4ca1bad1876f@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleksandr_tyshchenko@epam.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®