From patchwork Tue Aug 13 12:01:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andrew Cooper X-Patchwork-Id: 11092007 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id F25AD1398 for ; Tue, 13 Aug 2019 12:02:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E325428563 for ; Tue, 13 Aug 2019 12:02:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7B2428635; Tue, 13 Aug 2019 12:02:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7CCB42862A for ; Tue, 13 Aug 2019 12:02:25 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hxVUT-00045G-B8; Tue, 13 Aug 2019 12:01:25 +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.89) (envelope-from ) id 1hxVUR-00044y-W2 for xen-devel@lists.xenproject.org; Tue, 13 Aug 2019 12:01:24 +0000 X-Inumbo-ID: 106c956e-bdc2-11e9-a7ad-afdb04ed2b71 Received: from esa1.hc3370-68.iphmx.com (unknown [216.71.145.142]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 106c956e-bdc2-11e9-a7ad-afdb04ed2b71; Tue, 13 Aug 2019 12:01:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1565697682; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qr0bRkGN+EgzDwVian4any+2EppgtZJDXAK9TJtaaao=; b=XwFtMqT1hSMSuJQoqXhjqyf6XO6fkH6/btl6qhVVQiZgslmzGcTmoAmW 9oEn/drf5cc+5KHLsX5/f/ONF2AP8AqZjfiLShXJqfgIieTqM/C4vC8W2 3PrTo2ga32JhMdyy8o16mDGiR6g/xHtqdVDGMcPYTf+yaPnXQryn2vyJk Y=; Authentication-Results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=andrew.cooper3@citrix.com; spf=Pass smtp.mailfrom=Andrew.Cooper3@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of andrew.cooper3@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="andrew.cooper3@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa1.hc3370-68.iphmx.com: domain of Andrew.Cooper3@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="Andrew.Cooper3@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ~all" Received-SPF: None (esa1.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa1.hc3370-68.iphmx.com; envelope-from="Andrew.Cooper3@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: gOb0rFYKmhRBpSEoqGn2adWlb31A1DplCt76fLpKxAvSnkVgilz8tfKTukNymegDENiG8p7DnF KTmT5jSp1KOQueIc0N1KHbbFD0G0OYx8Vn7qEZMvDyxzfAuf/QrhTXgnwLmxTSeq+n8LY2ejWx C9OGFFtb0YDrbFGAh+wiF2joOke3kMf5RAprkbPj497rVRRcMloMt7GIexFa46Wom8Wwwu63Gt MXh4LJmtrbdkVMF8RJS1ZazsZgZXDvgI6qA0kEdQc5eljItO5rUFrWQ6wRWqqDp0uEkFlb90OH PaU= X-SBRS: 2.7 X-MesageID: 4242438 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.64,381,1559534400"; d="scan'208";a="4242438" From: Andrew Cooper To: Xen-devel Date: Tue, 13 Aug 2019 13:01:17 +0100 Message-ID: <20190813120117.22528-1-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] x86/tss: Fix clang build following c/s 7888440625 X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andrew Cooper , Wei Liu , Jan Beulich , =?utf-8?q?Roger_Pau_Monn=C3=A9?= Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP Clang-3.5 from Debian Jessie fails with: smpboot.c:829:29: error: statement expression not allowed at file scope BUILD_BUG_ON(sizeof(this_cpu(tss_page)) != PAGE_SIZE); ^ /local/xen.git/xen/include/asm/percpu.h:14:7: note: expanded from macro 'this_cpu' (*RELOC_HIDE(&per_cpu__##var, get_cpu_info()->per_cpu_offset)) ^ /local/xen.git/xen/include/xen/compiler.h:98:3: note: expanded from macro 'RELOC_HIDE' ({ unsigned long __ptr; \ ^ /local/xen.git/xen/include/xen/lib.h:26:53: note: expanded from macro 'BUILD_BUG_ON' #define BUILD_BUG_ON(cond) ((void)BUILD_BUG_ON_ZERO(cond)) ^ /local/xen.git/xen/include/xen/lib.h:25:57: note: expanded from macro 'BUILD_BUG_ON_ZERO' #define BUILD_BUG_ON_ZERO(cond) sizeof(struct { int:-!!(cond); }) ^ 1 error generated. /local/xen.git/xen/Rules.mk:202: recipe for target 'smpboot.o' failed This is obviously a compiler bug because the BUILD_BUG_ON() is not at file scope. However, it can be worked around by using a local variable. Spotted by Gitlab CI. Signed-off-by: Andrew Cooper Reviewed-by: Wei Liu --- CC: Jan Beulich CC: Wei Liu CC: Roger Pau Monné --- xen/arch/x86/smpboot.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 5057109a77..85c81c247e 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -826,9 +826,11 @@ static int setup_cpu_root_pgt(unsigned int cpu) rc = clone_mapping(idt_tables[cpu], rpt); if ( !rc ) { - BUILD_BUG_ON(sizeof(this_cpu(tss_page)) != PAGE_SIZE); + struct tss_page *this_tss = &per_cpu(tss_page, cpu); - rc = clone_mapping(&per_cpu(tss_page, cpu).tss, rpt); + BUILD_BUG_ON(sizeof(*this_tss) != PAGE_SIZE); + + rc = clone_mapping(&this_tss->tss, rpt); } if ( !rc ) rc = clone_mapping((void *)per_cpu(stubs.addr, cpu), rpt);