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.3 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,NICE_REPLY_A,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 6F0A5C433ED for ; Fri, 7 May 2021 08:34:36 +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 1B40760FDC for ; Fri, 7 May 2021 08:34:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1B40760FDC 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.123835.233667 (Exim 4.92) (envelope-from ) id 1levwI-0005CS-Gg; Fri, 07 May 2021 08:34:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 123835.233667; Fri, 07 May 2021 08:34:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1levwI-0005CL-CN; Fri, 07 May 2021 08:34:26 +0000 Received: by outflank-mailman (input) for mailman id 123835; Fri, 07 May 2021 08:34:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1levwH-0005CF-6H for xen-devel@lists.xenproject.org; Fri, 07 May 2021 08:34:25 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 10b54ca1-f322-4339-afc5-97740e4874f5; Fri, 07 May 2021 08:34:24 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id A3AD4AF59; Fri, 7 May 2021 08:34:23 +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: 10b54ca1-f322-4339-afc5-97740e4874f5 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=1620376463; 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: in-reply-to:in-reply-to:references:references; bh=K9fVSfr49FNfNZyjj3LhpqYGR4JDCqjaghMVjN6Vub0=; b=UIw1iqQG8iO7eyz8jxU5BkYKWotgwJAtO50ZHms4/RugUeWetZ2EeOFoLCk+cuJCVx8p2y dXGNNrpgxJXPMti+Bf+719ZmwJqC1gp7cqTWStnpvU1H68ae+jN0X2X8iK+cBtB8+APv7g lYmlExSGlWnRcfAfRiJih2sf0RU3BaA= Subject: Re: [PATCH] x86/shim: fix build when !PV32 To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= Cc: "xen-devel@lists.xenproject.org" , Andrew Cooper , Wei Liu References: <08ea57f0-732e-fe12-409c-5487fb493429@suse.com> From: Jan Beulich Message-ID: Date: Fri, 7 May 2021 10:34:24 +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 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 07.05.2021 10:21, Roger Pau Monné wrote: > On Fri, May 07, 2021 at 08:22:38AM +0200, Jan Beulich wrote: >> In this case compat headers don't get generated (and aren't needed). >> The changes made by 527922008bce ("x86: slim down hypercall handling >> when !PV32") also weren't quite sufficient for this case. >> >> Try to limit #ifdef-ary by introducing two "fallback" #define-s. >> >> Fixes: d23d792478db ("x86: avoid building COMPAT code when !HVM && !PV32") >> Reported-by: Andrew Cooper >> Signed-off-by: Jan Beulich >> >> --- a/xen/arch/x86/pv/shim.c >> +++ b/xen/arch/x86/pv/shim.c >> @@ -34,8 +34,6 @@ >> #include >> #include >> >> -#include >> - >> #undef virt_to_mfn >> #define virt_to_mfn(va) _mfn(__virt_to_mfn(va)) >> >> @@ -300,8 +298,10 @@ static void write_start_info(struct doma >> &si->console.domU.mfn) ) >> BUG(); >> >> +#ifdef CONFIG_PV32 >> if ( compat ) >> xlat_start_info(si, XLAT_start_info_console_domU); >> +#endif > > Would it help the compiler logic if the 'compat' local variable was > made const? No, because XLAT_start_info_console_domU is undeclared when there are no compat headers. > I'm wondering if there's a way we can force DCE from the compiler and > avoid the ifdefs around the usage of compat. The issue isn't with DCE - I believe the compiler does okay in that regard. The issue is with things simply lacking a declaration / definition. That's no different from e.g. struct fields living inside an #ifdef - all uses then need to as well, no matter whether the compiler is capable of otherwise recognizing the code as dead. Jan