xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <JBeulich@suse.com>
To: Paul Durrant <Paul.Durrant@citrix.com>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Cc: Andrew Cooper <Andrew.Cooper3@citrix.com>, Wei Liu <wl@xen.org>,
	Roger Pau Monne <roger.pau@citrix.com>
Subject: Re: [Xen-devel] [PATCH 1/6] x86emul: generalize wbinvd() hook
Date: Tue, 2 Jul 2019 10:50:02 +0000	[thread overview]
Message-ID: <106174e9-de40-d41f-94d3-baaf74cd8d7d@suse.com> (raw)
In-Reply-To: <66a6b048ef29468c87138e55eeb68e10@AMSPEX02CL03.citrite.net>

On 02.07.2019 12:22, Paul Durrant wrote:
>> From: Jan Beulich <JBeulich@suse.com>
>> Sent: 01 July 2019 12:56
>>
>> @@ -2149,10 +2147,65 @@ static int hvmemul_write_msr(
>>        return rc;
>>    }
>>
>> -static int hvmemul_wbinvd(
>> +static int hvmemul_cache_op(
>> +    enum x86emul_cache_op op,
>> +    enum x86_segment seg,
>> +    unsigned long offset,
>>        struct x86_emulate_ctxt *ctxt)
>>    {
>> -    alternative_vcall(hvm_funcs.wbinvd_intercept);
>> +    struct hvm_emulate_ctxt *hvmemul_ctxt =
>> +        container_of(ctxt, struct hvm_emulate_ctxt, ctxt);
>> +    unsigned long addr, reps = 1;
>> +    uint32_t pfec = PFEC_page_present;
>> +    int rc;
>> +    void *mapping;
>> +
>> +    if ( !cache_flush_permitted(current->domain) )
>> +        return X86EMUL_OKAY;
>> +
>> +    switch ( op )
>> +    {
>> +    case x86emul_clflush:
>> +    case x86emul_clflushopt:
>> +    case x86emul_clwb:
>> +        ASSERT(!is_x86_system_segment(seg));
>> +
>> +        rc = hvmemul_virtual_to_linear(seg, offset, 0, &reps,
>> +                                       hvm_access_read, hvmemul_ctxt, &addr);
>> +        if ( rc != X86EMUL_OKAY )
>> +            break;
>> +
>> +        if ( hvmemul_ctxt->seg_reg[x86_seg_ss].dpl == 3 )
>> +            pfec |= PFEC_user_mode;
>> +
>> +        mapping = hvmemul_map_linear_addr(addr, 0, pfec, hvmemul_ctxt,
>> +                                          current->arch.hvm.data_cache);
>> +        if ( mapping == ERR_PTR(~X86EMUL_EXCEPTION) )
>> +            return X86EMUL_EXCEPTION;

This return ...

>> +        if ( IS_ERR_OR_NULL(mapping) )
>> +            break;
>> +
>> +        if ( cpu_has_clflush )
>> +        {
>> +            if ( op == x86emul_clwb && cpu_has_clwb )
>> +                clwb(mapping);
>> +            else if ( op == x86emul_clflushopt && cpu_has_clflushopt )
>> +                clflushopt(mapping);
>> +            else
>> +                clflush(mapping);
>> +
>> +            hvmemul_unmap_linear_addr(mapping, addr, 0, hvmemul_ctxt);
>> +            break;
>> +        }
>> +
>> +        hvmemul_unmap_linear_addr(mapping, addr, 0, hvmemul_ctxt);
> 
> Since the mapping is ditched here, why bother getting one at all in the
> !cpu_has_clflush case? Are you trying to flush out an error condition> that was previously missed?

... is what I'm after: We want exception behavior to be correct.

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

  reply	other threads:[~2019-07-02 10:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-01 11:47 [Xen-devel] [PATCH 0/6] x86emul: further work Jan Beulich
2019-07-01 11:56 ` [Xen-devel] [PATCH 1/6] x86emul: generalize wbinvd() hook Jan Beulich
2019-07-02 10:22   ` Paul Durrant
2019-07-02 10:50     ` Jan Beulich [this message]
2019-07-02 10:53       ` Paul Durrant
2019-08-27 10:44   ` Andrew Cooper
2019-08-27 12:51     ` Andrew Cooper
2019-08-27 18:47     ` Andrew Cooper
2019-09-02 11:10   ` [Xen-devel] Ping: " Jan Beulich
2019-09-02 12:04     ` Paul Durrant
2019-07-01 11:56 ` [Xen-devel] [PATCH 2/6] x86emul: support WBNOINVD Jan Beulich
2019-07-02 10:38   ` Paul Durrant
2019-08-27 14:47   ` Andrew Cooper
2019-08-27 15:08     ` Jan Beulich
2019-08-27 16:45       ` Andrew Cooper
2019-08-28 11:42         ` Andrew Cooper
2019-07-01 11:56 ` [Xen-devel] [PATCH 3/6] x86emul: generalize invlpg() hook Jan Beulich
2019-07-02 10:47   ` Paul Durrant
2019-08-27 14:55   ` Andrew Cooper
2019-07-01 11:57 ` [Xen-devel] [PATCH 4/6] x86: move INVPCID_TYPE_* to x86-defns.h Jan Beulich
2019-07-02 10:49   ` Paul Durrant
2019-08-27 14:57   ` Andrew Cooper
2019-07-01 11:57 ` [Xen-devel] [PATCH 5/6] x86emul: support INVPCID Jan Beulich
2019-07-02 12:54   ` Paul Durrant
2019-08-27 15:31   ` Andrew Cooper
2019-08-27 15:53     ` Jan Beulich
2019-08-27 17:27       ` Andrew Cooper
2019-08-28  7:14         ` Jan Beulich
2019-08-28 11:33           ` Andrew Cooper
2019-07-01 11:58 ` [Xen-devel] [PATCH 6/6] x86emul: support MOVDIR{I,64B} insns Jan Beulich
2019-08-27 16:04   ` Andrew Cooper
2019-08-28  6:26     ` Jan Beulich
2019-08-28 11:51       ` Andrew Cooper
2019-08-28 12:19         ` Jan Beulich
2019-08-15 14:24 ` [Xen-devel] [PATCH 0/6] x86emul: further work Andrew Cooper
2019-08-27  8:37   ` 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=106174e9-de40-d41f-94d3-baaf74cd8d7d@suse.com \
    --to=jbeulich@suse.com \
    --cc=Andrew.Cooper3@citrix.com \
    --cc=Paul.Durrant@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).