[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2][4.17] x86emul: further correct 64-bit mode zero count repeated string insn handling


  • To: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Wed, 19 Oct 2022 11:10:26 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=/MloKwlUFSPntwzhcL0PjnY/XkLE3GPSbgNrfJeplII=; b=OFrtm/+bttC1fctpc+PSDEQ3sjfvwckoNmGhob69fHRYw32lTm/2J9F9Xr3GKUvnUl1nqr5UtLcFBfUWN6lc4BMS/QRxdcysD9r359Chfp6TK47vRHyhf7ul7xaNNv8RJeXUDgB6YqVfYtyj10+Wi94zRak2OzeAM7U2j0lLD3jFqqTnZFbW4TToPBUR1QnEPPUhfH8yWzJh68kbPy9AAUM3pXtjbXiteWq/Zn7HxWly3DpJOBf58dji+w6Fh7KGPKvgOaEzBOROnz6Mtwy2gHa/LQHFYxMInc+5yOkk/m30aEpulcq2OT4P+AvPhtMGohcpvrSMnmU1X5WBT5tdoQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cDTVYknjCo30d6W/D4gRIUGgggo+ukK5DN0rn2eRVO9JPE8/IYbBQTnfpAXVuMjH82HpP7x/Xx0i4TzbQskY73XtBBBhyYkaoAQeWDnQQ//pqQgJ6wJ8uxmGUi7WuraKuvDyXOn+eEpfPtjAaqXoqZTeYrSz+04dXBA1I3gHaNhk9ErIYzwjED3kQrwSMdy9+/BY6aibNnVXlat0sSd/2pW3JEfSey3mKGERtuzFJIaGzhRlLEkziDo/gXdKA20kzYawWdPKsUVroucuIM8/ar8dY4YxFOLbcgSrJH8hzIW8FmkH/guoN3lrB/qLmKE1vYW0Ef1+L5evzfMKMwnxsQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 19 Oct 2022 09:10:33 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 10.10.2022 20:56, Andrew Cooper wrote:
> On 06/10/2022 14:11, Jan Beulich wrote:
>> In an entirely different context I came across Linux commit 428e3d08574b
>> ("KVM: x86: Fix zero iterations REP-string"), which points out that
>> we're still doing things wrong: For one, there's no zero-extension at
>> all on AMD. And then while RCX is zero-extended from 32 bits uniformly
>> for all string instructions on newer hardware, RSI/RDI are only for MOVS
>> and STOS on the systems I have access to. (On an old family 0xf system
>> I've further found that for REP LODS even RCX is not zero-extended.)
>>
>> Fixes: 79e996a89f69 ("x86emul: correct 64-bit mode repeated string insn 
>> handling with zero count")
>> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
>> ---
>> Partly RFC for none of this being documented anywhere (and it partly
>> being model specific); inquiry pending.
> 
> None of this surprises me.  The rep instructions have always been
> microcoded, and 0 reps is a special case which has been largely ignored
> until recently.
> 
> I wouldn't be surprised if the behaviour changes with
> MISC_ENABLE.FAST_STRINGS (given the KVM commit message)

I've tried this on a Skylake, and things don't change there when forcing
the MSR bit off.

Jan

> and I also
> wouldn't be surprised if it's different between Core and Atom too (given
> the Fam 0xf observation).
> 
> It's almost worth executing a zero-length rep stub, except that may
> potentially go very wrong in certain ecx/rcx cases.
> 
> I'm not sure how important these cases are to cover.  Given that they do
> differ between vendors and generation, and that their use in compiled
> code is not going to consider the registers live after use, is the
> complexity really worth it?
> 
> ~Andrew




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.