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 >> --- >> 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