答复: [外部邮件] Re: [PATCH] iommu/amd: RCU-protect iommu_ga_log_notifier

From: Li,Rongqing

Date: Mon Nov 16 2026 - 21:19:07 EST


> > * Ensure all in-flight IRQ handlers run to completion before
> > returning @@ -1094,17 +1094,25 @@ static void iommu_poll_ga_log(struct
> > amd_iommu *iommu)
> >
> > /* Handle GA entry */
> > switch (GA_REQ_TYPE(log_entry)) {
> > - case GA_GUEST_NR:
> > - if (!iommu_ga_log_notifier)
> > - break;
> > -
> > - pr_debug("%s: devid=%#x, ga_tag=%#x\n",
> > - __func__, GA_DEVID(log_entry),
> > - GA_TAG(log_entry));
> > + case GA_GUEST_NR: {
> > + int (*notifier)(u32 ga_tag);
> > + int ret = 0;
> > +
> > + scoped_guard(rcu) {
>
> Why we need scoped_guard()? we don't have multiple error condition to handle.
> I think simple rcu_read_lock() -> call notifier stuff -> rcu_read_unlock() is good
> enough. That way we can avoid multiple if(notifier) check as well.
>
>

Reasonable, I will send v2, thanks

[Li,Rongqing]