[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/2] x86: correct is_pv_domain() when !CONFIG_PV
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- Date: Mon, 12 Apr 2021 17:40:58 +0200
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=XjlsgBhoYdU8eRzneX+I5WwcgTL5MZ/MmZsV/C1k4UA=; b=aZ2CooS2vPInuxqHBkjJq/7otyRQ2qBgQKTKXZx8Wxl6m5h6cXxDcmmEh31LQPbZNYlE7RpycM1R1Mk/iXzkdIspNb63UgZFKtJlfr/1iZLr/VzSArsCI+aPpu4knF88EtnME4CgogL5qpmFFBxWD2BY6jL/YQIxVlLtgD420MttMUDXkFRwSg2wwjXdZaIgUHuktWWLH2JqMMp2KlGgUvUrib86tTbmrri5Xc+0kVJCGmI03auFQffHXR2RQDqnjmmmLF5hhKDLRGIPSSC27UBHAUsx9x/Lp/Ydh7f3Yn6JQEf22voy+jsg6SKS/pQxrtvYFPCYlFAli2i3jq4b4A==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FIURgxl/BLBXP2FZSBcRnl436iwkYpDpVJT7jil3R26Ai5QjNipU7GBzNOKEEn2MpHSWUJVhEed17igsxY/Ya4AXhT8lrgTB0K3CJh3ruRyVEdLVLrdwoPDUoEi4h2IFioAbP288tsePRV++KprFAr45GdWuifkUaKYVVtqozgdo9uftQp28+mw1MmQ6rPNvYwAm0Qxq3CcOndP75jV1coYjWb973VwCfyjtDatkbAmkxNk5oicKTOxqUTwvCxSSdyWc9quImSSTwV/xZGdFWO+dQShMiyknAZvqVvLqWp6GDwUT2fuHeFYoSh2xW/PJsHnTurs0/slQ3cOjkWlMXw==
- Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
- Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
- Delivery-date: Mon, 12 Apr 2021 15:41:15 +0000
- Ironport-hdrordr: A9a23:peEVMKsfzbzO/716bT8S3Lr77skCEIcji2hD6mlwRA09T+WxrO rrtOgH1BPylTYaUGwhn9fFA6WbXXbA7/dOj7U5FYyJGC3ronGhIo0n14vtxDX8Bzbzn9Qz6Y 5JSII7MtH5CDFB4frSyAOzH888hPyO9661jenTpk0dNz1CQadm8gt/F0K/Gkp5WAFJCfMCZe ehz+BAoCetfmlSU9SjChA+LqX+jvDotLajWx4JABY79BKD5AnD1JfWGwWVty1uNQ9n7qwl9Q H+4m/Ez4Wl98q20xrNk1LUhq4m4+fJ7vtmKIiyhtMOKjPq4zzYKLhJf7GZpjg6rKWOxT8R4a DxiiwtNchy9H/dF1vdyXCBumnd+Q0j5HP4xViTjWGLm72AeBsBF8FDiYhFGyGpjnYIgdBm3K pHm0KfupZHZCmw+xjV2tnSWxlm0nezuHop+NRj60B3bI12Us4ykaUvuGduVLsQFiPz744qVM N0CtvH2fpQeVSGK1jEo2hG2rWXLzoONybDZnJHlt2e0jBQknw85VAf3tYjknAJ8494Y4VY5t 7DLr9jmNh1P44rRJM4IN1Ebdq8C2TLTx6JGnmVO07bGKYOPG+IjJLr/rMv5qWPdIYTxJU/3L TNOWko9VIaSgbLM4mjzZdL+hfCTCGWRjL20PxT4JB/p/nyX7zuPSqfSE0/kseprvkFa/erGc qbCdZzObvOPGHuEYFG00nVQJ9JM0QTV8UTp5I6Vju104f2A7yvktaeXOfYJbLrHzphcHj4GG E/UD/6I9gF6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+uR8upa5BfOM9G/NlY6Jpo6lSgIK8/cM3//235VAJPjX7Ht P9knX0+HR9ylpk4nsRNOVOfhJBg0sM/tReKEluDazmoM17Z+NNDSZs1qBZgmPdwgLWUxiaqqCP HMxPsprvNx4FBFoFuGDKVI/mfJJjy6xD7ItH+WteBTogwiit8LEAvjYcy1ubNXRbv6JjbIRK03 WY04eva+aKFVa7aps9aX5MjM3UpNb1LnzyRglzhl5njEhqfB2Q+H+TcYzu7FrHIAI0fkoQLyNE J/8=
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Mon, Apr 12, 2021 at 05:24:41PM +0200, Jan Beulich wrote:
> On 12.04.2021 16:49, Roger Pau Monné wrote:
> > On Mon, Apr 12, 2021 at 12:07:12PM +0200, Jan Beulich wrote:
> >> On 12.04.2021 11:34, Roger Pau Monné wrote:
> >>> On Fri, Nov 27, 2020 at 05:54:57PM +0100, Jan Beulich wrote:
> >>>> --- a/xen/include/xen/sched.h
> >>>> +++ b/xen/include/xen/sched.h
> >>>> @@ -985,7 +985,7 @@ static always_inline bool is_control_dom
> >>>>
> >>>> static always_inline bool is_pv_domain(const struct domain *d)
> >>>> {
> >>>> - return IS_ENABLED(CONFIG_PV) &&
> >>>> + return IS_ENABLED(CONFIG_X86) &&
> >>>> evaluate_nospec(!(d->options & XEN_DOMCTL_CDF_hvm));
> >>>> }
> >>>>
> >>>> @@ -1011,7 +1011,7 @@ static always_inline bool is_pv_32bit_vc
> >>>>
> >>>> static always_inline bool is_pv_64bit_domain(const struct domain *d)
> >>>> {
> >>>> - if ( !is_pv_domain(d) )
> >>>> + if ( !IS_ENABLED(CONFIG_PV) || !is_pv_domain(d) )
> >>>> return false;
> >>>
> >>> I think overall is confusing to have a domain that returns true for
> >>> is_pv_domain but false for both is_pv_{64,32}bit_domain checks.
> >>>
> >>> I know those are only the system domains, but it feels confusing and
> >>> could cause mistakes in the future IMO, as then we would have to
> >>> carefully think where to use ( is_pv_64bit_domain(d)
> >>> || is_pv_32bit_domain(d) ) vs just using is_pv_domain(d), or
> >>> IS_ENABLED(CONFIG_PV) && is_pv_domain(d)
> >>
> >> Imo it's not "then we would have to carefully think where to use ..."
> >> but instead this patch is an indication that we should have been for
> >> quite some time. For this reason (coming back to your first comment
> >> at the top) I'm not sure adding a comment _there_ is actually useful.
> >> Every use of is_pv_*() needs carefully considering which domains are
> >> really meant.
> >
> > Maybe we shouldn't have used is_pv_domain as a way to hide code from
> > the compiler and instead always provide dummy functions, as even with
> > PV support compiled out we still need some of it for system domains.
> >
> > I'm not sure I have a good proposal to make, but it seems wrong to me
> > that is_pv_domain(d) could be different than is_pv_64bit_domain(d) ||
> > is_pv_32bit_domain(d).
>
> Hmm, so we're of opposite opinions - not sure what to do. Short of
> having / introducing is_system_domain() or some such (with all the
> needed auditing) I can't see how assuming the two would mean the
> same could ever have been true. With what we have is_pv_domain() is
> legitimately true for them, and both is_pv_{32,64}bit_domain() ought
> to be false (as there's no specific bitness associated with them)
> imo _at least_ when !PV.
It's all quite ugly, but I wasn't really getting your reasoning that
system domains can be considered PV domains without a bitness.
I think we both agree that long term having is_system_domain would be
the cleanest solution, but it needs a lot of auditing. I think I would
be fine if you could add a comment somewhere noting that system
domains can be identified as PV domains without a bitness, so that
it's likely less confusing in the future.
Thanks, Roger.
|