xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: "Roger Pau Monné" <roger.pau@citrix.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Wei Liu <wl@xen.org>, Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH] x86: refine guest_mode()
Date: Mon, 27 Apr 2020 16:08:59 +0200	[thread overview]
Message-ID: <40d5c1b8-b68e-1aa8-b17e-77ba9afc6529@suse.com> (raw)
In-Reply-To: <20200427095913.GN28601@Air-de-Roger>

On 27.04.2020 11:59, Roger Pau Monné wrote:
> On Mon, Apr 27, 2020 at 10:03:05AM +0200, Jan Beulich wrote:
>> --- a/xen/include/asm-x86/regs.h
>> +++ b/xen/include/asm-x86/regs.h
>> @@ -10,9 +10,10 @@
>>      /* Frame pointer must point into current CPU stack. */                    \
>>      ASSERT(diff < STACK_SIZE);                                                \
>>      /* If not a guest frame, it must be a hypervisor frame. */                \
>> -    ASSERT((diff == 0) || (r->cs == __HYPERVISOR_CS));                        \
>> +    if ( diff < PRIMARY_STACK_SIZE )                                          \
>> +        ASSERT(!diff || ((r)->cs == __HYPERVISOR_CS));                        \
> 
> Why not use:
> 
> ASSERT(diff >= PRIMARY_STACK_SIZE || !diff || ((r)->cs == __HYPERVISOR_CS));

Except for the longer (without being helpful imo) string reported if
the assertion triggers, I see not difference.

> I'm not sure I fully understand this layout, is it possible that you
> also need to account for the size of cpu_info?

Depends on how paranoid we want the checking here to be, but in going
further I wouldn't want this to become sub-page fine-grained if we
aren't first doing e.g. what I'm mentioning in the post-commit-message
remark.

Jan


  reply	other threads:[~2020-04-27 14:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-27  8:03 [PATCH] x86: refine guest_mode() Jan Beulich
2020-04-27  9:59 ` Roger Pau Monné
2020-04-27 14:08   ` Jan Beulich [this message]
2020-04-27 16:00     ` Roger Pau Monné
2020-04-27 14:35 ` Andrew Cooper
2020-04-27 15:15   ` Jan Beulich
2020-04-27 20:11     ` Andrew Cooper
2020-04-28  6:30       ` Jan Beulich
2020-05-18 14:51         ` Roger Pau Monné
2020-05-20  8:56           ` Jan Beulich
2020-05-20 15:13             ` Roger Pau Monné
2020-05-22  9:52               ` Jan Beulich
2020-05-22 10:48                 ` Roger Pau Monné
2020-05-22 12:00                   ` Jan Beulich
2020-05-26 10:56                     ` Roger Pau Monné
2020-05-26 13:55                       ` Jan Beulich
2020-05-27 15:17                         ` Roger Pau Monné

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=40d5c1b8-b68e-1aa8-b17e-77ba9afc6529@suse.com \
    --to=jbeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=roger.pau@citrix.com \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).