[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v4 03/10] IOMMU/MMU: enhance the call trees of IOMMU unmapping and mapping



>>> On 11.05.16 at 05:39, <quan.xu@xxxxxxxxx> wrote:
> On May 10, 2016 4:44 PM, Jan Beulich <JBeulich@xxxxxxxx> wrote:
>> >>> On 06.05.16 at 10:54, <quan.xu@xxxxxxxxx> wrote:
>> > --- a/xen/arch/x86/mm/p2m.c
>> > +++ b/xen/arch/x86/mm/p2m.c
>> > @@ -638,13 +638,20 @@ p2m_remove_page(struct p2m_domain *p2m,
>> unsigned long gfn, unsigned long mfn,
>> >      mfn_t mfn_return;
>> >      p2m_type_t t;
>> >      p2m_access_t a;
>> > +    int rc = 0, ret;
>> >
>> >      if ( !paging_mode_translate(p2m->domain) )
>> >      {
>> >          if ( need_iommu(p2m->domain) )
>> >              for ( i = 0; i < (1 << page_order); i++ )
>> > -                iommu_unmap_page(p2m->domain, mfn + i);
>> > -        return 0;
>> > +            {
>> > +               ret = iommu_unmap_page(p2m->domain, mfn + i);
>> > +
>> > +               if ( !rc )
>> > +                   rc = ret;
>> > +            }
>> > +
>> > +        return rc;
>> >      }
>> 
>> In code like this, btw., restricting the scope of "ret" to the innermost 
> block
>> would help future readers see immediately that the value of "ret" is of no
>> further interest outside of that block.
>> 
>> Having reached the end of the patch, I'm missing the __must_check additions
>> that you said you would do in this new iteration. Is there any reason for 
> their
>> absence? Did I overlook something?
>> 
> 
> Sorry, I did overlook something.
> Checked the v2/v3 replies again, I still can't find it.
> I only add the __must_check annotation for these functions you point out.

Okay, that's the problem then: When we discussed this originally
(in abstract terms) I had clearly said that all involved functions
should become __must_check ones to make sure all cases get
caught where so far error returns got ignored. And on that basis
(as well as on the common grounds that I try to avoid repeating
the same comment over and over when reviewing a patch or a
series of patches) you should have determined yourself the full
set of functions needing the annotation. The rule of thumb is: If
a function calls a __must_check one and doesn't itself consume
the return value, it should also obtain __must_check.

> Do I need to add the __must_check annotation for these  functions (but not 
> void function) in this patch?

IOW - yes. And you'll need to apply the same consideration to
most (all?) other patches in this series.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.