Uros Bizjak
18286883e7
x86/hyperv: Use atomic_try_cmpxchg() to micro-optimize hv_nmi_unknown()
Use atomic_try_cmpxchg() instead of atomic_cmpxchg(*ptr, old, new) == old
in hv_nmi_unknown(). On x86 the CMPXCHG instruction returns success in
the ZF flag, so this change saves a compare after CMPXCHG. The generated
asm code improves from:
3e: 65 8b 15 00 00 00 00 mov %gs:0x0(%rip),%edx
45: b8 ff ff ff ff mov $0xffffffff,%eax
4a: f0 0f b1 15 00 00 00 lock cmpxchg %edx,0x0(%rip)
51: 00
52: 83 f8 ff cmp $0xffffffff,%eax
55: 0f 95 c0 setne %al
to:
3e: 65 8b 15 00 00 00 00 mov %gs:0x0(%rip),%edx
45: b8 ff ff ff ff mov $0xffffffff,%eax
4a: f0 0f b1 15 00 00 00 lock cmpxchg %edx,0x0(%rip)
51: 00
52: 0f 95 c0 setne %al
No functional change intended.
Cc: "K. Y. Srinivasan" <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Wei Liu <wei.liu@kernel.org>
Cc: Dexuan Cui <decui@microsoft.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Signed-off-by: Uros Bizjak <ubizjak@gmail.com>
Reviewed-by: Michael Kelley <mhklinux@outlook.com>
Link: https://lore.kernel.org/r/20231114170038.381634-1-ubizjak@gmail.com
Signed-off-by: Wei Liu <wei.liu@kernel.org>
Message-ID: <20231114170038.381634-1-ubizjak@gmail.com>
2023-11-22 03:47:44 +00:00
..
2023-10-27 20:36:49 +02:00
2023-09-11 10:06:22 -07:00
2023-11-22 03:47:44 +00:00
2023-10-12 11:08:58 -04:00
2023-08-30 10:10:31 -07:00
2023-10-12 20:27:16 +02:00
2022-12-15 10:37:27 -08:00
2023-08-10 14:12:48 +02:00
2022-08-15 19:17:52 +02:00
2023-07-30 14:00:32 +02:00
2021-03-08 13:19:05 +01:00
2022-10-17 16:41:06 +02:00
2023-03-21 13:35:53 +01:00
2023-08-30 10:11:16 +02:00
2023-09-22 18:58:24 +02:00
2023-08-17 17:07:09 +02:00
2022-09-26 10:13:16 -07:00
2023-08-05 08:31:41 +02:00
2022-04-29 14:37:59 -07:00
2022-11-25 13:01:55 -05:00
2023-09-07 13:52:20 -07:00
2023-08-09 11:58:20 -07:00
2023-05-18 11:56:18 -07:00
2022-10-17 16:41:05 +02:00
2022-10-17 16:41:05 +02:00
2023-05-16 06:31:04 -07:00
2023-01-11 12:45:16 +01:00
2022-08-29 12:19:25 +02:00
2022-04-19 17:14:09 -07:00
2022-10-31 20:12:50 +01:00
2023-06-20 18:38:38 -04:00
2023-06-20 18:38:38 -04:00
2023-07-10 21:38:13 -04:00
2023-05-18 11:56:16 -07:00
2023-04-14 17:31:24 +02:00
2023-05-15 13:44:50 +02:00
2023-08-07 19:20:32 +02:00
2023-08-24 21:22:40 +02:00
2023-01-31 20:09:26 +01:00
2023-10-27 20:36:49 +02:00
2023-08-17 17:07:09 +02:00
2023-08-31 12:20:12 -07:00
2022-10-17 16:41:05 +02:00
2022-10-17 16:41:05 +02:00
2023-08-09 12:00:55 -07:00
2023-08-09 11:58:34 -07:00
2021-12-08 12:25:37 +01:00
2023-01-16 17:24:56 +01:00
2023-05-08 10:58:38 +02:00
2023-08-09 11:58:19 -07:00
2022-06-24 09:48:55 +02:00
2022-03-09 12:49:44 +01:00
2023-03-30 12:58:51 -06:00
2023-09-24 11:00:13 +02:00
2022-03-09 12:49:44 +01:00
2023-08-30 10:44:46 -07:00
2023-06-05 21:11:08 +02:00
2023-06-19 16:19:10 -07:00
2021-05-21 12:36:45 +02:00
2023-04-08 13:45:38 -07:00
2023-08-31 12:20:12 -07:00
2021-05-10 07:51:38 +02:00
2023-07-10 09:52:23 +02:00
2023-08-09 11:58:20 -07:00
2023-08-05 08:31:42 +02:00
2023-08-09 12:00:55 -07:00
2023-06-05 09:57:20 +02:00
2021-03-11 19:51:49 +01:00
2023-09-19 07:04:49 +02:00
2023-07-31 17:54:27 +02:00
2020-12-14 13:45:26 -08:00
2023-05-18 11:56:18 -07:00
2022-06-20 18:01:16 +02:00
2022-04-06 13:23:09 +02:00
2023-03-08 11:48:11 -08:00
2023-08-02 15:01:51 -07:00
2023-09-19 09:18:34 -07:00
2021-12-01 00:06:43 +01:00
2023-08-02 15:01:51 -07:00
2023-06-05 09:57:20 +02:00
2023-08-03 15:37:14 -07:00
2022-07-09 13:12:32 +02:00
2023-03-23 23:18:58 +01:00
2022-12-10 10:33:11 -06:00
2022-03-28 19:38:51 -07:00
2023-01-06 04:22:34 +01:00
2023-08-09 11:58:23 -07:00
2023-09-18 09:24:15 +02:00
2021-12-08 12:25:37 +01:00
2023-10-19 18:12:08 -07:00
2023-10-19 18:12:08 -07:00
2023-09-19 09:18:34 -07:00
2023-08-02 15:01:50 -07:00
2023-08-02 15:01:50 -07:00
2023-08-02 15:01:50 -07:00
2023-10-15 12:02:02 -07:00
2023-10-15 12:02:02 -07:00
2022-02-25 09:36:05 +01:00
2023-08-17 13:24:09 +02:00
2022-05-11 14:34:28 -05:00
2023-07-11 14:12:19 -07:00
2022-09-26 19:46:16 -07:00
2023-01-12 13:06:36 +01:00
2023-10-11 14:27:37 +02:00
2021-10-25 23:02:36 -04:00
2022-05-26 22:03:52 -04:00
2023-08-31 12:20:12 -07:00
2023-10-27 20:36:57 +02:00
2023-07-14 15:17:09 -07:00
2021-09-25 13:23:28 +02:00
2022-10-03 14:03:25 -07:00
2021-09-30 21:24:07 -04:00
2023-06-27 15:05:41 -07:00
2022-12-05 11:55:18 +01:00
2021-12-08 12:25:37 +01:00
2022-04-14 14:09:43 +02:00
2023-09-06 23:49:12 +02:00
2023-08-09 11:58:17 -07:00
2023-06-26 16:32:47 -07:00