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

[PATCH v2 3/4] x86/APIC: skip unnecessary parts of __setup_APIC_LVTT()


  • To: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Jan Beulich <jbeulich@xxxxxxxx>
  • Date: Mon, 24 Jan 2022 09:27:20 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; 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=O+QV9f4zvS046E/T2Qkac91dJy0u0hz2Q9q4aDSre0U=; b=V9d9w6t7xoQ+ElksITgGs/TMhq6hGDXGB2i/t+3P86OfJEz/CeW1cj+YBZ+segw2X3vsMZI7PthV46/dGjTJREawEjH5w9f/gFKpTe40Iih43ltRPAiNP4o5wnBdf7CnqbvQFJz61gE8yf1cNYy3jw372dd5UrLs8OfnzdRtZJmcLyu+R5zqME3sJG7FDcGnNY1LM9OKpbc4I2Tu8UuWKL/kOK4qKrj2/6qFOsILFbZxFU+uUaEwHuU8ho1uGeuppBclOSo8xv20dQ+ilSabnDF93pc1+rg6pLwdtKBmk8jkAWhfoN1bq/0GTCKbxMJDadZVyVOmBsDrhd+BNLTUaQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jPF3fsv677gRFuI+4lcPe0QcHd1jGlmbuSV0l8k7Xhk6kPAxoswPpzK3btFfUJmfi+J9yzmjJs0qmTSfswnD0ohXE2dAv2zREWOkuIs7TEsi65EtW1eRefC1NsH9JBfw0UFbnlWBLGv7KJpbf5+7Jtb3LoipQUU9dsMM2Cyo+dwROZXBYKXLLBr/a9Q4pIQYmPOO6mHIlD1U/2FztA0xyJxKm0lTU1DdnuZ9lsG04HURlzN0afiMFGRnaYuebb34bBd7Iugnz7VPADyUzfow4rWw6nk+YQwWZAlcfw05coYM5PU7bcdIOs0uhAK7EUHONiORluRvxADFhYqGkrndqQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=suse.com;
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 24 Jan 2022 08:27:24 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

In TDT mode there's no point writing TDCR or TMICT, while outside of
that mode there's no need for the MFENCE.

No change intended to overall functioning.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---
v2: New.

--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -1059,24 +1059,25 @@ static void __setup_APIC_LVTT(unsigned i
 {
     unsigned int lvtt_value, tmp_value;
 
-    /* NB. Xen uses local APIC timer in one-shot mode. */
-    lvtt_value = /*APIC_TIMER_MODE_PERIODIC |*/ LOCAL_TIMER_VECTOR;
-
     if ( tdt_enabled )
     {
-        lvtt_value &= (~APIC_TIMER_MODE_MASK);
-        lvtt_value |= APIC_TIMER_MODE_TSC_DEADLINE;
+        lvtt_value = APIC_TIMER_MODE_TSC_DEADLINE | LOCAL_TIMER_VECTOR;
+        apic_write(APIC_LVTT, lvtt_value);
+
+        /*
+         * See Intel SDM: TSC-Deadline Mode chapter. In xAPIC mode,
+         * writing to the APIC LVTT and TSC_DEADLINE MSR isn't serialized.
+         * According to Intel, MFENCE can do the serialization here.
+         */
+        asm volatile( "mfence" : : : "memory" );
+
+        return;
     }
 
+    /* NB. Xen uses local APIC timer in one-shot mode. */
+    lvtt_value = /*APIC_TIMER_MODE_PERIODIC |*/ LOCAL_TIMER_VECTOR;
     apic_write(APIC_LVTT, lvtt_value);
 
-    /*
-     * See Intel SDM: TSC-Deadline Mode chapter. In xAPIC mode,
-     * writing to the APIC LVTT and TSC_DEADLINE MSR isn't serialized.
-     * According to Intel, MFENCE can do the serialization here.
-     */
-    asm volatile( "mfence" : : : "memory" );
-
     tmp_value = apic_read(APIC_TDCR);
     apic_write(APIC_TDCR, tmp_value | APIC_TDR_DIV_1);
 




 


Rackspace

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