From patchwork Wed May 19 12:36:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 12267173 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.2 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 76D88C433ED for ; Wed, 19 May 2021 12:36:32 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3F6EA610A1 for ; Wed, 19 May 2021 12:36:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3F6EA610A1 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.130052.243832 (Exim 4.92) (envelope-from ) id 1ljLR2-000824-3c; Wed, 19 May 2021 12:36:24 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 130052.243832; Wed, 19 May 2021 12:36:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ljLR2-00081x-0Z; Wed, 19 May 2021 12:36:24 +0000 Received: by outflank-mailman (input) for mailman id 130052; Wed, 19 May 2021 12:36:23 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1ljLR1-00081r-K2 for xen-devel@lists.xenproject.org; Wed, 19 May 2021 12:36:23 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 9d8f5961-0bb4-4ea0-b448-0f7260d7ff8e; Wed, 19 May 2021 12:36:22 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 836D9ACAD; Wed, 19 May 2021 12:36:21 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 9d8f5961-0bb4-4ea0-b448-0f7260d7ff8e X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1621427781; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=s0i22D5OWmS40N801WsJtN48/IEfxSCZBm0fibDvw7o=; b=UbDiE9ZWbJR9icdJBPrSKwbEKr1Xv6WjWGs7h0XRL8k7DGcvGDs6lsD2oCghlv2ThIxE4p FdANSZcPMqlxtosheungWoNKfAw6henA6FL0L37P0BjlJZJh7jBkjTUx08KWG8cZMGvxJ5 Bnc7QBNYspOO5wDKcYSz3xiYGXyX3ig= To: "xen-devel@lists.xenproject.org" Cc: Tim Deegan , George Dunlap , Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= From: Jan Beulich Subject: [PATCH] x86/shadow: fix DO_UNSHADOW() Message-ID: Date: Wed, 19 May 2021 14:36:22 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 Content-Language: en-US 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 Reviewed-by: Luca Fancellu Reviewed-by: Tim Deegan --- 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);