Linux-HyperV Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH 1/1] x86/hyperv: Clarify comment on x2apic mode
@ 2020-10-26 14:52 Michael Kelley
  2020-10-26 16:29 ` Wei Liu
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Kelley @ 2020-10-26 14:52 UTC (permalink / raw)
  To: linux-kernel, tglx, peterz, kys, sthemmin, wei.liu, mingo, bp,
	x86, hpa, linux-hyperv
  Cc: mikelley

The comment about Hyper-V accessors is unclear regarding their
potential use in x2apic mode, as is the associated commit message
in e211288b72f1.  Clarify that while the architectural and
synthetic MSRs are equivalent in x2apic mode, the full set of xapic
accessors cannot be used because of register layout differences.

Fixes: e211288b72f1 ("x86/hyperv: Make vapic support x2apic mode")
Signed-off-by: Michael Kelley <mikelley@microsoft.com>
---
 arch/x86/hyperv/hv_apic.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/arch/x86/hyperv/hv_apic.c b/arch/x86/hyperv/hv_apic.c
index 40e0e32..284e736 100644
--- a/arch/x86/hyperv/hv_apic.c
+++ b/arch/x86/hyperv/hv_apic.c
@@ -273,11 +273,15 @@ void __init hv_apic_init(void)
 		pr_info("Hyper-V: Using enlightened APIC (%s mode)",
 			x2apic_enabled() ? "x2apic" : "xapic");
 		/*
-		 * With x2apic, architectural x2apic MSRs are equivalent to the
-		 * respective synthetic MSRs, so there's no need to override
-		 * the apic accessors.  The only exception is
-		 * hv_apic_eoi_write, because it benefits from lazy EOI when
-		 * available, but it works for both xapic and x2apic modes.
+		 * When in x2apic mode, don't use the Hyper-V specific APIC
+		 * accessors since the field layout in the ICR register is
+		 * different in x2apic mode. Furthermore, the architectural
+		 * x2apic MSRs function just as well as the Hyper-V
+		 * synthetic APIC MSRs, so there's no benefit in having
+		 * separate Hyper-V accessors for x2apic mode. The only
+		 * exception is hv_apic_eoi_write, because it benefits from
+		 * lazy EOI when available, but the same accessor works for
+		 * both xapic and x2apic because the field layout is the same.
 		 */
 		apic_set_eoi_write(hv_apic_eoi_write);
 		if (!x2apic_enabled()) {
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] x86/hyperv: Clarify comment on x2apic mode
  2020-10-26 14:52 [PATCH 1/1] x86/hyperv: Clarify comment on x2apic mode Michael Kelley
@ 2020-10-26 16:29 ` Wei Liu
  0 siblings, 0 replies; 2+ messages in thread
From: Wei Liu @ 2020-10-26 16:29 UTC (permalink / raw)
  To: Michael Kelley
  Cc: linux-kernel, tglx, peterz, kys, sthemmin, wei.liu, mingo, bp,
	x86, hpa, linux-hyperv

On Mon, Oct 26, 2020 at 07:52:52AM -0700, Michael Kelley wrote:
> The comment about Hyper-V accessors is unclear regarding their
> potential use in x2apic mode, as is the associated commit message
> in e211288b72f1.  Clarify that while the architectural and
> synthetic MSRs are equivalent in x2apic mode, the full set of xapic
> accessors cannot be used because of register layout differences.
> 
> Fixes: e211288b72f1 ("x86/hyperv: Make vapic support x2apic mode")
> Signed-off-by: Michael Kelley <mikelley@microsoft.com>

Applied to hyperv-fixes. Thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-26 14:52 [PATCH 1/1] x86/hyperv: Clarify comment on x2apic mode Michael Kelley
2020-10-26 16:29 ` Wei Liu

Linux-HyperV Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-hyperv/0 linux-hyperv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-hyperv linux-hyperv/ https://lore.kernel.org/linux-hyperv \
		linux-hyperv@vger.kernel.org
	public-inbox-index linux-hyperv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-hyperv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git