[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] x86: introduce "hot" and "cold" page copying functions
- To: Jan Beulich <jbeulich@xxxxxxxx>
- From: Jason Andryuk <jason.andryuk@xxxxxxx>
- Date: Sun, 31 Aug 2025 10:35:14 -0400
- Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=suse.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0)
- Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=7dE9DnoVnOVI1m088z1sg438Ww/eIrpKQP3iWBcN8Ow=; b=vzvLgxyHvH7mSSrXBSHd4lSxsTGrgxDGnV7Jecki6R9WyUb2jvIalHbpdQ31sr7764P17ij9n6BWTTt4Aso65t0Q4aH+NAA8nly3dWjqS95n3cFGXptnbDSScZeK3As1tQazilDwoLWAMZ4XCPpzqsm8Y7izUCrCuFnwrHQUvS+6T19k5CKEgg3GUdPzDbuKA3aPgGfTUW8DJUmLF5yBHU3FobwzYlf3wVo4BfLhv/QBNraFMu2ylrpLMsjv+JVPbFwZuL8z+04uvpbY6GxQMvBxTA7KrlPq32IQk3acu8QxyBDkp1ZCYIluT5CQQVsSXzgirYb5TjxAp6ZIKUjOSQ==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Jakm3OEYiuwN2tfru19EQi1Dtj0cuboG9YtyS9W2KDOlJ+tuEUsDvz8fkD92qHXm94jfZwxG78fNcA1giLKnmKyLN2w/IUAZA9zYncImh30lhpxjJFO66StbhCpTRawkdaCBIr9tmYa3V2t9wkLl5AZzUwqhNL0HXNqpkbcUjAjP0yXD7Oap8pPy83RcyWJnne7ktwIFc22R5sqMK22FZtP19qSp3sD0N30HmSH4iGEaBxkRLVCg8E6APxeyXzVbDzr05JigxthGyFcnORKsaiN2V0kYodSlu1xmvSh5HPlJ0EG5l/m+DsoBygh3GmIatGTXKiUT8k5DlCj7Pr023w==
- Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
- Delivery-date: Sun, 31 Aug 2025 14:35:33 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On 2025-08-29 02:29, Jan Beulich wrote:
On 28.08.2025 23:33, Jason Andryuk wrote:
On 2025-08-28 05:17, Jan Beulich wrote:
The present copy_page_sse2() is useful in case the destination page isn't
going to get touched again soon, or if we want to limit churn on the
caches. Just rename it, to fit the corresponding {clear,scrub}_page_*()
naming scheme.
For cases where latency is the most important aspect, or when it is
expected that sufficiently large parts of a destination page will get
accessed again soon after the copying, introduce a "hot" alternative.
Again use alternatives patching to select between a "legacy" and an ERMS
variant.
Don't switch any callers just yet - this will be the subject of subsequent
changes.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
Thanks.
To avoid the NOP padding (also in clear_page_hot()) we could use a double
REP prefix in the replacement code (accounting for the REX one in the code
being replaced).
Did my tool chain do it automatically?
0000000000000000 <.altinstr_replacement>:
0: b9 00 10 00 00 mov $0x1000,%ecx
5: f3 f3 a4 repz rep movsb %ds:(%rsi),%es:(%rdi)
Interesting. That looks like a bug to me, when source code merely has
rep movsb
Did you also check what copy_page_movsq (i.e. "rep movsq") expands to?
What gas version is this? With 2.45 I get
0000000000000000 <.altinstr_replacement>:
0: b9 00 10 00 00 mov $0x1000,%ecx
5: f3 a4 rep movsb (%rsi),(%rdi)
(the omission of segment indicators when there's no segment override is
indeed a change in 2.45).
Oh, sorry, I forgot I had the extra rep in when I looked at the
disassembly. It is as you show.
Sorry for the noise.
-Jason
|