From nobody Mon Feb 9 16:13:00 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1591019698; cv=none; d=zohomail.com; s=zohoarc; b=iO4rkawMLGP/0uezfEJ4Z2FAc0AsG4ekn0Lgh5mnz5nPoSrAIm6gu6909I30Br+HQ6dYZXGr7WG2fs/2P7ru3M07kI+kZgGb1PmGWLByTB1Xt+8VkN1B/qevLTe2DrxWZg1+2QTa3mO1LtfjSEEDwprXORu29xlbq4kQmPOZzMw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1591019698; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=FvbQAqUp6pZLGOexNPNVSwp/BkiNml6omaX95SU5XaU=; b=DyPvS7bwuEqf70SqflqZBgNS+kS9Ig+KiMkxHGohDfLG3ji2HqS6S86+tv3S1tYhFZdkPh119wRDzcJqew3xq2g3v2VfgZ1FjrO71dU3qFJYerCyzt8AfN7bLVhOHWzttHic9DbdPCWa9M2XNR0nVF47ELdmR1n7z/mEYngmfcg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1591019698061398.24879190445347; Mon, 1 Jun 2020 06:54:58 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1jfktY-0002Gh-LR; Mon, 01 Jun 2020 13:54:28 +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 1jfktX-0002GY-D6 for xen-devel@lists.xenproject.org; Mon, 01 Jun 2020 13:54:27 +0000 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 67c38028-a40f-11ea-ab1d-12813bfff9fa; Mon, 01 Jun 2020 13:54:26 +0000 (UTC) X-Inumbo-ID: 67c38028-a40f-11ea-ab1d-12813bfff9fa Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none IronPort-SDR: 4qt90VmACEPxtLEgjd+wGQwkhHFgATKLovXG0ynly1zRDj7WrmW/W0blK63cKyHDinM669+Ubb FrfZMH+NTlS8oriz16y3K5dciQ/MBzZ+u58ZQw5J0RxIHnB8QD+S8TQghNeedCabEV1wUtu2uK FGpVh1l+MCYedB2sqm5iBL/IcpzmAF2xiJGROuN3Ix8gMMGQfoNDT8iIt6eHvgDa2SE2clruoV 9xkn27QDFx+zpcB3v572iwdVAImHcD5KCZwf17uO001kYr9qd8L4ixhBqa6kKzMKS4EzFLb0si 2Hc= X-SBRS: 2.7 X-MesageID: 19215687 X-Ironport-Server: esa1.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.73,461,1583211600"; d="scan'208";a="19215687" From: Roger Pau Monne To: Subject: [PATCH v3 1/2] x86/mm: do not attempt to convert _PAGE_GNTTAB to a boolean Date: Mon, 1 Jun 2020 15:53:24 +0200 Message-ID: <20200601135325.34156-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200601135325.34156-1-roger.pau@citrix.com> References: <20200601135325.34156-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Roger Pau Monne , Wei Liu , Jan Beulich , paul@xen.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang 10 complains with: mm.c:1239:10: error: converting the result of '<<' to a boolean always eval= uates to true [-Werror,-Wtautological-constant-compare] if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) && ^ xen/include/asm/x86_64/page.h:161:25: note: expanded from macro '_PAGE_GNTT= AB' #define _PAGE_GNTTAB (1U<<22) ^ Remove the conversion of _PAGE_GNTTAB to a boolean and instead use a preprocessor conditional to check if _PAGE_GNTTAB is defined. Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- Changes since v2: - Add comment. Changes since v1: - Use a preprocessor conditional. --- xen/arch/x86/mm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c index 53e3dcb2d4..e376fc7e8f 100644 --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -1235,8 +1235,14 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct doma= in *l1e_owner) * * (Note that the undestroyable active grants are not a security hole = in * Xen. All active grants can safely be cleaned up when the domain die= s.) + * + * NB: the preprocessor conditional is required in order to prevent cl= ang's + * -Wtautological-constant-compare complaining about converting the re= sult + * of a << into a bool is always true if it's evaluated directly in th= e if + * condition. */ - if ( _PAGE_GNTTAB && (l1e_get_flags(l1e) & _PAGE_GNTTAB) && +#if _PAGE_GNTTAB + if ( (l1e_get_flags(l1e) & _PAGE_GNTTAB) && !l1e_owner->is_shutting_down && !l1e_owner->is_dying ) { gdprintk(XENLOG_WARNING, @@ -1244,6 +1250,7 @@ void put_page_from_l1e(l1_pgentry_t l1e, struct domai= n *l1e_owner) l1e_get_intpte(l1e)); domain_crash(l1e_owner); } +#endif =20 /* * Remember we didn't take a type-count of foreign writable mappings --=20 2.26.2