From: "Jürgen Groß" <jgross@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>, linux-kernel@vger.kernel.org
Cc: 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 11:07:42 +0100 [thread overview]
Message-ID: <26ba4ecc-0a97-45a5-b39a-d7f1fb9b33a5@suse.com> (raw)
In-Reply-To: <b17bbf33-1b4a-4491-b9dd-4ca1bad1876f@citrix.com>
[-- Attachment #1.1: Type: text/plain, Size: 1260 bytes --]
On 10.11.26 10:59, Andrew Cooper wrote:
> 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() ?
I'd rather have it spammy than buried somewhere in the logs.
Additionally I expect any illegal user giving up quite fast if no allocation
at all for DMA is working. :-)
Juergen
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
next prev parent reply other threads:[~2026-11-10 10:07 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
2026-11-10 10:07 ` Jürgen Groß [this message]
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=26ba4ecc-0a97-45a5-b39a-d7f1fb9b33a5@suse.com \
--to=jgross@suse.com \
--cc=andrew.cooper3@citrix.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®