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

Re: [Xen-devel] [PATCH v2] x86/mm: switch to new APIs in arch_init_memory



On Thu, 2020-02-27 at 11:51 +0000, Julien Grall wrote:
> Hi Hongyan,
> 
> On 27/02/2020 10:27, Hongyan Xia wrote:
> > ...
> > diff --git a/xen/include/xen/domain_page.h
> > b/xen/include/xen/domain_page.h
> > index 32669a3339..bfc3bf6aeb 100644
> > --- a/xen/include/xen/domain_page.h
> > +++ b/xen/include/xen/domain_page.h
> > @@ -72,4 +72,11 @@ static inline void
> > unmap_domain_page_global(const void *va) {};
> >   
> >   #endif /* !CONFIG_DOMAIN_PAGE */
> >   
> > +#define UNMAP_DOMAIN_PAGE(p) do {   \
> > +    if ( p ) {                      \
> > +        unmap_domain_page(p);       \
> > +        (p) = NULL;                 \
> > +    }                               \
> > +} while ( false )
> 
> Do we need to keep the do {} while ()?

I think we do. For example:

if ( cond )
    UNMAP_DOMAIN_PAGE(p);
else
    blah_blah_blah();

If we remove the do-while, the else clause will be paired with the if
in UNMAP_DOMAIN_PAGE();

Hongyan
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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