xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>,
	Alexandru Stefan ISAILA <aisaila@bitdefender.com>
Cc: Petre Ovidiu PIRCALABU <ppircalabu@bitdefender.com>,
	"tamas@tklengyel.com" <tamas@tklengyel.com>,
	"wl@xen.org" <wl@xen.org>,
	"rcojocaru@bitdefender.com" <rcojocaru@bitdefender.com>,
	"george.dunlap@eu.citrix.com" <george.dunlap@eu.citrix.com>,
	"paul.durrant@citrix.com" <paul.durrant@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	"roger.pau@citrix.com" <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH v7] x86/emulate: Send vm_event from emulate
Date: Tue, 20 Aug 2019 21:11:22 +0100	[thread overview]
Message-ID: <7d8888b6-ae1b-d059-938e-14fb72e6f9bc@citrix.com> (raw)
In-Reply-To: <b7c16027-2f50-4011-3866-0b4904596249@suse.com>

On 30/07/2019 15:54, Jan Beulich wrote:
>> @@ -622,14 +622,22 @@ static void *hvmemul_map_linear_addr(
>>                }
>>
>>                if ( p2mt == p2m_ioreq_server )
>> -            {
>> -                err = NULL;
>>                    goto out;
>> -            }
>>
>>                ASSERT(p2mt == p2m_ram_logdirty || !p2m_is_readonly(p2mt));
>> +
>> +            if ( curr->arch.vm_event &&
>> +                 curr->arch.vm_event->send_event &&
>> +                 hvm_emulate_send_vm_event(addr, gfn, pfec) )
>> +                err = ERR_PTR(~X86EMUL_RETRY);
>>            }
>>        }
>> +    /* Check if any vm_event was sent */
>> +    if ( err )
>> +        goto out;
>>
>>        /* Entire access within a single frame? */
>>        if ( nr_frames == 1 )
> First of all I have to apologize: In earlier replies I referred
> to update_map_err(). I notice only now that this is a still
> pending change of mine, which Andrew continues to object to,
> while I continue to think it (in one form or another) is needed:
> https://lists.xenproject.org/archives/html/xen-devel/2018-09/msg01250.html
>
> Given the unpatched code, I think your change is correct, but
> quite possibly your earlier variant was, too. But since the
> unpatched code is imo wrong, I'd prefer if the VM event side
> change was put on top of the fixed code, in order to not further
> complicate the actual fix (which we may also want to backport).
>
> Andrew, as to that old pending patch, I'm afraid I haven't been
> convinced in the slightest by your argumentation, regardless of
> the actual behavior of the XTF test you've created.

So what?  You want your change taken anyway despite evidence that it is
wrong?

>  There are
> two fundamental points you've not addressed during the earlier
> discussion:
> 1) For a guest behavior should be entirely transparent as far as
> 2nd level translation goes, unless the _only_ issue results from
> it. That's because on bare hardware there simply is no 2nd level
> translation.
> 2) Somewhat related, consider the case of the guest handling the
> #PF on the second half of the access by a means which makes the
> reason for the 2nd stage "fault" go away, or not recur. In that
> case we've wrongly (i.e. at least needlessly) dealt with the 2nd
> stage "fault".

For both of these, do you actually have an example where you believe
Xen's logic currently goes wrong?  All I see, looking though the
threads, is unsubstantiated claims that the current behaviour is wrong.

> I am, btw, not convinced that the behavior as you've observed it
> is actually "correct" in the sense of "sensible".

You're entitled to the believe that this isn't sensible if you wish.

It doesn't make it relevant to the argument.  Relevant arguments would
be identifying, a bug in my XTF test, or counterexample where the CPUs
do an opposite thing, or a passage in a spec which make a statement
supporting your claim.

As far as I am concerned, it is perfectly sensible and logical
behaviour.  To complete an instruction which straddles a page boundary,
it is necessary to have both translations available in the TLB, which
requires two EPT-walks to have already completed correctly.

SDM Vol 3 28.2.3.3 is very clear on the matter.  All translations to the
ultimate physical addresses get established first (I.e. the TLB fills
complete) before any access rights get considered.  This means that
ordering of #PF and EPT misconfig/violation is complicated by their dual
nature for failures.

In reality, I think the current code in Xen will get the priority of
second and first stage access right fault inverted, but its a damn sight
closer to how the CPU behaves than the proposed patch, which would get
first staged access rights mixed up with second stage translation faults.

Having looked over everything yet again, I stand by my very first
conclusion of that change being incorrect.

~Andrew

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

  parent reply	other threads:[~2019-08-20 20:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-03 10:56 [Xen-devel] [PATCH v7] x86/emulate: Send vm_event from emulate Alexandru Stefan ISAILA
2019-07-11 17:13 ` Tamas K Lengyel
2019-07-12  1:28   ` Jan Beulich
2019-07-15  8:52     ` Alexandru Stefan ISAILA
2019-07-18 12:58 ` Jan Beulich
2019-07-19 12:34   ` Alexandru Stefan ISAILA
2019-07-19 13:18     ` Jan Beulich
2019-07-19 13:30       ` Razvan Cojocaru
2019-07-19 13:38         ` Jan Beulich
2019-07-19 14:23           ` Razvan Cojocaru
2019-07-29  8:12             ` Alexandru Stefan ISAILA
2019-07-29 11:30               ` Jan Beulich
2019-07-22  7:51       ` Alexandru Stefan ISAILA
2019-07-30 12:21         ` Alexandru Stefan ISAILA
2019-07-30 13:27           ` Jan Beulich
2019-07-30 14:12             ` Alexandru Stefan ISAILA
2019-07-30 14:54               ` Jan Beulich
2019-07-30 15:28                 ` Alexandru Stefan ISAILA
2019-08-20 20:11                 ` Andrew Cooper [this message]
2019-08-27  8:26                   ` Jan Beulich
2019-09-02 14:36                     ` Alexandru Stefan ISAILA
2019-09-02 14:59                       ` Jan Beulich
2019-07-23  8:17       ` Alexandru Stefan ISAILA

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=7d8888b6-ae1b-d059-938e-14fb72e6f9bc@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=aisaila@bitdefender.com \
    --cc=george.dunlap@eu.citrix.com \
    --cc=paul.durrant@citrix.com \
    --cc=ppircalabu@bitdefender.com \
    --cc=rcojocaru@bitdefender.com \
    --cc=roger.pau@citrix.com \
    --cc=tamas@tklengyel.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).