All of lore.kernel.org
 help / color / mirror / Atom feed
From: Luca Fancellu <luca.fancellu@arm.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"Tim Deegan" <tim@xen.org>,
	"George Dunlap" <george.dunlap@citrix.com>,
	"Andrew Cooper" <andrew.cooper3@citrix.com>,
	"Wei Liu" <wl@xen.org>, "Roger Pau Monné" <roger.pau@citrix.com>
Subject: Re: [PATCH] x86/shadow: fix DO_UNSHADOW()
Date: Wed, 19 May 2021 14:12:17 +0100	[thread overview]
Message-ID: <601E0335-5A78-462C-A43B-0B8195CAB70C@arm.com> (raw)
In-Reply-To: <cdee4753-674d-23a3-7b94-fed9f2bdd0c1@suse.com>



> On 19 May 2021, at 13:36, Jan Beulich <jbeulich@suse.com> wrote:
> 
> When adding the HASH_CALLBACKS_CHECK() I failed to properly recognize
> the (somewhat unusually formatted) if() around the call to
> hash_domain_foreach()). Gcc 11 is absolutely right in pointing out the
> apparently misleading indentation. Besides adding the missing braces,
> also adjust the two oddly formatted if()-s in the macro.
> 
> Fixes: 90629587e16e ("x86/shadow: replace stale literal numbers in hash_{vcpu,domain}_foreach()")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Reviewed-by: Luca Fancellu <luca.fancellu@arm.com>

Cheers,
Luca

> ---
> I'm puzzled as to why this bug didn't cause any fallout.
> 
> --- a/xen/arch/x86/mm/shadow/common.c
> +++ b/xen/arch/x86/mm/shadow/common.c
> @@ -2220,8 +2220,8 @@ void sh_remove_shadows(struct domain *d,
>      */
> #define DO_UNSHADOW(_type) do {                                         \
>     t = (_type);                                                        \
> -    if( !(pg->count_info & PGC_page_table)                              \
> -        || !(pg->shadow_flags & (1 << t)) )                             \
> +    if ( !(pg->count_info & PGC_page_table) ||                          \
> +         !(pg->shadow_flags & (1 << t)) )                               \
>         break;                                                          \
>     smfn = shadow_hash_lookup(d, mfn_x(gmfn), t);                       \
>     if ( unlikely(!mfn_valid(smfn)) )                                   \
> @@ -2235,11 +2235,13 @@ void sh_remove_shadows(struct domain *d,
>         sh_unpin(d, smfn);                                              \
>     else if ( sh_type_has_up_pointer(d, t) )                            \
>         sh_remove_shadow_via_pointer(d, smfn);                          \
> -    if( !fast                                                           \
> -        && (pg->count_info & PGC_page_table)                            \
> -        && (pg->shadow_flags & (1 << t)) )                              \
> +    if ( !fast &&                                                       \
> +         (pg->count_info & PGC_page_table) &&                           \
> +         (pg->shadow_flags & (1 << t)) )                                \
> +    {                                                                   \
>         HASH_CALLBACKS_CHECK(SHF_page_type_mask);                       \
>         hash_domain_foreach(d, masks[t], callbacks, smfn);              \
> +    }                                                                   \
> } while (0)
> 
>     DO_UNSHADOW(SH_type_l2_32_shadow);
> 



  reply	other threads:[~2021-05-19 13:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-19 12:36 [PATCH] x86/shadow: fix DO_UNSHADOW() Jan Beulich
2021-05-19 13:12 ` Luca Fancellu [this message]
2021-05-24 16:28 ` Tim Deegan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=601E0335-5A78-462C-A43B-0B8195CAB70C@arm.com \
    --to=luca.fancellu@arm.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@citrix.com \
    --cc=jbeulich@suse.com \
    --cc=roger.pau@citrix.com \
    --cc=tim@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.