Skip to contentSkip to conversation

ACPI: scan: substitute empty_zero_page with helper ZERO_PAGE(0)

PATCH Applied Giulio Benetti 5 participants 11 messages Oct 18, 2022 – Nov 3, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 ACPI: scan: substitute empty_zero_page with helper ZERO_PAGE(0)

Not all zero page implementations use empty_zero_page global pointer so let's substitute empty_zero_page occurence with helper ZERO_PAGE(0).

---
 drivers/acpi/scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/scan.c +1 -1
index 558664d169fc..4d2d274cc8ad 100644
@@ -30,7 +30,7 @@ extern struct acpi_device *acpi_root;
 #define ACPI_BUS_HID			"LNXSYBUS"
 #define ACPI_BUS_DEVICE_NAME		"System Bus"
 
-#define INVALID_ACPI_HANDLE	((acpi_handle)empty_zero_page)
+#define INVALID_ACPI_HANDLE	((acpi_handle)ZERO_PAGE(0))
 
 static const char *dummy_hid = "device";
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/3 spi: fsl-cpm: substitute empty_zero_page with helper ZERO_PAGE(0)

Not all zero page implementations use empty_zero_page global pointer so let's substitute empty_zero_page occurence with helper ZERO_PAGE(0).

---
 drivers/spi/spi-fsl-cpm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-fsl-cpm.c +1 -1
index ee905880769e..17a44d4f5021 100644
@@ -333,7 +333,7 @@ int fsl_spi_cpm_init(struct mpc8xxx_spi *mspi)
 		goto err_bds;
 	}
 
-	mspi->dma_dummy_tx = dma_map_single(dev, empty_zero_page, PAGE_SIZE,
+	mspi->dma_dummy_tx = dma_map_single(dev, ZERO_PAGE(0), PAGE_SIZE,
 					    DMA_TO_DEVICE);
 	if (dma_mapping_error(dev, mspi->dma_dummy_tx)) {
 		dev_err(dev, "unable to map dummy tx buffer\n");
Signature · 1 line
2.34.1
#2 lore raw

PATCH 3/3 raid: substitute empty_zero_page with helper ZERO_PAGE(0)

In reply to Giulio Benetti

Not all zero page implementations use empty_zero_page global pointer so let's substitute empty_zero_page occurence with helper ZERO_PAGE(0).

---
 include/linux/raid/pq.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/raid/pq.h +1 -1
index d6e5a1feb947..2dd46f4c7318 100644
@@ -17,7 +17,7 @@
 /* We need a pre-zeroed page... if we don't want to use the kernel-provided
    one define it here */
 #if RAID6_USE_EMPTY_ZERO_PAGE
-# define raid6_empty_zero_page empty_zero_page
+# define raid6_empty_zero_page ZERO_PAGE(0)
 #else
 extern const char raid6_empty_zero_page[PAGE_SIZE];
 #endif
Signature · 1 line
2.34.1
#3 lore raw

Re: [PATCH 3/3] raid: substitute empty_zero_page with helper ZERO_PAGE(0)

include/linux/raid/pq.h line 22

Quoted 5 lines · Giulio Benetti

#if RAID6_USE_EMPTY_ZERO_PAGE

include/linux/raid/pq.h +1 -1
-# define raid6_empty_zero_page empty_zero_page
+# define raid6_empty_zero_page ZERO_PAGE(0)
 #else
 extern const char raid6_empty_zero_page[PAGE_SIZE];

RAID6_USE_EMPTY_ZERO_PAGE is never set to a non-zero value. So this is dead code and we can just remove all code related to the RAID6_USE_EMPTY_ZERO_PAGE case.

#4 lore raw

Re: [PATCH 3/3] raid: substitute empty_zero_page with helper ZERO_PAGE(0)

Hi Cristoph,

Quoted 10 lines · Christoph Hellwig

include/linux/raid/pq.h line 22

Quoted 5 lines · Giulio Benetti
  #if RAID6_USE_EMPTY_ZERO_PAGE
include/linux/raid/pq.h +1 -1
-# define raid6_empty_zero_page empty_zero_page
+# define raid6_empty_zero_page ZERO_PAGE(0)
  #else
  extern const char raid6_empty_zero_page[PAGE_SIZE];

RAID6_USE_EMPTY_ZERO_PAGE is never set to a non-zero value. So this is dead code and we can just remove all code related to the RAID6_USE_EMPTY_ZERO_PAGE case.

thank you for taking a look.
Should I send a patch for removing the code in this v2 patchset?

Best regards

Signature · 2 lines
Giulio Benetti
CEO/CTO@Benetti Engineering sas
#5 lore raw

PATCH 1/1 lib/raid6: drop RAID6_USE_EMPTY_ZERO_PAGE

In reply to Christoph Hellwig

RAID6_USE_EMPTY_ZERO_PAGE is unused and hardcoded to 0, so let's drop it.

---
 include/linux/raid/pq.h | 8 --------
 lib/raid6/algos.c       | 2 --
 2 files changed, 10 deletions(-)
include/linux/raid/pq.h +0 -8
index d6e5a1feb947..f29aaaf2eb21 100644
@@ -10,17 +10,9 @@
 
 #ifdef __KERNEL__
 
-/* Set to 1 to use kernel-wide empty_zero_page */
-#define RAID6_USE_EMPTY_ZERO_PAGE 0
 #include <linux/blkdev.h>
 
-/* We need a pre-zeroed page... if we don't want to use the kernel-provided
-   one define it here */
-#if RAID6_USE_EMPTY_ZERO_PAGE
-# define raid6_empty_zero_page empty_zero_page
-#else
 extern const char raid6_empty_zero_page[PAGE_SIZE];
-#endif
 
 #else /* ! __KERNEL__ */
 /* Used for testing in user space */
lib/raid6/algos.c +0 -2
index 39b74221f4a7..a22a05c9af8a 100644
@@ -18,12 +18,10 @@
 #else
 #include <linux/module.h>
 #include <linux/gfp.h>
-#if !RAID6_USE_EMPTY_ZERO_PAGE
 /* In .bss so it's zeroed */
 const char raid6_empty_zero_page[PAGE_SIZE] __attribute__((aligned(256)));
 EXPORT_SYMBOL(raid6_empty_zero_page);
 #endif
-#endif
 
 struct raid6_calls raid6_call;
 EXPORT_SYMBOL_GPL(raid6_call);
Signature · 1 line
2.34.1
maintainer Applied
#7 lore raw

Re: [PATCH] lib/raid6: drop RAID6_USE_EMPTY_ZERO_PAGE

Quoted 7 lines · Christoph Hellwig
Quoted 1 line · Giulio Benetti

RAID6_USE_EMPTY_ZERO_PAGE is unused and hardcoded to 0, so let's drop it.

Looks good:

Applied to md-next. Thanks!

Song

#8 lore raw

Re: [PATCH 3/3] raid: substitute empty_zero_page with helper ZERO_PAGE(0)

In reply to Christoph Hellwig

Hi Christoph, All,

Quoted 10 lines · Christoph Hellwig

include/linux/raid/pq.h line 22

Quoted 5 lines · Giulio Benetti
  #if RAID6_USE_EMPTY_ZERO_PAGE
include/linux/raid/pq.h +1 -1
-# define raid6_empty_zero_page empty_zero_page
+# define raid6_empty_zero_page ZERO_PAGE(0)
  #else
  extern const char raid6_empty_zero_page[PAGE_SIZE];

RAID6_USE_EMPTY_ZERO_PAGE is never set to a non-zero value. So this is dead code and we can just remove all code related to the RAID6_USE_EMPTY_ZERO_PAGE case.

Here is a patch that removes that unused code:
https://lore.kernel.org/all/[email protected]/T/#u

and then makes this one useless so I ask to drop it please.

Thank you!

Best regards

Signature · 2 lines
Giulio Benetti
CEO/CTO@Benetti Engineering sas
maintainer
#9 lore raw

Re: (subset) [PATCH 1/3] ACPI: scan: substitute empty_zero_page with helper ZERO_PAGE(0)

In reply to Giulio Benetti
Quoted 4 lines · Giulio Benetti

Not all zero page implementations use empty_zero_page global pointer so let's substitute empty_zero_page occurence with helper ZERO_PAGE(0).

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[2/3] spi: fsl-cpm: substitute empty_zero_page with helper ZERO_PAGE(0)

      commit: 3be6acda8241352c57d47b4d7d9968cadcb954ea

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark

maintainer Applied
#10 lore raw
In reply to Giulio Benetti
Quoted 14 lines · Giulio Benetti

Not all zero page implementations use empty_zero_page global pointer so let's substitute empty_zero_page occurence with helper ZERO_PAGE(0).

---
 drivers/acpi/scan.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/scan.c +0 -0
index 558664d169fc..4d2d274cc8ad 100644

drivers/acpi/scan.c extern struct acpi_device *acpi_root;

Quoted 9 lines
drivers/acpi/scan.c +1 -2
@@ -30,7 +30,7 @@ extern struct acpi_device *acpi_root;
 #define ACPI_BUS_HID                   "LNXSYBUS"
 #define ACPI_BUS_DEVICE_NAME           "System Bus"
 
-#define INVALID_ACPI_HANDLE    ((acpi_handle)empty_zero_page)
+#define INVALID_ACPI_HANDLE    ((acpi_handle)ZERO_PAGE(0))
 
 static const char *dummy_hid = "device";
 
--

Applied as 6.2 material, thanks!