Skip to contentSkip to conversation

x86 cleanups of leftover code

PATCH Applied Ingo Molnar 2 participants 7 messages Jul 24, 2020 – Jul 25, 2020 x86

lore
Share & tools
lore
#0 lore raw

cover x86 cleanups of leftover code

Remove a couple of stray defines I noticed, with a bit of Git history archeology to make sure they won't be used in the future either.

Ingo Molnar (3):
x86/ioapic: Remove unused "IOAPIC_AUTO" define x86/tsc: Remove unused "US_SCALE" and "NS_SCALE" leftover macros x86/mm: Remove the unused mk_kernel_pgd() #define

 arch/x86/include/asm/io_apic.h    |  1 -
 arch/x86/include/asm/pgtable_64.h | 11 ++++-------
 arch/x86/include/asm/tsc.h        |  3 ---
 3 files changed, 4 insertions(+), 11 deletions(-)
Signature · 1 line
2.25.1
#3 lore raw

PATCH 2/3 x86/tsc: Remove unused "US_SCALE" and "NS_SCALE" leftover macros

Last use of them was removed 13 years ago, when the code was converted to use CYC2NS_SCALE_FACTOR:

53d517cdbaac: ("x86: scale cyc_2_nsec according to CPU frequency")

The current TSC code uses the 'struct cyc2ns_data' scaling abstraction, the old fixed scaling approach is long gone.

This cleanup also removes the 'arbitralrily' typo from the comment, so win-win. ;-)

Cc Borislav Petkov <[email protected]>
Cc Thomas Gleixner <[email protected]>
Cc Peter Zijlstra <[email protected]>
---
 arch/x86/include/asm/tsc.h | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/include/asm/tsc.h +0 -3
index 8a0c25c6bf09..b7b2624fba86 100644
@@ -7,9 +7,6 @@
 
 #include <asm/processor.h>
 
-#define NS_SCALE	10 /* 2^10, carefully chosen */
-#define US_SCALE	32 /* 2^32, arbitralrily chosen */
-
 /*
  * Standard way to access the cycle counter.
  */
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/3 x86/ioapic: Remove unused "IOAPIC_AUTO" define

In reply to Ingo Molnar

Last use was removed more than 5 years ago, in:

5ad274d41c1b: ("x86/irq: Remove unused old IOAPIC irqdomain interfaces")

Cc Borislav Petkov <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/include/asm/io_apic.h | 1 -
 1 file changed, 1 deletion(-)
arch/x86/include/asm/io_apic.h +0 -1
index fd20a2334885..a1a26f6d3aa4 100644
@@ -99,7 +99,6 @@ struct IR_IO_APIC_route_entry {
 struct irq_alloc_info;
 struct ioapic_domain_cfg;
 
-#define IOAPIC_AUTO			-1
 #define IOAPIC_EDGE			0
 #define IOAPIC_LEVEL			1
 
Signature · 1 line
2.25.1
#5 lore raw

PATCH 3/3 x86/mm: Remove the unused mk_kernel_pgd() #define

In reply to Ingo Molnar

AFAICS the last uses of directly 'making' kernel PGDs was removed 7 years ago:

8b78c21d72d9: ("x86, 64bit, mm: hibernate use generic mapping_init")

Where the explicit PGD walking loop was replaced with kernel_ident_mapping_init() calls. This was then (unnecessarily) carried over through the 5-level paging conversion.

Also clean up the 'level' comments a bit, to convey the original, meanwhile somewhat bit-rotten notion, that these are empty comment blocks with no methods to handle any of the levels except the PTE level.

Cc Dave Hansen <[email protected]>
Cc Andy Lutomirski <[email protected]>
Cc Peter Zijlstra <[email protected]>
Cc Rik van Riel <[email protected]>
Cc Borislav Petkov <[email protected]>
Cc Thomas Gleixner <[email protected]>
---
 arch/x86/include/asm/pgtable_64.h | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
arch/x86/include/asm/pgtable_64.h +4 -7
index 1b68d24dc6a0..d2af8c48ba50 100644
@@ -175,16 +175,13 @@ extern void sync_global_pgds(unsigned long start, unsigned long end);
  * and a page entry and page directory to the page they refer to.
  */
 
-/*
- * Level 4 access.
- */
-#define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
+/* PGD - Level 4 access */
 
-/* PUD - Level3 access */
+/* PUD - Level 3 access */
 
-/* PMD  - Level 2 access */
+/* PMD - Level 2 access */
 
-/* PTE - Level 1 access. */
+/* PTE - Level 1 access */
 
 /*
  * Encode and de-code a swap entry
Signature · 1 line
2.25.1
merge bot Applied
#6 lore raw

[tip: x86/cleanups] x86/mm: Remove the unused mk_kernel_pgd() #define

The following commit has been merged into the x86/cleanups branch of tip:

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     4b8e0328e56e177663645a96ea4c5c0401ecd78f
Gitweb:        https://git.kernel.org/tip/4b8e0328e56e177663645a96ea4c5c0401ecd78f
Author:        Ingo Molnar <[email protected]>
AuthorDate:    Fri, 24 Jul 2020 13:44:18 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Sat, 25 Jul 2020 12:00:57 +02:00

x86/mm: Remove the unused mk_kernel_pgd() #define

AFAICS the last uses of directly 'making' kernel PGDs was removed 7 years ago:

8b78c21d72d9: ("x86, 64bit, mm: hibernate use generic mapping_init")

Where the explicit PGD walking loop was replaced with kernel_ident_mapping_init() calls. This was then (unnecessarily) carried over through the 5-level paging conversion.

Also clean up the 'level' comments a bit, to convey the original, meanwhile somewhat bit-rotten notion, that these are empty comment blocks with no methods to handle any of the levels except the PTE level.

---
 arch/x86/include/asm/pgtable_64.h | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
arch/x86/include/asm/pgtable_64.h +4 -7
index 1b68d24..d2af8c4 100644
@@ -175,16 +175,13 @@ extern void sync_global_pgds(unsigned long start, unsigned long end);
  * and a page entry and page directory to the page they refer to.
  */
 
-/*
- * Level 4 access.
- */
-#define mk_kernel_pgd(address) __pgd((address) | _KERNPG_TABLE)
+/* PGD - Level 4 access */
 
-/* PUD - Level3 access */
+/* PUD - Level 3 access */
 
-/* PMD  - Level 2 access */
+/* PMD - Level 2 access */
 
-/* PTE - Level 1 access. */
+/* PTE - Level 1 access */
 
 /*
  * Encode and de-code a swap entry
merge bot Applied
#2 lore raw

[tip: x86/cleanups] x86/ioapic: Remove unused "IOAPIC_AUTO" define

In reply to Ingo Molnar
The following commit has been merged into the x86/cleanups branch of tip:

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     8cd591aeb1d650f79a49d8704c35a78bf18f5de9
Gitweb:        https://git.kernel.org/tip/8cd591aeb1d650f79a49d8704c35a78bf18f5de9
Author:        Ingo Molnar <[email protected]>
AuthorDate:    Fri, 24 Jul 2020 13:44:16 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Sat, 25 Jul 2020 12:00:56 +02:00

x86/ioapic: Remove unused "IOAPIC_AUTO" define

Last use was removed more than 5 years ago, in:

5ad274d41c1b: ("x86/irq: Remove unused old IOAPIC irqdomain interfaces")

---
 arch/x86/include/asm/io_apic.h | 1 -
 1 file changed, 1 deletion(-)
arch/x86/include/asm/io_apic.h +0 -1
index fd20a23..a1a26f6 100644
@@ -99,7 +99,6 @@ struct IR_IO_APIC_route_entry {
 struct irq_alloc_info;
 struct ioapic_domain_cfg;
 
-#define IOAPIC_AUTO			-1
 #define IOAPIC_EDGE			0
 #define IOAPIC_LEVEL			1
 
merge bot Applied
#4 lore raw

[tip: x86/cleanups] x86/tsc: Remove unused "US_SCALE" and "NS_SCALE" leftover macros

In reply to Ingo Molnar
The following commit has been merged into the x86/cleanups branch of tip:

The following commit has been merged into the x86/cleanups branch of tip:

Commit-ID:     161449bad5053d66f2310744ba8498158ab12c89
Gitweb:        https://git.kernel.org/tip/161449bad5053d66f2310744ba8498158ab12c89
Author:        Ingo Molnar <[email protected]>
AuthorDate:    Fri, 24 Jul 2020 13:44:17 +02:00
Committer:     Ingo Molnar <[email protected]>
CommitterDate: Sat, 25 Jul 2020 12:00:57 +02:00

x86/tsc: Remove unused "US_SCALE" and "NS_SCALE" leftover macros

Last use of them was removed 13 years ago, when the code was converted to use CYC2NS_SCALE_FACTOR:

53d517cdbaac: ("x86: scale cyc_2_nsec according to CPU frequency")

The current TSC code uses the 'struct cyc2ns_data' scaling abstraction, the old fixed scaling approach is long gone.

This cleanup also removes the 'arbitralrily' typo from the comment, so win-win. ;-)

---
 arch/x86/include/asm/tsc.h | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/include/asm/tsc.h +0 -3
index 8a0c25c..b7b2624 100644
@@ -7,9 +7,6 @@
 
 #include <asm/processor.h>
 
-#define NS_SCALE	10 /* 2^10, carefully chosen */
-#define US_SCALE	32 /* 2^32, arbitralrily chosen */
-
 /*
  * Standard way to access the cycle counter.
  */