From: Dou Liyang <douly.fnst@cn.fujitsu.com>
To: <linux-kernel@vger.kernel.org>, <x86@kernel.org>
Cc: <tglx@linutronix.de>, <mingo@kernel.org>, <ebiederm@xmission.com>,
<bhe@redhat.com>, <andy.shevchenko@gmail.com>,
Dou Liyang <douly.fnst@cn.fujitsu.com>
Subject: [PATCH v5 3/3] x86/apic: Drop the logical_smp_processor_id()
Date: Thu, 1 Mar 2018 13:59:30 +0800 [thread overview]
Message-ID: <20180301055930.2396-4-douly.fnst@cn.fujitsu.com> (raw)
In-Reply-To: <20180301055930.2396-1-douly.fnst@cn.fujitsu.com>
The logical_smp_processor_id() which is only called in setup_local_APIC()
on x86_32 system looks redundant.
Drop it, then directly use GET_APIC_LOGICAL_ID() marco and more suitable
variable name for readability
Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
---
arch/x86/include/asm/smp.h | 10 ----------
arch/x86/kernel/apic/apic.c | 10 +++++-----
2 files changed, 5 insertions(+), 15 deletions(-)
diff --git a/arch/x86/include/asm/smp.h b/arch/x86/include/asm/smp.h
index 461f53d27708..e2057780d67f 100644
--- a/arch/x86/include/asm/smp.h
+++ b/arch/x86/include/asm/smp.h
@@ -176,16 +176,6 @@ static inline int wbinvd_on_all_cpus(void)
extern unsigned disabled_cpus;
#ifdef CONFIG_X86_LOCAL_APIC
-
-#ifndef CONFIG_X86_64
-static inline int logical_smp_processor_id(void)
-{
- /* we don't want to mark this access volatile - bad code generation */
- return GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
-}
-
-#endif
-
extern int hard_smp_processor_id(void);
#else /* CONFIG_X86_LOCAL_APIC */
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 7a347d7450b6..ce2066373922 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1468,7 +1468,7 @@ static void setup_local_APIC(void)
int cpu = smp_processor_id();
unsigned int value;
#ifdef CONFIG_X86_32
- int i;
+ int logical_apicid, ldr_apicid;
#endif
@@ -1507,11 +1507,11 @@ static void setup_local_APIC(void)
* initialized during get_smp_config(), make sure it matches the
* actual value.
*/
- i = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
- WARN_ON(i != BAD_APICID && i != logical_smp_processor_id());
+ logical_apicid = early_per_cpu(x86_cpu_to_logical_apicid, cpu);
+ ldr_apicid = GET_APIC_LOGICAL_ID(apic_read(APIC_LDR));
+ WARN_ON(logical_apicid != BAD_APICID && logical_apicid != ldr_apicid);
/* always use the value from LDR */
- early_per_cpu(x86_cpu_to_logical_apicid, cpu) =
- logical_smp_processor_id();
+ early_per_cpu(x86_cpu_to_logical_apicid, cpu) = ldr_apicid;
#endif
/*
--
2.14.3
next prev parent reply other threads:[~2018-03-01 6:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-01 5:59 [PATCH v5 0/3] Make setup_local_APIC() clear Dou Liyang
2018-03-01 5:59 ` [PATCH v5 1/3] x86/apic: Move pending intr check code into it's own function Dou Liyang
2018-03-01 9:16 ` [tip:x86/apic] x86/apic: Move pending interrupt " tip-bot for Dou Liyang
2018-03-01 5:59 ` [PATCH v5 2/3] x86/apic: Replace common tools with new ones Dou Liyang
2018-03-01 9:17 ` [tip:x86/apic] x86/apic: Modernize the pending interrupt code tip-bot for Dou Liyang
2018-03-01 5:59 ` Dou Liyang [this message]
2018-03-01 9:17 ` [tip:x86/apic] x86/apic: Drop logical_smp_processor_id() inline tip-bot for Dou Liyang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180301055930.2396-4-douly.fnst@cn.fujitsu.com \
--to=douly.fnst@cn.fujitsu.com \
--cc=andy.shevchenko@gmail.com \
--cc=bhe@redhat.com \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®