[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ad023c34-9a08-7d61-22de-911c4e8760ba@redhat.com>
Date: Wed, 4 Mar 2020 19:19:58 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Peter Xu <peterx@...hat.com>, linmiaohe <linmiaohe@...wei.com>
Cc: Sean Christopherson <sean.j.christopherson@...el.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kvm@...r.kernel.org" <kvm@...r.kernel.org>
Subject: Re: [PATCH] KVM: X86: Avoid explictly fetch instruction in
x86_decode_insn()
On 04/03/20 16:32, Peter Xu wrote:
>> Looks good, thanks. But it seems we should also take care of the comment in __do_insn_fetch_bytes(), as we do not
>> load instruction at the beginning of x86_decode_insn() now, which may be misleading:
>> /*
>> * One instruction can only straddle two pages,
>> * and one has been loaded at the beginning of
>> * x86_decode_insn. So, if not enough bytes
>> * still, we must have hit the 15-byte boundary.
>> */
>> if (unlikely(size < op_size))
>> return emulate_gp(ctxt, 0);
> Right, thanks for spotting that (even if the patch to be dropped :).
>
> I guess not only the comment, but the check might even fail if we
> apply the patch. Because when the fetch is the 1st attempt and
> unluckily that acrosses one page boundary (because we'll only fetch
> until either 15 bytes or the page boundary), so that single fetch
> could be smaller than op_size provided.
Right, priming the decode cache with one byte from the current page
cannot fail, and then we know that the next call must be at the
beginning of the next page.
Paolo
Powered by blists - more mailing lists