Re: [PATCH 5/9] x86/mm: Switch to kvfree_rcu() API

From: Steven Rostedt
Date: Wed Nov 24 2021 - 09:58:09 EST


On Wed, 24 Nov 2021 12:03:04 +0100
"Uladzislau Rezki (Sony)" <urezki@xxxxxxxxx> wrote:

> diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
> index 933a2ebad471..e75137a06c32 100644
> --- a/arch/x86/mm/mmio-mod.c
> +++ b/arch/x86/mm/mmio-mod.c
> @@ -307,10 +307,8 @@ static void iounmap_trace_core(volatile void __iomem *addr)
>
> not_enabled:
> spin_unlock_irq(&trace_lock);
> - if (found_trace) {
> - synchronize_rcu(); /* unregister_kmmio_probe() requirement */
> - kfree(found_trace);
> - }
> + if (found_trace)
> + kvfree_rcu(found_trace); /* unregister_kmmio_probe() requirement */
> }
>

This is the first I've seen kvfree_rcu() (that I actually noticed/remember,
I'm sure I probably was Cc'd on some patches). And I find the comment
around it very confusing:

Specifically:


* kvfree_rcu(ptr);
*
* where @ptr is a pointer to kvfree().

The above suggests that you should pass a pointer to the actual function
kvfree to kvfree_rcu(), which is not what I believe is to be done.

i.e. kvfree_rcu(kvfree) ???

Perhaps rewrite that to say:

* where @ptr is the pointer to be freed by kvfree().

?

Other than that, the patch looks fine to me.

Acked-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>

-- Steve