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=-9.8 required=3.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 C202EC433E0 for ; Tue, 4 Aug 2020 08:37: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 B78312076C for ; Tue, 4 Aug 2020 08:37:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="oXCdsQSi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B78312076C Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2sRl-0005yU-0L; Tue, 04 Aug 2020 08:37:21 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1k2sRj-0005yO-HX for xen-devel@lists.xenproject.org; Tue, 04 Aug 2020 08:37:19 +0000 X-Inumbo-ID: b485878a-d62d-11ea-9139-bc764e2007e4 Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id b485878a-d62d-11ea-9139-bc764e2007e4; Tue, 04 Aug 2020 08:37:18 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id g8so1883342wmk.3 for ; Tue, 04 Aug 2020 01:37:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:reply-to:to:cc:references:in-reply-to:subject:date:message-id :mime-version:content-transfer-encoding:content-language :thread-index; bh=/nPyjZI9KV5I3szUDlWxSRO5+QFYlS+dHOy2SDtIKYI=; b=oXCdsQSipocZ1Yj1Isdzk6UckuRU8rqJ8m72XxMh7ClA1lkM7ZZ/YtrcvF+wSV2JA9 tfvYAPBB3QCV1swMVvJcTmH4pzwPi3u1IL57yvrfuyBPhK7Atgx9l2DQCs5+67gy+yax MQqyOHDHEHyP1Eb1GfsYWjNqYl2rwQaBKpCdoxmLIv5Fy+RZ56CHnEnlY3EIa9nYuG0j xMISVEuZSlfzMjwK0R2+Vw19VyTukis4CZWYA9LTofVUwOEhYSFqTV129ahtxQoBe+dZ hOPA0SdI8aPTbYTO6vGyI766ZsiKzSXkuz3KjohPfirrSRvh7nb3Wnbgq//oIVc5jUbt k0Eg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:reply-to:to:cc:references:in-reply-to :subject:date:message-id:mime-version:content-transfer-encoding :content-language:thread-index; bh=/nPyjZI9KV5I3szUDlWxSRO5+QFYlS+dHOy2SDtIKYI=; b=Rib+dFfvnb0S2/y8IZcwr0bTOvyzYD7fOg7Hra/HkqXXPqOiFeftsmTbcYE0JF1Dzp 1oomeHohc0uVi2hXXuYk3t4QanDPM+/84lbfGUDPDdz75YSatschpnitE6bnCB1LukRs arHaUF7ZSnPfNN2rKpumqi+iL2yoEoW51U60T5cZqKT2WXhr/rdjDJwotmayyWHskBkr UJZT/7rQR6djZ7R3aIazG9jS5Z30qYEaywHNfuMLcZK2l1pvpjEOpjfK/nsFPXGaMfSe ySxOoPNwHm9r/Dqyca4nMRtNAyJFuOf1dzKVmXDH9VIUmvobL8xdNC4QYDPuB3Y4Kn5y eZHg== X-Gm-Message-State: AOAM533XFfAchNv325hOqUvYoLP+sbXZIBnkAvSjY905JvV/uhXbkqkH lF2VPvGa7yZdWW7RX4L+PG8= X-Google-Smtp-Source: ABdhPJzDapD/UdsRWGR4kmZkbCsJ5WPWtzEotAYMzUckkcs3AVBwHialxx4/CVNRuy1BJy6inh5O0Q== X-Received: by 2002:a1c:80c1:: with SMTP id b184mr3197422wmd.121.1596530237540; Tue, 04 Aug 2020 01:37:17 -0700 (PDT) Received: from CBGR90WXYV0 ([2a00:23c5:5785:9a01:ad9a:ab78:5748:a7ec]) by smtp.gmail.com with ESMTPSA id r22sm3644644wmh.45.2020.08.04.01.37.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 04 Aug 2020 01:37:17 -0700 (PDT) From: Paul Durrant X-Google-Original-From: "Paul Durrant" To: =?utf-8?Q?'Philippe_Mathieu-Daud=C3=A9'?= , References: <20200804074930.13104-1-philmd@redhat.com> <20200804074930.13104-2-philmd@redhat.com> <001201d66a34$e82ec070$b88c4150$@xen.org> <56c70b44-2d5f-44fc-5d9a-535c3c5fca71@redhat.com> In-Reply-To: <56c70b44-2d5f-44fc-5d9a-535c3c5fca71@redhat.com> Subject: RE: [PATCH-for-5.1 v2 1/1] accel/xen: Fix xen_enabled() behavior on target-agnostic objects Date: Tue, 4 Aug 2020 09:37:16 +0100 Message-ID: <001301d66a3a$75ac6c90$610545b0$@xen.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 16.0 Content-Language: en-gb Thread-Index: AQM/xXTZtf+c9Zv1otz4aIX099Jj8gDx5jXAAVRtvfwA7Pf4CaY7T1ag 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: , Reply-To: paul@xen.org Cc: 'Peter Maydell' , 'Stefano Stabellini' , 'Paul Durrant' , 'Paolo Bonzini' , 'Anthony Perard' , xen-devel@lists.xenproject.org Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" > -----Original Message----- > From: Philippe Mathieu-Daud=C3=A9 > Sent: 04 August 2020 09:35 > To: paul@xen.org; qemu-devel@nongnu.org > Cc: 'Peter Maydell' ; 'Anthony Perard' = ; 'Paolo > Bonzini' ; 'Stefano Stabellini' = ; xen- > devel@lists.xenproject.org; 'Paul Durrant' > Subject: Re: [PATCH-for-5.1 v2 1/1] accel/xen: Fix xen_enabled() = behavior on target-agnostic objects >=20 > Hi Paul, >=20 > On 8/4/20 9:57 AM, Paul Durrant wrote: > >> -----Original Message----- > >> From: Philippe Mathieu-Daud=C3=A9 > >> Sent: 04 August 2020 08:50 > >> To: qemu-devel@nongnu.org > >> Cc: Peter Maydell ; Anthony Perard = ; Paolo > >> Bonzini ; Stefano Stabellini = ; xen- > >> devel@lists.xenproject.org; Paul Durrant ; Philippe = Mathieu-Daud=C3=A9 > ; > >> Paul Durrant > >> Subject: [PATCH-for-5.1 v2 1/1] accel/xen: Fix xen_enabled() = behavior on target-agnostic objects > >> > >> CONFIG_XEN is generated by configure and stored in = "config-target.h", > >> which is (obviously) only include for target-specific objects. > >> This is a problem for target-agnostic objects as CONFIG_XEN is = never > >> defined and xen_enabled() is always inlined as 'false'. > >> > >> Fix by following the KVM schema, defining CONFIG_XEN_IS_POSSIBLE > >> when we don't know to force the call of the non-inlined function, > >> returning the xen_allowed boolean. > >> > >> Fixes: da278d58a092 ("accel: Move Xen accelerator code under = accel/xen/") > >> Reported-by: Paul Durrant > >> Suggested-by: Peter Maydell > >> Signed-off-by: Philippe Mathieu-Daud=C3=A9 > >> --- > >> include/sysemu/xen.h | 18 ++++++++++++++---- > >> accel/stubs/xen-stub.c | 2 ++ > >> accel/xen/xen-all.c | 7 +------ > >> 3 files changed, 17 insertions(+), 10 deletions(-) > >> > >> diff --git a/include/sysemu/xen.h b/include/sysemu/xen.h > >> index 1ca292715e..2c2c429ea8 100644 > >> --- a/include/sysemu/xen.h > >> +++ b/include/sysemu/xen.h > >> @@ -8,9 +8,19 @@ > >> #ifndef SYSEMU_XEN_H > >> #define SYSEMU_XEN_H > >> > >> -#ifdef CONFIG_XEN > >> +#ifdef NEED_CPU_H > >> +# ifdef CONFIG_XEN > >> +# define CONFIG_XEN_IS_POSSIBLE > >> +# endif > >> +#else > >> +# define CONFIG_XEN_IS_POSSIBLE > >> +#endif > >> > >> -bool xen_enabled(void); > >> +#ifdef CONFIG_XEN_IS_POSSIBLE > >> + > >> +extern bool xen_allowed; > >> + > >> +#define xen_enabled() (xen_allowed) > > > > Can this not move ahead of the #ifdef now (since xen_allowed is = present in both xen-stub and xen- > all)? I think this is what Peter was saying in his option '(2)'. >=20 > I think I respected Peter's option '(2)', following how KVM does, this > is the case with stub, Ok, if it follows the KVM pattern then that's fine. Reviewed-by: Paul Durrant