[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v7 2/4] x86/mm: Reject invalid cacheability in PV guests by default


  • To: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 9 Jan 2023 14:53:37 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UB+XLs3uTRl0EN98OjmZEzYQQmFrZx6LJBm6WUg9zXQ=; b=Cdi8zp/OdcgF8wqFKhiZboYamcqJ5cUUCw01XU7M8YUPEvdBPp/AZVoVSHGec+6onJWys7oteWwLFBx0FGMM+WVAm6kjEOYdoaqLHGV/uNIlOJoRmml30SYqIbr59fxkiMmLiPEoDVeBZismINScXzwu9bHVfLkmiA3EtHMEKoSqijzI7g7in9U/IpMkMV2POH8G/MeYpwjnC+YF+8Od0Uqmh+V4NZDX/gbRV9a4RNZZr/oRyU6nH/SWZW+2hxwjhhkQ3ksby4VV1OxG22ufUGRbLwcSDs/xrmDS8+aH/utmTXiXufCtpkx5RsaFtIZx3TD5s4uuuPuK0+I0fP+hqg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E0tEHTExiuTOqFnDhL6pPEkwBOcPREzl45Bmkgu3wQO0wDdZzHuHcHEqxjQhM3v9/WLp9PC5IaSek0fbuZC3gq7IzcrUHtGeZRRCtWcJIefHuD4n+Ns87ACaS6uBDZCTFi/3qAk2Js+Ff/2k5hKhmnL0WS3tAcHjucvCgnVd3X21MEhO4LDoUPsI6FOd+TWDTf/mc5L/gIz+0EQkHse01/LdmkSzwBRntC2RiKVnvvnzrV23eKdorIsiggWNQygaA8Pq9h1J6XlWXa6TU8L41gsKAUf2Z1V9X6iLWkXyX6GArDN/TeUP6/awqvmcKNV2EI9KYOmjJHz0YR69POm7Fg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Tim Deegan <tim@xxxxxxx>, xen-devel@xxxxxxxxxxxxxxxxxxxx
  • Delivery-date: Mon, 09 Jan 2023 13:53:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 07.01.2023 23:07, Demi Marie Obenour wrote:
> Setting cacheability flags that are not ones specified by Xen is a bug
> in the guest.  By default, return -EINVAL if a guests attempts to do
> this.  The invalid-cacheability= Xen command-line flag allows the
> administrator to allow such attempts or to produce

Like in v6: Unfinished sentence?

> Suggested-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
> Signed-off-by: Demi Marie Obenour <demi@xxxxxxxxxxxxxxxxxxxxxx>
> ---
> Changes since v6:
> - Make invalid-cacheability= a subflag of pv=.

While you did this, you've retained the standalone option, and documentation
also continues to describe that one instead of the new sub-option. You will
then also want to move where invalid_cacheability is defined, I think.

> @@ -1343,7 +1392,9 @@ static int promote_l1_table(struct page_info *page)
>          }
>          else
>          {
> -            switch ( ret = get_page_from_l1e(pl1e[i], d, d) )
> +            l1_pgentry_t l1e = pl1e[i];
> +
> +            switch ( ret = get_page_from_l1e(l1e, d, d) )
>              {
>              default:
>                  goto fail;

Stale (and now pointless) change?

> --- a/xen/arch/x86/pv/domain.c
> +++ b/xen/arch/x86/pv/domain.c
> @@ -28,9 +28,21 @@ static int __init cf_check parse_pv(const char *s)
>      do {
>          ss = strchr(s, ',');
>          if ( !ss )
> -            ss = strchr(s, '\0');
> -
> -        if ( (val = parse_boolean("32", s, ss)) >= 0 )
> +            ss += strlen(s);
> +        if ( !strncmp("invalid-cacheability=", s,
> +                      sizeof("invalid-cacheability=") - 1) )
> +        {
> +            const char *p = s + (sizeof("invalid-cacheability=") - 1);
> +            if (ss - p == 5 && !memcmp(p, "allow", 5))

Nit: Blank line please between declaration(s) and statement(s).

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.