[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: Jan Beulich <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- From: Andrew Cooper <Andrew.Cooper3@xxxxxxxxxx>
- Date: Mon, 10 Oct 2022 18:56:23 +0000
- Accept-language: en-GB, en-US
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.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=0jJ8k2lLFkwvMAqf2glIod6D/ZyiJxjnfdS2+UJFb8Y=; b=KL4jB7sVpOLjnvfKTIRSScOfzUQgr1Jeg5dhvHvASYaJWJpMokyAQMR/WsUSzEl1eaNDzbnkMloEerF2VtJV0rX0suL6+04EOmXzYyanQdaYRjNhY9rwhGIzfr7+lH7t7GHC1pdzrATZ6jikoIglPY6+6hqmjgV9sLftsLtE0xKTnnvhxnEuGbK9pJCAt7AKIFn/dIeje4ZSrOiGSxwdeO3CPjdVSBpdN7L0vixnbYczdOyoXkTDN7Cgd5fx++vk2Mukxw2iJ7bJdOvALDvF4YWTMZLXGv2lkpBFp/TcYj52Iap5FtVzo52zhdUHplbvINIZ3Dg5oSx2AFIOL3QwCA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hcBsX4OlYmRmNJfC3MDsJwuquJ0hGQ5HKFPUL17lWD9RBumhmu/1QSXDXorSH5IJSzcPFdqTdgGJT45+tt3ml6NRIH2KWHXaZ648YTZs+aYftsj2shMMXdlZ9KHS3t0sks+VfHqyEbEaBRoreeim6DmebMHuL5BB1UOIZ5SRiCKLy8ew0/vRv67pUK66onle7Y90lOqgS3VCC+mgnbX1R6uyGBZk6EKSN4ZiBAueQ+V7WcVX7Hg7Dhht0gFwGTQRxy8VCWKTlw0jSdO4Tbd0ePNij7Ytn8g6Zq0ZT4FGHzGuWSTOBXGXckZpR+dOSMGzpIZoIugwUb9PJ28Z7+Gmsg==
- Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=citrix.com;
- Cc: Wei Liu <wl@xxxxxxx>, Roger Pau Monne <roger.pau@xxxxxxxxxx>, Henry Wang <Henry.Wang@xxxxxxx>
- Delivery-date: Mon, 10 Oct 2022 18:56:39 +0000
- Ironport-data: A9a23:tUv4W6rp38RRpAF8iFXOrzXuyJZeBmIqZBIvgKrLsJaIsI4StFCzt garIBmBPP6IZTOmfIsnaNi+8EgGuZLUyYdrTgZlqn80RXtH95uZCYyVIHmrMnLJJKUvbq7FA +Y2MYCccZ9uHhcwgj/3b9ANeFEljfngqoLUUbKCYGYpLeNdYH9JoQp5nOIkiZJfj9G8Agec0 fv/uMSaM1K+s9JOGjt8B5mr9VU+4ZwehBtC5gZkPKgS5AeE/5UoJMl3yZ+ZfiOQrrZ8RoZWd 86bpJml82XQ+QsaC9/Nut4XpWVTH9Y+lSDX4pZnc/DKbipq/0Te4Y5iXBYoUm9Fii3hojxE4 I4lWapc6+seFvakdOw1C3G0GszlVEFM0OevzXOX6aR/w6BaGpdFLjoH4EweZOUlFuhL7W5m6 McEBxMEcDK6m++464K6F9Viqp0NFZy+VG8fkikIITDxK98DGMqGb4CUoNhS0XE3m9xEGuvYa 4wBcz1zYR/cYhpJfFAKFJY5m+TujX76G9FagAvN+exrvC6OnUoojumF3Nn9I7RmQe18mEqCq 32A1GP+GhwAb/SUyCaf82LqjejK9c/+cNJITOHirKM36LGV7m5IChEofmHlm6fnzRCeYcJVc X49/AN7+MDe82TuFLERRSaQonSJoxodUNp4CPAh5UeGza+8yxaUAC0IQyBMbPQitdQqXno62 1mRhdTrCDdz9rqPRhq16bO8vT60fy8PIgcqRSICVxpD3NDlr6k6lBeJRdFmeJNZlfXwEDD0h jyP8i43guxJidZRjvvqu1fanziru57FCBYv4RnaVX6k6QU/Y5O5Y4uv6h7Q6vMowJulc2Rtd UMsw6C2hN3ix7nU/MBRaI3hxI2U2ss=
- Ironport-hdrordr: A9a23:ehJTM67ry/cS0jTTKwPXwWuBI+orL9Y04lQ7vn2ZFiY5TiXIra qTdaogviMc0AxhI03Jmbi7Scq9qeu1z+853WBjB8bZYOCAghrlEGgC1/qp/9SEIUHDH4FmpM BdmsRFaeEYSGIK9foSgzPIXOrIouP3lpxA7N22pxgCcegpUdAY0+4TMHf4LqQCfngjOXNPLu v42iMonVqdUEVSSv7+KmgOXuDFqdGOvonhewQ6Cxku7xTLpS+06ZbheiLonys2Yndq+/MP4G LFmwv26uGIqPeg0CLR0GfV8tB/hMbh8N1eH8aB4/JlagkEyzzYJ7iJaYfy+Qzdk9vfrGrCV+ O85CvICv4DqU85uFvF5ycFlTOQiQrGoEWStGNwyUGT3fARAghKRfapzLgpDCcwoSAbza5B+b MO0GSDu5VNCxTc2Cz7+tjTThlv0lG5uHw4jIco/jViuKYlGchsRLYkjTVoOYZFGDi/5JEsEe FoAs2Z7PFKcUmCZ3ScumV02tSjUnk6Ax/DGyE5y4eo+ikTmGo8w1oTxcQZkHtF/JUhS4Nc7+ CBNqhzjrlBQsIfcKo4DuYcRsm8DHDLXHv3QSqvCEWiELtCN2PGqpbx7rlw7Oa2eIYQxJ93g5 jFWEMwjx9HR6svM7z64HRmyGG/fIzmZ0Wd9ih33ekIhpTsALz2LCaEVFci18O9vvR3OLyoZ8 qO
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHY2YUgg4gsheo4JECtz9+zXlXTaK4IAO8A
- Thread-topic: [PATCH 1/2][4.17] x86emul: further correct 64-bit mode zero count repeated string insn handling
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) 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
|