All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: George Dunlap <george.dunlap@eu.citrix.com>,
	Tim Deegan <tim@xen.org>, Xen-devel <xen-devel@lists.xen.org>
Subject: Re: [PATCH 3/7] x86/pagewalk: Helpers for reserved bit handling
Date: Wed, 01 Mar 2017 08:57:10 -0700	[thread overview]
Message-ID: <58B6FD66020000780013ED9F@prv-mh.provo.novell.com> (raw)
In-Reply-To: <1488204198-23948-4-git-send-email-andrew.cooper3@citrix.com>

>>> On 27.02.17 at 15:03, <andrew.cooper3@citrix.com> wrote:
> -static inline int
> -guest_supports_1G_superpages(struct vcpu *v)
> +static inline bool guest_has_pse36(const struct vcpu *v)
> +{
> +     /* No support for 2-level PV guests. */
> +    return is_pv_vcpu(v) ? 0 : paging_mode_hap(v->domain);

Considering the return type ITYM "false" instead of "0" here. But
then why use a conditional expression here at all?

    return !is_pv_vcpu(v) && paging_mode_hap(v->domain);

Furthermore there's no point in passing in a struct vcpu here -
both checked constructs are per-domain, and passing in
struct domain is also a better fit with the guest_ prefix of the
function name.

> +static inline bool guest_supports_1G_superpages(const struct vcpu *v)
>  {
>      return (GUEST_PAGING_LEVELS >= 4 && hvm_pse1gb_supported(v->domain));

Same here for vcpu vs domain.

> -static inline int
> -guest_supports_nx(struct vcpu *v)
> +static inline bool guest_supports_nx(const struct vcpu *v)
>  {
>      if ( GUEST_PAGING_LEVELS == 2 || !cpu_has_nx )
>          return 0;

The situation is different here - hvm_nx_enabled() can vary across
vCPU-s, so here it's rather the name which doesn't really fit the
purpose (should rather be guest_uses_nx() or some such).

> +static inline bool guest_l2e_rsvd_bits(const struct vcpu *v, guest_l2e_t l2e)
> +{
> +    uint64_t rsvd_bits = guest_rsvd_bits(v);
> +
> +    return ((l2e.l2 & (rsvd_bits | GUEST_L2_PAGETABLE_RSVD |
> +                       (guest_supports_superpages(v) ? 0 : _PAGE_PSE))) ||
> +            ((l2e.l2 & _PAGE_PSE) &&
> +             (l2e.l2 & ((GUEST_PAGING_LEVELS == 2 && guest_has_pse36(v))
> +                        ? (fold_pse36(rsvd_bits | (1ULL << 40)))

While one can look it up in the doc, I strongly think this 40 needs a
comment.

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-03-01 15:57 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-27 14:03 [PATCH 0/7] Fixes to pagetable handling Andrew Cooper
2017-02-27 14:03 ` [PATCH 1/7] x86/hvm: Correctly identify implicit supervisor accesses Andrew Cooper
2017-03-01 15:05   ` Jan Beulich
2017-03-02 16:14   ` Tim Deegan
2017-03-07 10:46   ` George Dunlap
2017-03-07 10:51   ` Andrew Cooper
2017-03-07 15:00   ` Paul Durrant
2017-02-27 14:03 ` [PATCH 2/7] x86/shadow: Try to correctly " Andrew Cooper
2017-03-01 15:11   ` Jan Beulich
2017-03-02 16:14   ` Tim Deegan
2017-03-07 11:26   ` George Dunlap
2017-03-07 11:55     ` Andrew Cooper
2017-02-27 14:03 ` [PATCH 3/7] x86/pagewalk: Helpers for reserved bit handling Andrew Cooper
2017-03-01 15:57   ` Jan Beulich [this message]
2017-03-02 12:23     ` Andrew Cooper
2017-03-02 14:12   ` Tim Deegan
2017-03-02 14:17     ` Andrew Cooper
2017-03-02 15:09       ` Tim Deegan
2017-03-02 15:14         ` Andrew Cooper
2017-03-02 16:15   ` Tim Deegan
2017-02-27 14:03 ` [PATCH 4/7] x86/hvm: Adjust hvm_nx_enabled() to match how Xen behaves Andrew Cooper
2017-03-01 16:00   ` Jan Beulich
2017-02-27 14:03 ` [PATCH 5/7] x86/shadow: Use the pagewalk reserved bits helpers Andrew Cooper
2017-03-01 16:03   ` Jan Beulich
2017-03-02 12:26     ` Andrew Cooper
2017-03-02 12:51       ` Jan Beulich
2017-03-02 12:56         ` Andrew Cooper
2017-03-02 13:19           ` Jan Beulich
2017-03-02 14:32             ` Andrew Cooper
2017-03-06  9:26       ` Tim Deegan
2017-03-02 14:33   ` Tim Deegan
2017-02-27 14:03 ` [PATCH 6/7] x86/pagewalk: Consistently use guest_walk_*() helpers for translation Andrew Cooper
2017-03-01 16:22   ` Jan Beulich
2017-03-01 16:33     ` Andrew Cooper
2017-03-01 16:41       ` Jan Beulich
2017-03-02 16:15   ` Tim Deegan
2017-03-06 18:25   ` George Dunlap
2017-02-27 14:03 ` [PATCH 7/7] x86/pagewalk: Re-implement the pagetable walker Andrew Cooper
2017-03-02 11:52   ` Jan Beulich
2017-03-02 12:00     ` Andrew Cooper
2017-03-02 12:54       ` Jan Beulich
2017-03-02 16:16   ` Tim Deegan
2017-03-06 18:28   ` George Dunlap
2017-03-06 18:33     ` Andrew Cooper
2017-03-06 18:39       ` George Dunlap
2017-03-07 12:57   ` George Dunlap
2017-03-01 16:24 ` [PATCH 0/7] Fixes to pagetable handling Jan Beulich
2017-03-01 16:32   ` Andrew Cooper
2017-03-06 16:42 ` [RFC XTF PATCH] Pagetable Emulation testing Andrew Cooper
2017-03-13 15:45   ` Jan Beulich
2017-03-13 17:48     ` Andrew Cooper
2017-03-14 11:17       ` Jan Beulich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=58B6FD66020000780013ED9F@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=tim@xen.org \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.