* [PATCH v2 1/9] cxl: Convert "RBI" to enum
From: Ben Widawsky @ 2021-09-23 17:26 UTC (permalink / raw)
To: linux-cxl
Cc: Ben Widawsky, Andrew Donnellan, linux-pci, linuxppc-dev, iommu,
Bjorn Helgaas, David E. Box, Frederic Barrat, Lu Baolu,
David Woodhouse, Kan Liang
In-Reply-To: <20210923172647.72738-1-ben.widawsky@intel.com>
In preparation for passing around the Register Block Indicator (RBI) as
a parameter, it is desirable to convert the type to an enum so that the
interface can use a well defined type checked parameter.
As a result of this change, should future versions of the spec add
sparsely defined identifiers, it could become a problem if checking for
invalid identifiers since the code currently checks for the max
identifier. This is not an issue with current spec, and the algorithm to
obtain the register blocks will change before those possible additions
are made.
Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
---
drivers/cxl/pci.h | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/cxl/pci.h b/drivers/cxl/pci.h
index 8c1a58813816..7d3e4bf06b45 100644
--- a/drivers/cxl/pci.h
+++ b/drivers/cxl/pci.h
@@ -20,13 +20,15 @@
#define CXL_REGLOC_BIR_MASK GENMASK(2, 0)
/* Register Block Identifier (RBI) */
-#define CXL_REGLOC_RBI_MASK GENMASK(15, 8)
-#define CXL_REGLOC_RBI_EMPTY 0
-#define CXL_REGLOC_RBI_COMPONENT 1
-#define CXL_REGLOC_RBI_VIRT 2
-#define CXL_REGLOC_RBI_MEMDEV 3
-#define CXL_REGLOC_RBI_TYPES CXL_REGLOC_RBI_MEMDEV + 1
+enum cxl_regloc_type {
+ CXL_REGLOC_RBI_EMPTY = 0,
+ CXL_REGLOC_RBI_COMPONENT,
+ CXL_REGLOC_RBI_VIRT,
+ CXL_REGLOC_RBI_MEMDEV,
+ CXL_REGLOC_RBI_TYPES
+};
+#define CXL_REGLOC_RBI_MASK GENMASK(15, 8)
#define CXL_REGLOC_ADDR_MASK GENMASK(31, 16)
#endif /* __CXL_PCI_H__ */
--
2.33.0
^ permalink raw reply related
* [PATCH v2 0/9] cxl_pci refactor for reusability
From: Ben Widawsky @ 2021-09-23 17:26 UTC (permalink / raw)
To: linux-cxl
Cc: Ben Widawsky, Andrew Donnellan, linux-pci, linuxppc-dev, iommu,
Bjorn Helgaas, David E. Box, Frederic Barrat, Lu Baolu,
David Woodhouse, Kan Liang
Changes since v1 [3]:
- get_max_afu_index() updated to new interface (Dan)
- siov_find_pci_dvsec updated to new interface (Dan)
- remove unnecessary pci request/release regions with refactor (Dan)
- move @base into cxl_register_map (Dan)
- Expanded the Cc list to include other users of PCIe DVSEC. (Dan)
Three spots are not converted to use the new PCI core DVSEC helper as the
changes are non-trivial.
- find_dvsec_afu_ctrl (ocxl)
- pmt_pci_probe (David)
- intel_uncore_has_discovery_tables (Kan)
The interdiff is below. A range-diff can be generated against v1[3] if desired.
Discussion occurred partially offlist between Dan and myself. To summarize, Dan
contends that patch 4, "cxl/pci: Refactor cxl_pci_setup_regs" should either be
rewrittn, or have a precursor patch that cxl_pci will still scan all register
blocks, but only claim the specified types. While the current diff is somewhat
complex, I contend that this is unneeded churn because we can easily test this
change in our existing regression testing. It also ultimately results in a
simpler function in the cxl_port patch series when cxl_pci stops trying to map
the component register block (loop is removed entirely). A tiebreak here would
be great :-)
---
Original commit message:
Provide the ability to obtain CXL register blocks as discrete functionality.
This functionality will become useful for other CXL drivers that need access to
CXL register blocks. It is also in line with other additions to core which moves
register mapping functionality.
At the introduction of the CXL driver the only user of CXL MMIO was cxl_pci
(then known as cxl_mem). As the driver has evolved it is clear that cxl_pci will
not be the only entity that needs access to CXL MMIO. This series stops short of
moving the generalized functionality into cxl_core for the sake of getting eyes
on the important foundational bits sooner rather than later. The ultimate plan
is to move much of the code into cxl_core.
Via review of two previous patches [1] & [2] it has been suggested that the bits
which are being used for DVSEC enumeration move into PCI core. As CXL core is
soon going to require these, let's try to get the ball rolling now on making
that happen.
---
[1]: https://lore.kernel.org/linux-pci/20210913190131.xiiszmno46qie7v5@intel.com/
[2]: https://lore.kernel.org/linux-cxl/20210920225638.1729482-1-ben.widawsky@intel.com/
[3]: https://lore.kernel.org/linux-cxl/20210921220459.2437386-1-ben.widawsky@intel.com/
Ben Widawsky (9):
cxl: Convert "RBI" to enum
cxl/pci: Remove dev_dbg for unknown register blocks
cxl/pci: Remove pci request/release regions
cxl/pci: Refactor cxl_pci_setup_regs
cxl/pci: Make more use of cxl_register_map
PCI: Add pci_find_dvsec_capability to find designated VSEC
cxl/pci: Use pci core's DVSEC functionality
ocxl: Use pci core's DVSEC functionality
iommu/vt-d: Use pci core's DVSEC functionality
arch/powerpc/platforms/powernv/ocxl.c | 3 +-
drivers/cxl/cxl.h | 1 +
drivers/cxl/pci.c | 176 ++++++++++++--------------
drivers/cxl/pci.h | 14 +-
drivers/iommu/intel/iommu.c | 15 +--
drivers/misc/ocxl/config.c | 13 +-
drivers/pci/pci.c | 32 +++++
include/linux/pci.h | 1 +
8 files changed, 127 insertions(+), 128 deletions(-)
Interdiff against v1:
diff --git a/arch/powerpc/platforms/powernv/ocxl.c b/arch/powerpc/platforms/powernv/ocxl.c
index 9105efcf242a..28b009b46464 100644
--- a/arch/powerpc/platforms/powernv/ocxl.c
+++ b/arch/powerpc/platforms/powernv/ocxl.c
@@ -107,7 +107,8 @@ static int get_max_afu_index(struct pci_dev *dev, int *afu_idx)
int pos;
u32 val;
- pos = find_dvsec_from_pos(dev, OCXL_DVSEC_FUNC_ID, 0);
+ pos = pci_find_dvsec_capability(dev, PCI_VENDOR_ID_IBM,
+ OCXL_DVSEC_FUNC_ID);
if (!pos)
return -ESRCH;
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index 7d6b011dd963..3b128ce71564 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -140,6 +140,7 @@ struct cxl_device_reg_map {
};
struct cxl_register_map {
+ void __iomem *base;
u64 block_offset;
u8 reg_type;
u8 barno;
diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index 040379f727ad..79d4d9b16d83 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -306,9 +306,8 @@ static int cxl_pci_setup_mailbox(struct cxl_mem *cxlm)
return 0;
}
-static void __iomem *cxl_pci_map_regblock(struct cxl_mem *cxlm, struct cxl_register_map *map)
+static int cxl_pci_map_regblock(struct cxl_mem *cxlm, struct cxl_register_map *map)
{
- void __iomem *addr;
int bar = map->barno;
struct device *dev = cxlm->dev;
struct pci_dev *pdev = to_pci_dev(dev);
@@ -318,24 +317,25 @@ static void __iomem *cxl_pci_map_regblock(struct cxl_mem *cxlm, struct cxl_regis
if (pci_resource_len(pdev, bar) < offset) {
dev_err(dev, "BAR%d: %pr: too small (offset: %#llx)\n", bar,
&pdev->resource[bar], (unsigned long long)offset);
- return IOMEM_ERR_PTR(-ENXIO);
+ return -ENXIO;
}
- addr = pci_iomap(pdev, bar, 0);
- if (!addr) {
+ map->base = pci_iomap(pdev, bar, 0);
+ if (!map->base) {
dev_err(dev, "failed to map registers\n");
- return addr;
+ return PTR_ERR(map->base);
}
dev_dbg(dev, "Mapped CXL Memory Device resource bar %u @ %#llx\n",
bar, offset);
- return addr;
+ return 0;
}
-static void cxl_pci_unmap_regblock(struct cxl_mem *cxlm, void __iomem *base)
+static void cxl_pci_unmap_regblock(struct cxl_mem *cxlm, struct cxl_register_map *map)
{
- pci_iounmap(to_pci_dev(cxlm->dev), base);
+ pci_iounmap(to_pci_dev(cxlm->dev), map->base);
+ map->base = 0;
}
static int cxl_pci_dvsec(struct pci_dev *pdev, int dvsec)
@@ -343,10 +343,9 @@ static int cxl_pci_dvsec(struct pci_dev *pdev, int dvsec)
return pci_find_dvsec_capability(pdev, PCI_DVSEC_VENDOR_ID_CXL, dvsec);
}
-static int cxl_probe_regs(struct cxl_mem *cxlm, void __iomem *base,
- struct cxl_register_map *map)
+static int cxl_probe_regs(struct cxl_mem *cxlm, struct cxl_register_map *map)
{
- void __iomem *offset = base + map->block_offset;
+ void __iomem *base = map->base + map->block_offset;
struct cxl_component_reg_map *comp_map;
struct cxl_device_reg_map *dev_map;
struct device *dev = cxlm->dev;
@@ -354,7 +353,7 @@ static int cxl_probe_regs(struct cxl_mem *cxlm, void __iomem *base,
switch (map->reg_type) {
case CXL_REGLOC_RBI_COMPONENT:
comp_map = &map->component_map;
- cxl_probe_component_regs(dev, offset, comp_map);
+ cxl_probe_component_regs(dev, base, comp_map);
if (!comp_map->hdm_decoder.valid) {
dev_err(dev, "HDM decoder registers not found\n");
return -ENXIO;
@@ -364,7 +363,7 @@ static int cxl_probe_regs(struct cxl_mem *cxlm, void __iomem *base,
break;
case CXL_REGLOC_RBI_MEMDEV:
dev_map = &map->device_map;
- cxl_probe_device_regs(dev, offset, dev_map);
+ cxl_probe_device_regs(dev, base, dev_map);
if (!dev_map->status.valid || !dev_map->mbox.valid ||
!dev_map->memdev.valid) {
dev_err(dev, "registers not found: %s%s%s\n",
@@ -418,8 +417,6 @@ static int find_register_block(struct pci_dev *pdev, enum cxl_regloc_type type,
int regloc, i, rc = -ENODEV;
u32 regloc_size, regblocks;
- memset(map, 0, sizeof(*map));
-
regloc = cxl_pci_dvsec(pdev, PCI_DVSEC_ID_CXL_REGLOC_DVSEC_ID);
if (!regloc)
return -ENXIO;
@@ -450,8 +447,6 @@ static int find_register_block(struct pci_dev *pdev, enum cxl_regloc_type type,
}
}
- pci_release_mem_regions(pdev);
-
return rc;
}
@@ -473,12 +468,8 @@ static int cxl_pci_setup_regs(struct cxl_mem *cxlm)
const enum cxl_regloc_type types[] = { CXL_REGLOC_RBI_MEMDEV,
CXL_REGLOC_RBI_COMPONENT };
- if (pci_request_mem_regions(pdev, pci_name(pdev)))
- return -ENODEV;
-
for (i = 0; i < ARRAY_SIZE(types); i++) {
struct cxl_register_map map;
- void __iomem *base;
rc = find_register_block(pdev, types[i], &map);
if (rc) {
@@ -489,14 +480,12 @@ static int cxl_pci_setup_regs(struct cxl_mem *cxlm)
break;
}
- base = cxl_pci_map_regblock(cxlm, &map);
- if (!base) {
- rc = -ENOMEM;
+ rc = cxl_pci_map_regblock(cxlm, &map);
+ if (rc)
break;
- }
- rc = cxl_probe_regs(cxlm, base, &map);
- cxl_pci_unmap_regblock(cxlm, base);
+ rc = cxl_probe_regs(cxlm, &map);
+ cxl_pci_unmap_regblock(cxlm, &map);
if (rc)
break;
@@ -507,7 +496,6 @@ static int cxl_pci_setup_regs(struct cxl_mem *cxlm)
}
}
- pci_release_mem_regions(pdev);
return rc;
}
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c
index d75f59ae28e6..30c97181f0ae 100644
--- a/drivers/iommu/intel/iommu.c
+++ b/drivers/iommu/intel/iommu.c
@@ -5398,20 +5398,7 @@ static int intel_iommu_disable_sva(struct device *dev)
*/
static int siov_find_pci_dvsec(struct pci_dev *pdev)
{
- int pos;
- u16 vendor, id;
-
- pos = pci_find_next_ext_capability(pdev, 0, 0x23);
- while (pos) {
- pci_read_config_word(pdev, pos + 4, &vendor);
- pci_read_config_word(pdev, pos + 8, &id);
- if (vendor == PCI_VENDOR_ID_INTEL && id == 5)
- return pos;
-
- pos = pci_find_next_ext_capability(pdev, pos, 0x23);
- }
-
- return 0;
+ return pci_find_dvsec_capability(pdev, PCI_VENDOR_ID_INTEL, 5);
}
static bool
base-commit: 18f2a85f5e7db7468530be5048fee5b9cc7a8013
--
2.33.0
^ permalink raw reply related
* [Bug 213837] "Kernel panic - not syncing: corrupted stack end detected inside scheduler" at building via distcc on a G5
From: bugzilla-daemon @ 2021-09-23 16:29 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <bug-213837-206035@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=213837
--- Comment #9 from Erhard F. (erhard_f@mailbox.org) ---
Created attachment 298933
--> https://bugzilla.kernel.org/attachment.cgi?id=298933&action=edit
System.map (5.15-rc2 + patch, PowerMac G5 11,2)
(In reply to mpe from comment #8)
> So it looks like you have actually overran your stack, rather than
> something else clobbering your stack.
>
> Can you attach your System.map for that exact kernel? We might be able
> to work out what functions we were in when we overran.
>
> You could also try changing CONFIG_THREAD_SHIFT to 15, that might keep
> the system running a bit longer and give us some other clues.
>
> cheers
Hm, interesting...
What I do to trigger this bug is building llvm-12 on the G5 via distcc (on the
other side is a 16-core Opteron) and MAKEOPTS="-j10 -l3". As the G5 got 16 GiB
RAM building runs in a zstd-compressed ext2 filesystem (/sbin/zram-init -d1 -s2
-azstd -text2 -orelatime -m1777 -Lvar_tmp_dir 49152 /var/tmp). Most of the time
the bug is triggered very shortly after the actual building starts via meson.
At this time the build directory /var/tmp/portage occupies about 800 MiB.
Also sometimes I don't get a proper stack trace via netconsole but this:
BUG: unable to handle kernel data access on write at 0xc000000037c82040
BUG: unable to handle kernel data access on write at 0xc000000037c80000
Please find the relevant System.map attached. I'll do another kernel build with
CONFIG_THREAD_SHIFT=15 and see if anything changes.
Thanks for investigating this!
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
^ permalink raw reply
* Re: [PATCH 0/2] kvm: fix KVM_MAX_VCPU_ID handling
From: Paolo Bonzini @ 2021-09-23 16:21 UTC (permalink / raw)
To: Juergen Gross, kvm, x86, linux-kernel, linux-doc, linux-mips,
kvm-ppc, linuxppc-dev, linux-kselftest
Cc: Shuah Khan, Thomas Bogendoerfer, Wanpeng Li, Jonathan Corbet,
Sean Christopherson, Joerg Roedel, Huacai Chen,
Aleksandar Markovic, Ingo Molnar, Borislav Petkov, H. Peter Anvin,
Paul Mackerras, Vitaly Kuznetsov, Shuah Khan, Thomas Gleixner,
Jim Mattson
In-Reply-To: <20210913135745.13944-1-jgross@suse.com>
On 13/09/21 15:57, Juergen Gross wrote:
> Revert commit 76b4f357d0e7d8f6f00 which was based on wrong reasoning
> and rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS in order to avoid the
> same issue in future.
>
> Juergen Gross (2):
> x86/kvm: revert commit 76b4f357d0e7d8f6f00
> kvm: rename KVM_MAX_VCPU_ID to KVM_MAX_VCPU_IDS
>
> Documentation/virt/kvm/devices/xics.rst | 2 +-
> Documentation/virt/kvm/devices/xive.rst | 2 +-
> arch/mips/kvm/mips.c | 2 +-
> arch/powerpc/include/asm/kvm_book3s.h | 2 +-
> arch/powerpc/include/asm/kvm_host.h | 4 ++--
> arch/powerpc/kvm/book3s_xive.c | 2 +-
> arch/powerpc/kvm/powerpc.c | 2 +-
> arch/x86/include/asm/kvm_host.h | 2 +-
> arch/x86/kvm/ioapic.c | 2 +-
> arch/x86/kvm/ioapic.h | 4 ++--
> arch/x86/kvm/x86.c | 2 +-
> include/linux/kvm_host.h | 4 ++--
> tools/testing/selftests/kvm/kvm_create_max_vcpus.c | 2 +-
> virt/kvm/kvm_main.c | 2 +-
> 14 files changed, 17 insertions(+), 17 deletions(-)
>
Queued, thanks.
Paolo
^ permalink raw reply
* Re: [PATCH 0/3] memblock: cleanup memblock_free interface
From: Linus Torvalds @ 2021-09-23 16:01 UTC (permalink / raw)
To: Mike Rapoport
Cc: devicetree, linux-efi, Mike Rapoport, KVM list, linux-s390,
Linux-sh list, linux-um, Linux Kernel Mailing List, kasan-dev,
open list:BROADCOM NVRAM DRIVER, Linux-MM, iommu, linux-usb,
alpha, linux-sparc, xen-devel, Andrew Morton,
open list:SYNOPSYS ARC ARCHITECTURE, linuxppc-dev, linux-riscv,
Linux ARM
In-Reply-To: <20210923074335.12583-1-rppt@kernel.org>
On Thu, Sep 23, 2021 at 12:43 AM Mike Rapoport <rppt@kernel.org> wrote:
>
> The core change is in the third patch that makes memblock_free() a
> counterpart of memblock_alloc() and adds memblock_phys_alloc() to be a
^^^^^^^^^^^^^^^^^^^
> counterpart of memblock_phys_alloc().
That should be 'memblock_phys_free()'
HOWEVER.
The real reason I'm replying is that this patch is horribly buggy, and
will cause subtle problems that are nasty to debug.
You need to be a LOT more careful.
From a trivial check - exactly because I looked at doing it with a
script, and decided it's not so easy - I found cases like this:
- memblock_free(__pa(paca_ptrs) + new_ptrs_size,
+ memblock_free(paca_ptrs + new_ptrs_size,
which is COMPLETELY wrong.
Why? Because now that addition is done as _pointer_ addition, not as
an integer addition, and the end result is something completely
different.
pcac_ptrs is of type 'struct paca_struct **', so when you add
new_ptrs_size to it, it will add it in terms of that many pointers,
not that many bytes.
You need to use some smarter scripting, or some way to validate it.
And no, making the scripting just replace '__pa(x)' with '(void *)(x)'
- which _would_ be mindless and get the same result - is not
acceptable either, because it avoids one of the big improvements from
using the right interface, namely having compiler type checking (and
saner code that people understand).
So NAK. No broken automated scripting patches.
Linus
^ permalink raw reply
* [PATCH] KVM: PPC: Book3S HV: Use GLOBAL_TOC for kvmppc_h_set_dabr/xdabr()
From: Michael Ellerman @ 2021-09-23 15:10 UTC (permalink / raw)
To: linuxppc-dev; +Cc: mikey, npiggin
kvmppc_h_set_dabr(), and kvmppc_h_set_xdabr() which jumps into
it, need to use _GLOBAL_TOC to setup the kernel TOC pointer, because
kvmppc_h_set_dabr() uses LOAD_REG_ADDR() to load dawr_force_enable.
When called from hcall_try_real_mode() we have the kernel TOC in r2,
established near the start of kvmppc_interrupt_hv(), so there is no
issue.
But they can also be called from kvmppc_pseries_do_hcall() which is
module code, so the access ends up happening with the kvm-hv module's
r2, which will not point at dawr_force_enable and could even cause a
fault.
With the current code layout and compilers we haven't observed a fault
in practice, the load hits somewhere in kvm-hv.ko and silently returns
some bogus value.
Note that we we expect p8/p9 guests to use the DAWR, but SLOF uses
h_set_dabr() to test if sc1 works correctly, see SLOF's
lib/libhvcall/brokensc1.c.
Fixes: c1fe190c0672 ("powerpc: Add force enable of DAWR on P9 option")
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
arch/powerpc/kvm/book3s_hv_rmhandlers.S | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/powerpc/kvm/book3s_hv_rmhandlers.S b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
index 90484425a1e6..30a8a07cff18 100644
--- a/arch/powerpc/kvm/book3s_hv_rmhandlers.S
+++ b/arch/powerpc/kvm/book3s_hv_rmhandlers.S
@@ -1999,7 +1999,7 @@ END_FTR_SECTION_IFSET(CPU_FTR_ARCH_300)
.globl hcall_real_table_end
hcall_real_table_end:
-_GLOBAL(kvmppc_h_set_xdabr)
+_GLOBAL_TOC(kvmppc_h_set_xdabr)
EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
andi. r0, r5, DABRX_USER | DABRX_KERNEL
beq 6f
@@ -2009,7 +2009,7 @@ EXPORT_SYMBOL_GPL(kvmppc_h_set_xdabr)
6: li r3, H_PARAMETER
blr
-_GLOBAL(kvmppc_h_set_dabr)
+_GLOBAL_TOC(kvmppc_h_set_dabr)
EXPORT_SYMBOL_GPL(kvmppc_h_set_dabr)
li r5, DABRX_USER | DABRX_KERNEL
3:
--
2.25.1
^ permalink raw reply related
* Re: [PATCH 5/9] xen/x86: make "earlyprintk=xen" work for HVM/PVH DomU
From: Juergen Gross @ 2021-09-23 14:08 UTC (permalink / raw)
To: Jan Beulich, Boris Ostrovsky
Cc: xen-devel@lists.xenproject.org, Stefano Stabellini,
linuxppc-dev@lists.ozlabs.org, lkml
In-Reply-To: <5e9ff16e-85f0-50ea-f053-37e17351a0cc@suse.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 336 bytes --]
On 07.09.21 12:10, Jan Beulich wrote:
> xenboot_write_console() is dealing with these quite fine so I don't see
> why xenboot_console_setup() would return -ENOENT in this case.
>
> Adjust documentation accordingly.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply
* Re: [PATCH 3/9] xen/x86: make "earlyprintk=xen" work better for PVH Dom0
From: Juergen Gross @ 2021-09-23 14:05 UTC (permalink / raw)
To: Jan Beulich, Boris Ostrovsky
Cc: xen-devel@lists.xenproject.org, Stefano Stabellini,
linuxppc-dev@lists.ozlabs.org, lkml
In-Reply-To: <ecf17c7b-09a4-29a7-6951-1e0b0dda3c67@suse.com>
[-- Attachment #1.1.1: Type: text/plain, Size: 529 bytes --]
On 07.09.21 12:09, Jan Beulich wrote:
> The xen_hvm_early_write() path better wouldn't be taken in this case;
> while port 0xE9 can be used, the hypercall path is quite a bit more
> efficient. Put that first, as it may also work for DomU-s (see also
> xen_raw_console_write()).
>
> While there also bail from the function when the first
> domU_write_console() failed - later ones aren't going to succeed.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply
* [Bug 213837] "Kernel panic - not syncing: corrupted stack end detected inside scheduler" at building via distcc on a G5
From: bugzilla-daemon @ 2021-09-23 14:05 UTC (permalink / raw)
To: linuxppc-dev
In-Reply-To: <bug-213837-206035@https.bugzilla.kernel.org/>
https://bugzilla.kernel.org/show_bug.cgi?id=213837
--- Comment #8 from mpe@ellerman.id.au ---
bugzilla-daemon@bugzilla.kernel.org writes:
> https://bugzilla.kernel.org/show_bug.cgi?id=213837
>
> --- Comment #7 from Erhard F. (erhard_f@mailbox.org) ---
> Created attachment 298919
> --> https://bugzilla.kernel.org/attachment.cgi?id=298919&action=edit
> dmesg (5.15-rc2 + patch, PowerMac G5 11,2)
>
> (In reply to mpe from comment #6)
>> Can you try this patch, it might help us work out what is corrupting the
>> stack.
> With your patch applied to recent v5.15-rc2 the output looks like this:
>
> [...]
> stack corrupted? stack end = 0xc000000029fdc000
> stack: c000000029fdbc00: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
> ZZZZZZZZ........
...
> Can't make much sense out of it but hopefully you can. ;)
Thanks. Obvious isn't it? ;)
stack corrupted? stack end = 0xc000000029fdc000
stack: c000000029fdbc00: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
ZZZZZZZZ........
stack: c000000029fdbc10: 00000ddc 7c000010 cccccccc cccccccc
....|...........
stack: c000000029fdbc20: 29fc4e41 673d4bb3 5a5a5a5a 5a5a5a5a
).NAg=K.ZZZZZZZZ
stack: c000000029fdbc30: cccccccc cccccccc 00000ddc 8e000010
................
stack: c000000029fdbc40: cccccccc cccccccc 41fc4e41 673d41a3
........A.NAg=A.
stack: c000000029fdbc50: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
ZZZZZZZZ........
stack: c000000029fdbc60: 00000ddc 8e00000c cccccccc cccccccc
................
stack: c000000029fdbc70: 79fc4e41 673d4dab 5a5a5a5a 5a5a5a5a
y.NAg=M.ZZZZZZZZ
stack: c000000029fdbc80: cccccccc cccccccc 00000ddc 90000008
................
stack: c000000029fdbc90: cccccccc cccccccc 91fc4e41 673d4573
..........NAg=Es
stack: c000000029fdbca0: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
ZZZZZZZZ........
stack: c000000029fdbcb0: 00000dd7 ac000016 cccccccc cccccccc
................
stack: c000000029fdbcc0: c9fc4e41 673d4203 5a5a5a5a 5a5a5a5a
..NAg=B.ZZZZZZZZ
stack: c000000029fdbcd0: cccccccc cccccccc 00000ddc 6c000004
............l...
stack: c000000029fdbce0: cccccccc cccccccc e1fc4e41 673d474b
..........NAg=GK
stack: c000000029fdbcf0: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
ZZZZZZZZ........
stack: c000000029fdbd00: 00000ddc 88000000 cccccccc cccccccc
................
stack: c000000029fdbd10: 19fd4e41 673d4143 5a5a5a5a 5a5a5a5a
..NAg=ACZZZZZZZZ
stack: c000000029fdbd20: cccccccc cccccccc 00000ddb 6c00000e
............l...
stack: c000000029fdbd30: cccccccc cccccccc 31fd4e41 673d4f43
........1.NAg=OC
stack: c000000029fdbd40: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
ZZZZZZZZ........
stack: c000000029fdbd50: 00000ddc 8e000008 cccccccc cccccccc
................
stack: c000000029fdbd60: 69fd4e41 673d407b 5a5a5a5a 5a5a5a5a
i.NAg=@{ZZZZZZZZ
stack: c000000029fdbd70: cccccccc cccccccc 00000ddc 92000008
................
stack: c000000029fdbd80: cccccccc cccccccc 81fd4e41 673d4633
..........NAg=F3
stack: c000000029fdbd90: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
ZZZZZZZZ........
stack: c000000029fdbda0: 00000ddb 42000018 cccccccc cccccccc
....B...........
stack: c000000029fdbdb0: b9fd4e41 673d42fb 5a5a5a5a 5a5a5a5a
..NAg=B.ZZZZZZZZ
stack: c000000029fdbdc0: cccccccc cccccccc 00000ddc 7e000018
............~...
stack: c000000029fdbdd0: cccccccc cccccccc d1fd4e41 673d4a1b
..........NAg=J.
stack: c000000029fdbde0: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
ZZZZZZZZ........
stack: c000000029fdbdf0: 00000ddc 8e000004 cccccccc cccccccc
................
stack: c000000029fdbe00: 09fe4e41 673d4ee3 5a5a5a5a 5a5a5a5a
..NAg=N.ZZZZZZZZ
stack: c000000029fdbe10: cccccccc cccccccc 00000dd9 7200001c
............r...
stack: c000000029fdbe20: cccccccc cccccccc 21fe4e41 673d4fa3
........!.NAg=O.
That's slab data.
It's not clear what the actual data is, but because you booted with
slub_debug=FZP we can see the red zones and poison.
The cccccccc is SLUB_RED_ACTIVE, and 5a5a5a5a is POISON_INUSE (see poison.h)
stack: c000000029fdbe30: c0000000 29fdbeb0 cccccccc cccccccc
....)...........
But then here we have an obvious pointer (big endian FTW).
And it points nearby, just slightly higher in memory, so that looks
suspiciously like a stack back chain pointer. There's more similar
values if you look further.
But we shouldn't be seeing the stack yet, it's meant to start (end) at
c000000029fdc000 ...
stack: c000000029fdbe40: 00000ddc 94000000 cccccccc cccccccc
................
stack: c000000029fdbe50: 59fe4e41 673d4933 5a5a5a5a 5a5a5a5a
Y.NAg=I3ZZZZZZZZ
stack: c000000029fdbe60: cccccccc cccccccc 00000dd9 60000024
............`..$
stack: c000000029fdbe70: cccccccc cccccccc 71fe4e41 673d416b
........q.NAg=Ak
stack: c000000029fdbe80: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
ZZZZZZZZ........
stack: c000000029fdbe90: 00000ddc 6000000c cccccccc cccccccc
....`...........
stack: c000000029fdbea0: c0000000 29fdbf20 00000000 00000002 ....)..
........
stack: c000000029fdbeb0: c0000000 29fdbf30 00000ddc 7e00001c ....)..0....~...
<---
stack: c000000029fdbec0: c0000000 29fdbf40 c1fe4e41 673d4723
....)..@..NAg=G#
stack: c000000029fdbed0: 5a5a5a5a 5a5a5a5a cccccccc cccccccc
ZZZZZZZZ........
stack: c000000029fdbee0: c0000000 29fdbf60 cccccccc cccccccc
....)..`........
stack: c000000029fdbef0: c0000000 29fdbf70 5a5a5a5a 5a5a5a5a
....)..pZZZZZZZZ
stack: c000000029fdbf00: cccccccc cccccccc 00000ddc 60000010
............`...
stack: c000000029fdbf10: c0000000 29fdbf90 00000000 00000002
....)...........
stack: c000000029fdbf20: c0000000 29fdbf01 001d3029 96167689
....).....0)..v.
stack: c000000029fdbf30: c0000000 29fdbfc0 c0000004 7f6f1800 ....)........o..
<---
stack: c000000029fdbf40: c0000000 29fdbfc0 5a5a5a5a 5a5a5a5a
....)...ZZZZZZZZ
stack: c000000029fdbf50: c0000000 000ea33c 00000000 00000000
.......<........
stack: c000000029fdbf60: c0000000 29fdbfe0 c0000000 05cdb700
....)...........
stack: c000000029fdbf70: c0000000 29fdbff0 cccccccc cccccccc
....)...........
stack: c000000029fdbf80: c0000000 000ea33c 00000000 00328780
.......<.....2..
stack: c000000029fdbf90: c0000000 29fdc010 001d3029 96167689
....).....0)..v.
stack: c000000029fdbfa0: c0000000 29fdc020 00000000 000008e4 ....)..
........
stack: c000000029fdbfb0: 00000000 00000201 001d3029 96167689
..........0)..v.
stack: c000000029fdbfc0: c0000000 29fdc040 cccccccc cccccccc ....)..@........
<---
stack: c000000029fdbfd0: c0000000 000c2344 001d3029 96167689
......#D..0)..v.
stack: c000000029fdbfe0: c0000000 29fdc001 001d3029 96167689
....).....0)..v.
stack: c000000029fdbff0: c0000000 29fdc080 00000088 554c539a
....).......ULS.
... which is here:
stack: c000000029fdc000: c0000000 000c1d9c 001d3029 96167689
..........0)..v.
stack: c000000029fdc010: c0000000 29fdc0d0 c0000004 7f6f1700
....)........o..
stack: c000000029fdc020: c0000000 29fdc0a0 c0000000 05cdb580
....)...........
stack: c000000029fdc030: c0000000 29fdc0b0 c0000004 7f6f1700
....)........o..
stack: c000000029fdc040: c0000000 29fdc0c0 00000000 00000001
....)...........
So it looks like you have actually overran your stack, rather than
something else clobbering your stack.
Can you attach your System.map for that exact kernel? We might be able
to work out what functions we were in when we overran.
You could also try changing CONFIG_THREAD_SHIFT to 15, that might keep
the system running a bit longer and give us some other clues.
cheers
--
You may reply to this email to add a comment.
You are receiving this mail because:
You are watching the assignee of the bug.
You are watching someone on the CC list of the bug.
^ permalink raw reply
* Re: [Bug 213837] "Kernel panic - not syncing: corrupted stack end detected inside scheduler" at building via distcc on a G5
From: Michael Ellerman @ 2021-09-23 14:05 UTC (permalink / raw)
To: bugzilla-daemon, linuxppc-dev
In-Reply-To: <bug-213837-206035-ilyQ6qrWP6@https.bugzilla.kernel.org/>
bugzilla-daemon@bugzilla.kernel.org writes:
> https://bugzilla.kernel.org/show_bug.cgi?id=213837
>
> --- Comment #7 from Erhard F. (erhard_f@mailbox.org) ---
> Created attachment 298919
> --> https://bugzilla.kernel.org/attachment.cgi?id=298919&action=edit
> dmesg (5.15-rc2 + patch, PowerMac G5 11,2)
>
> (In reply to mpe from comment #6)
>> Can you try this patch, it might help us work out what is corrupting the
>> stack.
> With your patch applied to recent v5.15-rc2 the output looks like this:
>
> [...]
> stack corrupted? stack end = 0xc000000029fdc000
> stack: c000000029fdbc00: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
...
> Can't make much sense out of it but hopefully you can. ;)
Thanks. Obvious isn't it? ;)
stack corrupted? stack end = 0xc000000029fdc000
stack: c000000029fdbc00: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
stack: c000000029fdbc10: 00000ddc 7c000010 cccccccc cccccccc ....|...........
stack: c000000029fdbc20: 29fc4e41 673d4bb3 5a5a5a5a 5a5a5a5a ).NAg=K.ZZZZZZZZ
stack: c000000029fdbc30: cccccccc cccccccc 00000ddc 8e000010 ................
stack: c000000029fdbc40: cccccccc cccccccc 41fc4e41 673d41a3 ........A.NAg=A.
stack: c000000029fdbc50: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
stack: c000000029fdbc60: 00000ddc 8e00000c cccccccc cccccccc ................
stack: c000000029fdbc70: 79fc4e41 673d4dab 5a5a5a5a 5a5a5a5a y.NAg=M.ZZZZZZZZ
stack: c000000029fdbc80: cccccccc cccccccc 00000ddc 90000008 ................
stack: c000000029fdbc90: cccccccc cccccccc 91fc4e41 673d4573 ..........NAg=Es
stack: c000000029fdbca0: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
stack: c000000029fdbcb0: 00000dd7 ac000016 cccccccc cccccccc ................
stack: c000000029fdbcc0: c9fc4e41 673d4203 5a5a5a5a 5a5a5a5a ..NAg=B.ZZZZZZZZ
stack: c000000029fdbcd0: cccccccc cccccccc 00000ddc 6c000004 ............l...
stack: c000000029fdbce0: cccccccc cccccccc e1fc4e41 673d474b ..........NAg=GK
stack: c000000029fdbcf0: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
stack: c000000029fdbd00: 00000ddc 88000000 cccccccc cccccccc ................
stack: c000000029fdbd10: 19fd4e41 673d4143 5a5a5a5a 5a5a5a5a ..NAg=ACZZZZZZZZ
stack: c000000029fdbd20: cccccccc cccccccc 00000ddb 6c00000e ............l...
stack: c000000029fdbd30: cccccccc cccccccc 31fd4e41 673d4f43 ........1.NAg=OC
stack: c000000029fdbd40: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
stack: c000000029fdbd50: 00000ddc 8e000008 cccccccc cccccccc ................
stack: c000000029fdbd60: 69fd4e41 673d407b 5a5a5a5a 5a5a5a5a i.NAg=@{ZZZZZZZZ
stack: c000000029fdbd70: cccccccc cccccccc 00000ddc 92000008 ................
stack: c000000029fdbd80: cccccccc cccccccc 81fd4e41 673d4633 ..........NAg=F3
stack: c000000029fdbd90: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
stack: c000000029fdbda0: 00000ddb 42000018 cccccccc cccccccc ....B...........
stack: c000000029fdbdb0: b9fd4e41 673d42fb 5a5a5a5a 5a5a5a5a ..NAg=B.ZZZZZZZZ
stack: c000000029fdbdc0: cccccccc cccccccc 00000ddc 7e000018 ............~...
stack: c000000029fdbdd0: cccccccc cccccccc d1fd4e41 673d4a1b ..........NAg=J.
stack: c000000029fdbde0: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
stack: c000000029fdbdf0: 00000ddc 8e000004 cccccccc cccccccc ................
stack: c000000029fdbe00: 09fe4e41 673d4ee3 5a5a5a5a 5a5a5a5a ..NAg=N.ZZZZZZZZ
stack: c000000029fdbe10: cccccccc cccccccc 00000dd9 7200001c ............r...
stack: c000000029fdbe20: cccccccc cccccccc 21fe4e41 673d4fa3 ........!.NAg=O.
That's slab data.
It's not clear what the actual data is, but because you booted with
slub_debug=FZP we can see the red zones and poison.
The cccccccc is SLUB_RED_ACTIVE, and 5a5a5a5a is POISON_INUSE (see poison.h)
stack: c000000029fdbe30: c0000000 29fdbeb0 cccccccc cccccccc ....)...........
But then here we have an obvious pointer (big endian FTW).
And it points nearby, just slightly higher in memory, so that looks
suspiciously like a stack back chain pointer. There's more similar
values if you look further.
But we shouldn't be seeing the stack yet, it's meant to start (end) at
c000000029fdc000 ...
stack: c000000029fdbe40: 00000ddc 94000000 cccccccc cccccccc ................
stack: c000000029fdbe50: 59fe4e41 673d4933 5a5a5a5a 5a5a5a5a Y.NAg=I3ZZZZZZZZ
stack: c000000029fdbe60: cccccccc cccccccc 00000dd9 60000024 ............`..$
stack: c000000029fdbe70: cccccccc cccccccc 71fe4e41 673d416b ........q.NAg=Ak
stack: c000000029fdbe80: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
stack: c000000029fdbe90: 00000ddc 6000000c cccccccc cccccccc ....`...........
stack: c000000029fdbea0: c0000000 29fdbf20 00000000 00000002 ....).. ........
stack: c000000029fdbeb0: c0000000 29fdbf30 00000ddc 7e00001c ....)..0....~... <---
stack: c000000029fdbec0: c0000000 29fdbf40 c1fe4e41 673d4723 ....)..@..NAg=G#
stack: c000000029fdbed0: 5a5a5a5a 5a5a5a5a cccccccc cccccccc ZZZZZZZZ........
stack: c000000029fdbee0: c0000000 29fdbf60 cccccccc cccccccc ....)..`........
stack: c000000029fdbef0: c0000000 29fdbf70 5a5a5a5a 5a5a5a5a ....)..pZZZZZZZZ
stack: c000000029fdbf00: cccccccc cccccccc 00000ddc 60000010 ............`...
stack: c000000029fdbf10: c0000000 29fdbf90 00000000 00000002 ....)...........
stack: c000000029fdbf20: c0000000 29fdbf01 001d3029 96167689 ....).....0)..v.
stack: c000000029fdbf30: c0000000 29fdbfc0 c0000004 7f6f1800 ....)........o.. <---
stack: c000000029fdbf40: c0000000 29fdbfc0 5a5a5a5a 5a5a5a5a ....)...ZZZZZZZZ
stack: c000000029fdbf50: c0000000 000ea33c 00000000 00000000 .......<........
stack: c000000029fdbf60: c0000000 29fdbfe0 c0000000 05cdb700 ....)...........
stack: c000000029fdbf70: c0000000 29fdbff0 cccccccc cccccccc ....)...........
stack: c000000029fdbf80: c0000000 000ea33c 00000000 00328780 .......<.....2..
stack: c000000029fdbf90: c0000000 29fdc010 001d3029 96167689 ....).....0)..v.
stack: c000000029fdbfa0: c0000000 29fdc020 00000000 000008e4 ....).. ........
stack: c000000029fdbfb0: 00000000 00000201 001d3029 96167689 ..........0)..v.
stack: c000000029fdbfc0: c0000000 29fdc040 cccccccc cccccccc ....)..@........ <---
stack: c000000029fdbfd0: c0000000 000c2344 001d3029 96167689 ......#D..0)..v.
stack: c000000029fdbfe0: c0000000 29fdc001 001d3029 96167689 ....).....0)..v.
stack: c000000029fdbff0: c0000000 29fdc080 00000088 554c539a ....).......ULS.
... which is here:
stack: c000000029fdc000: c0000000 000c1d9c 001d3029 96167689 ..........0)..v.
stack: c000000029fdc010: c0000000 29fdc0d0 c0000004 7f6f1700 ....)........o..
stack: c000000029fdc020: c0000000 29fdc0a0 c0000000 05cdb580 ....)...........
stack: c000000029fdc030: c0000000 29fdc0b0 c0000004 7f6f1700 ....)........o..
stack: c000000029fdc040: c0000000 29fdc0c0 00000000 00000001 ....)...........
So it looks like you have actually overran your stack, rather than
something else clobbering your stack.
Can you attach your System.map for that exact kernel? We might be able
to work out what functions we were in when we overran.
You could also try changing CONFIG_THREAD_SHIFT to 15, that might keep
the system running a bit longer and give us some other clues.
cheers
^ permalink raw reply
* Re: [PATCH 3/3] memblock: cleanup memblock_free interface
From: Christophe Leroy @ 2021-09-23 13:54 UTC (permalink / raw)
To: Mike Rapoport
Cc: linux-efi, kvm, linux-sh, linux-mips, linux-mm, sparclinux,
linux-riscv, linux-s390, kasan-dev, xen-devel, linux-snps-arc,
devicetree, linux-um, linux-arm-kernel, Linus Torvalds, linux-usb,
linux-kernel, iommu, linux-alpha, Andrew Morton, linuxppc-dev,
Mike Rapoport
In-Reply-To: <YUxsgN/uolhn1Ok+@linux.ibm.com>
Le 23/09/2021 à 14:01, Mike Rapoport a écrit :
> On Thu, Sep 23, 2021 at 11:47:48AM +0200, Christophe Leroy wrote:
>>
>>
>> Le 23/09/2021 à 09:43, Mike Rapoport a écrit :
>>> From: Mike Rapoport <rppt@linux.ibm.com>
>>>
>>> For ages memblock_free() interface dealt with physical addresses even
>>> despite the existence of memblock_alloc_xx() functions that return a
>>> virtual pointer.
>>>
>>> Introduce memblock_phys_free() for freeing physical ranges and repurpose
>>> memblock_free() to free virtual pointers to make the following pairing
>>> abundantly clear:
>>>
>>> int memblock_phys_free(phys_addr_t base, phys_addr_t size);
>>> phys_addr_t memblock_phys_alloc(phys_addr_t base, phys_addr_t size);
>>>
>>> void *memblock_alloc(phys_addr_t size, phys_addr_t align);
>>> void memblock_free(void *ptr, size_t size);
>>>
>>> Replace intermediate memblock_free_ptr() with memblock_free() and drop
>>> unnecessary aliases memblock_free_early() and memblock_free_early_nid().
>>>
>>> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
>>> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
>>> ---
>>
>>> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
>>> index 1a04e5bdf655..37826d8c4f74 100644
>>> --- a/arch/s390/kernel/smp.c
>>> +++ b/arch/s390/kernel/smp.c
>>> @@ -723,7 +723,7 @@ void __init smp_save_dump_cpus(void)
>>> /* Get the CPU registers */
>>> smp_save_cpu_regs(sa, addr, is_boot_cpu, page);
>>> }
>>> - memblock_free(page, PAGE_SIZE);
>>> + memblock_phys_free(page, PAGE_SIZE);
>>> diag_amode31_ops.diag308_reset();
>>> pcpu_set_smt(0);
>>> }
>>> @@ -880,7 +880,7 @@ void __init smp_detect_cpus(void)
>>> /* Add CPUs present at boot */
>>> __smp_rescan_cpus(info, true);
>>> - memblock_free_early((unsigned long)info, sizeof(*info));
>>> + memblock_free(info, sizeof(*info));
>>> }
>>> /*
>>
>> I'm a bit lost. IIUC memblock_free_early() and memblock_free() where
>> identical.
>
> Yes, they were, but all calls to memblock_free_early() were using
> __pa(vaddr) because they had a virtual address at hand.
I'm still not following. In the above memblock_free_early() was taking
(unsigned long)info . Was it a bug ? It looks odd to hide bug fixes in
such a big patch, should that bug fix go in patch 2 ?
>
>> In the first hunk memblock_free() gets replaced by memblock_phys_free()
>> In the second hunk memblock_free_early() gets replaced by memblock_free()
>
> In the first hunk the memory is allocated with memblock_phys_alloc() and we
> have a physical range to free. In the second hunk the memory is allocated
> with memblock_alloc() and we are freeing a virtual pointer.
>
>> I think it would be easier to follow if you could split it in several
>> patches:
>
> It was an explicit request from Linus to make it a single commit:
>
> but the actual commit can and should be just a single commit that just
> fixes 'memblock_free()' to have sane interfaces.
>
> I don't feel strongly about splitting it (except my laziness really
> objects), but I don't think doing the conversion in several steps worth the
> churn.
The commit is quite big (55 files changed, approx 100 lines modified).
If done in the right order the change should be minimal.
It is rather not-easy to follow and review when a function that was
existing (namely memblock_free() ) disappears and re-appears in the same
commit but to do something different.
You do:
- memblock_free() ==> memblock_phys_free()
- memblock_free_ptr() ==> memblock_free()
At least you could split in two patches, the advantage would be that
between first and second patch memblock() doesn't exist anymore so you
can check you really don't have anymore user.
>
>> - First patch: Create memblock_phys_free() and change all relevant
>> memblock_free() to memblock_phys_free() - Or change memblock_free() to
>> memblock_phys_free() and make memblock_free() an alias of it.
>> - Second patch: Make memblock_free_ptr() become memblock_free() and change
>> all remaining callers to the new semantics (IIUC memblock_free(__pa(ptr))
>> becomes memblock_free(ptr) and make memblock_free_ptr() an alias of
>> memblock_free()
>> - Fourth patch: Replace and drop memblock_free_ptr()
>> - Fifth patch: Drop memblock_free_early() and memblock_free_early_nid() (All
>> users should have been upgraded to memblock_free_phys() in patch 1 or
>> memblock_free() in patch 2)
>>
>> Christophe
>
^ permalink raw reply
* Re: [PATCH v2 1/2] powerpc/powermac: add missing g5_phy_disable_cpu1() declaration
From: Krzysztof Kozlowski @ 2021-09-23 13:32 UTC (permalink / raw)
To: Michael Ellerman, Benjamin Herrenschmidt, Paul Mackerras,
Rob Herring, Frank Rowand, Christophe Leroy, Aneesh Kumar K.V,
linuxppc-dev, linux-kernel, devicetree
In-Reply-To: <87v92rl95e.fsf@mpe.ellerman.id.au>
On 23/09/2021 15:21, Michael Ellerman wrote:
> Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> writes:
>> g5_phy_disable_cpu1() is used outside of platforms/powermac/feature.c,
>> so it should have a declaration to fix W=1 warning:
>>
>> arch/powerpc/platforms/powermac/feature.c:1533:6:
>> error: no previous prototype for ‘g5_phy_disable_cpu1’ [-Werror=missing-prototypes]
>>
>> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>>
>> ---
>>
>> Changes since v1:
>> 1. Drop declaration in powermac/smp.c
>
> Sorry I missed v1, so I'm going to ask for more changes :}
>
>> arch/powerpc/include/asm/pmac_feature.h | 4 ++++
>
> Putting it here exposes it to the whole kernel, but it's only needed
> inside arch/powerpc/platforms/powermac.
>
> The right place for the prototype is arch/powerpc/platforms/powermac/pmac.h,
> which is for platform internal prototypes.
I'll fix it up.
>
>> arch/powerpc/platforms/powermac/smp.c | 2 --
>> 2 files changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/powerpc/include/asm/pmac_feature.h b/arch/powerpc/include/asm/pmac_feature.h
>> index e08e829261b6..7703e5bf1203 100644
>> --- a/arch/powerpc/include/asm/pmac_feature.h
>> +++ b/arch/powerpc/include/asm/pmac_feature.h
>> @@ -143,6 +143,10 @@
>> */
>> struct device_node;
>>
>> +#ifdef CONFIG_PPC64
>> +void g5_phy_disable_cpu1(void);
>> +#endif /* CONFIG_PPC64 */
>
> The ifdef around the prototype doesn't gain much, and is extra visual
> noise, so I'd rather without it.
Sure.
Best regards,
Krzysztof
^ permalink raw reply
* Re: [PATCH v2 1/2] powerpc/powermac: add missing g5_phy_disable_cpu1() declaration
From: Michael Ellerman @ 2021-09-23 13:21 UTC (permalink / raw)
To: Krzysztof Kozlowski, Benjamin Herrenschmidt, Paul Mackerras,
Rob Herring, Frank Rowand, Krzysztof Kozlowski, Christophe Leroy,
Aneesh Kumar K.V, linuxppc-dev, linux-kernel, devicetree
In-Reply-To: <20210922160436.130931-1-krzysztof.kozlowski@canonical.com>
Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com> writes:
> g5_phy_disable_cpu1() is used outside of platforms/powermac/feature.c,
> so it should have a declaration to fix W=1 warning:
>
> arch/powerpc/platforms/powermac/feature.c:1533:6:
> error: no previous prototype for ‘g5_phy_disable_cpu1’ [-Werror=missing-prototypes]
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
>
> ---
>
> Changes since v1:
> 1. Drop declaration in powermac/smp.c
Sorry I missed v1, so I'm going to ask for more changes :}
> arch/powerpc/include/asm/pmac_feature.h | 4 ++++
Putting it here exposes it to the whole kernel, but it's only needed
inside arch/powerpc/platforms/powermac.
The right place for the prototype is arch/powerpc/platforms/powermac/pmac.h,
which is for platform internal prototypes.
> arch/powerpc/platforms/powermac/smp.c | 2 --
> 2 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/pmac_feature.h b/arch/powerpc/include/asm/pmac_feature.h
> index e08e829261b6..7703e5bf1203 100644
> --- a/arch/powerpc/include/asm/pmac_feature.h
> +++ b/arch/powerpc/include/asm/pmac_feature.h
> @@ -143,6 +143,10 @@
> */
> struct device_node;
>
> +#ifdef CONFIG_PPC64
> +void g5_phy_disable_cpu1(void);
> +#endif /* CONFIG_PPC64 */
The ifdef around the prototype doesn't gain much, and is extra visual
noise, so I'd rather without it.
cheers
^ permalink raw reply
* Re: [PATCH 3/3] memblock: cleanup memblock_free interface
From: Mike Rapoport @ 2021-09-23 12:01 UTC (permalink / raw)
To: Christophe Leroy
Cc: linux-efi, kvm, linux-sh, linux-mips, linux-mm, sparclinux,
linux-riscv, linux-s390, kasan-dev, xen-devel, linux-snps-arc,
devicetree, linux-um, linux-arm-kernel, Linus Torvalds, linux-usb,
linux-kernel, iommu, linux-alpha, Andrew Morton, linuxppc-dev,
Mike Rapoport
In-Reply-To: <1101e3c7-fcb7-a632-8e22-47f4a01ea02e@csgroup.eu>
On Thu, Sep 23, 2021 at 11:47:48AM +0200, Christophe Leroy wrote:
>
>
> Le 23/09/2021 à 09:43, Mike Rapoport a écrit :
> > From: Mike Rapoport <rppt@linux.ibm.com>
> >
> > For ages memblock_free() interface dealt with physical addresses even
> > despite the existence of memblock_alloc_xx() functions that return a
> > virtual pointer.
> >
> > Introduce memblock_phys_free() for freeing physical ranges and repurpose
> > memblock_free() to free virtual pointers to make the following pairing
> > abundantly clear:
> >
> > int memblock_phys_free(phys_addr_t base, phys_addr_t size);
> > phys_addr_t memblock_phys_alloc(phys_addr_t base, phys_addr_t size);
> >
> > void *memblock_alloc(phys_addr_t size, phys_addr_t align);
> > void memblock_free(void *ptr, size_t size);
> >
> > Replace intermediate memblock_free_ptr() with memblock_free() and drop
> > unnecessary aliases memblock_free_early() and memblock_free_early_nid().
> >
> > Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> > Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> > ---
>
> > diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> > index 1a04e5bdf655..37826d8c4f74 100644
> > --- a/arch/s390/kernel/smp.c
> > +++ b/arch/s390/kernel/smp.c
> > @@ -723,7 +723,7 @@ void __init smp_save_dump_cpus(void)
> > /* Get the CPU registers */
> > smp_save_cpu_regs(sa, addr, is_boot_cpu, page);
> > }
> > - memblock_free(page, PAGE_SIZE);
> > + memblock_phys_free(page, PAGE_SIZE);
> > diag_amode31_ops.diag308_reset();
> > pcpu_set_smt(0);
> > }
> > @@ -880,7 +880,7 @@ void __init smp_detect_cpus(void)
> > /* Add CPUs present at boot */
> > __smp_rescan_cpus(info, true);
> > - memblock_free_early((unsigned long)info, sizeof(*info));
> > + memblock_free(info, sizeof(*info));
> > }
> > /*
>
> I'm a bit lost. IIUC memblock_free_early() and memblock_free() where
> identical.
Yes, they were, but all calls to memblock_free_early() were using
__pa(vaddr) because they had a virtual address at hand.
> In the first hunk memblock_free() gets replaced by memblock_phys_free()
> In the second hunk memblock_free_early() gets replaced by memblock_free()
In the first hunk the memory is allocated with memblock_phys_alloc() and we
have a physical range to free. In the second hunk the memory is allocated
with memblock_alloc() and we are freeing a virtual pointer.
> I think it would be easier to follow if you could split it in several
> patches:
It was an explicit request from Linus to make it a single commit:
but the actual commit can and should be just a single commit that just
fixes 'memblock_free()' to have sane interfaces.
I don't feel strongly about splitting it (except my laziness really
objects), but I don't think doing the conversion in several steps worth the
churn.
> - First patch: Create memblock_phys_free() and change all relevant
> memblock_free() to memblock_phys_free() - Or change memblock_free() to
> memblock_phys_free() and make memblock_free() an alias of it.
> - Second patch: Make memblock_free_ptr() become memblock_free() and change
> all remaining callers to the new semantics (IIUC memblock_free(__pa(ptr))
> becomes memblock_free(ptr) and make memblock_free_ptr() an alias of
> memblock_free()
> - Fourth patch: Replace and drop memblock_free_ptr()
> - Fifth patch: Drop memblock_free_early() and memblock_free_early_nid() (All
> users should have been upgraded to memblock_free_phys() in patch 1 or
> memblock_free() in patch 2)
>
> Christophe
--
Sincerely yours,
Mike.
^ permalink raw reply
* Re: [PATCH v2 3/3] powerpc/numa: Fill distance_lookup_table for offline nodes
From: Michael Ellerman @ 2021-09-23 11:17 UTC (permalink / raw)
To: Srikar Dronamraju
Cc: Nathan Lynch, Gautham R Shenoy, Vincent Guittot,
kernel test robot, Peter Zijlstra, Geetika Moolchandani,
Valentin Schneider, Laurent Dufour, linuxppc-dev, Ingo Molnar
In-Reply-To: <20210901102206.GO21942@linux.vnet.ibm.com>
Srikar Dronamraju <srikar@linux.vnet.ibm.com> writes:
> * Michael Ellerman <mpe@ellerman.id.au> [2021-08-26 23:36:53]:
>
>> Srikar Dronamraju <srikar@linux.vnet.ibm.com> writes:
>> > Scheduler expects unique number of node distances to be available at
>> > boot.
...
>
>> > Fake the offline node's distance_lookup_table entries so that all
>> > possible node distances are updated.
>>
>> Does this work if we have a single node offline at boot?
>>
>
> It should.
>
>> Say we start with:
>>
>> node distances:
>> node 0 1
>> 0: 10 20
>> 1: 20 10
>>
>> And node 2 is offline at boot. We can only initialise that nodes entries
>> in the distance_lookup_table:
>>
>> while (i--)
>> distance_lookup_table[node][i] = node;
>>
>> By filling them all with 2 that causes node_distance(2, X) to return the
>> maximum distance for all other nodes X, because we won't break out of
>> the loop in __node_distance():
>>
>> for (i = 0; i < distance_ref_points_depth; i++) {
>> if (distance_lookup_table[a][i] == distance_lookup_table[b][i])
>> break;
>>
>> /* Double the distance for each NUMA level */
>> distance *= 2;
>> }
>>
>> If distance_ref_points_depth was 4 we'd return 160.
>
> As you already know, distance 10, 20, .. are defined by Powerpc, form1
> affinity. PAPR doesn't define actual distances, it only provides us the
> associativity. If there are distance_ref_points_depth is 4,
> (distance_ref_points_depth doesn't take local distance into consideration)
> 10, 20, 40, 80, 160.
>
>>
>> That'd leave us with 3 unique distances at boot, 10, 20, 160.
>>
>
> So if there are unique distances, then the distances as per the current
> code has to be 10, 20, 40, 80.. I dont see a way in which we have a break in
> the series. like having 160 without 80.
I'm confused what you mean there.
If we have a node that's offline at boot then we get 160 for that node,
that's just the result of having no info for it, so we never break out
of the for loop.
So if we have two nodes, one hop apart, and then an offline node we get
10, 20, 160.
Or if you're using depth = 3 then it's 10, 20, 80.
>> But when node 2 comes online it might introduce more than 1 new distance
>> value, eg. it could be that the actual distances are:
>>
>> node distances:
>> node 0 1 2
>> 0: 10 20 40
>> 1: 20 10 80
>> 2: 40 80 10
>>
>> ie. we now have 4 distances, 10, 20, 40, 80.
>>
>> What am I missing?
>
> As I said above, I am not sure how we can have a break in the series.
> If distance_ref_points_depth is 3, the distances has to be 10,20,40,80 as
> atleast for form1 affinity.
I agree for depth 3 we have to see 10, 20, 40, 80. But nothing
guarantees we see each value (other than 10).
We can have two nodes one hop apart, so we have 10 and 20, then a third
node is added 3 hops away, so we get 10, 20, 80.
The real problem is that the third node could be 3 hops from node 0
and 2 hops from node 1, and so the addition of the third node causes
two new distance values (40 & 80) to be required.
I think maybe what you're saying is that in practice we don't see setups
like that. But I don't know if I'm happy with a solution that doesn't
work in the general case, and relies on the particular properties of our
current set of systems.
Possibly we just need to detect that case and WARN about it. The only
problem is we won't know until the system is already up and running, ie.
we can't know at boot that the onlining of the third node will cause 2
new distance values to be added.
cheers
^ permalink raw reply
* Re: [PATCH 3/3] memblock: cleanup memblock_free interface
From: Christophe Leroy @ 2021-09-23 9:47 UTC (permalink / raw)
To: Mike Rapoport, Linus Torvalds
Cc: devicetree, linux-snps-arc, linux-efi, kvm, linux-sh, linux-s390,
linux-usb, linux-um, linux-kernel, kasan-dev, Mike Rapoport,
linux-mm, iommu, linux-alpha, sparclinux, xen-devel,
Andrew Morton, linux-mips, linuxppc-dev, linux-riscv,
linux-arm-kernel
In-Reply-To: <20210923074335.12583-4-rppt@kernel.org>
Le 23/09/2021 à 09:43, Mike Rapoport a écrit :
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> For ages memblock_free() interface dealt with physical addresses even
> despite the existence of memblock_alloc_xx() functions that return a
> virtual pointer.
>
> Introduce memblock_phys_free() for freeing physical ranges and repurpose
> memblock_free() to free virtual pointers to make the following pairing
> abundantly clear:
>
> int memblock_phys_free(phys_addr_t base, phys_addr_t size);
> phys_addr_t memblock_phys_alloc(phys_addr_t base, phys_addr_t size);
>
> void *memblock_alloc(phys_addr_t size, phys_addr_t align);
> void memblock_free(void *ptr, size_t size);
>
> Replace intermediate memblock_free_ptr() with memblock_free() and drop
> unnecessary aliases memblock_free_early() and memblock_free_early_nid().
>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
> ---
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index 1a04e5bdf655..37826d8c4f74 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -723,7 +723,7 @@ void __init smp_save_dump_cpus(void)
> /* Get the CPU registers */
> smp_save_cpu_regs(sa, addr, is_boot_cpu, page);
> }
> - memblock_free(page, PAGE_SIZE);
> + memblock_phys_free(page, PAGE_SIZE);
> diag_amode31_ops.diag308_reset();
> pcpu_set_smt(0);
> }
> @@ -880,7 +880,7 @@ void __init smp_detect_cpus(void)
>
> /* Add CPUs present at boot */
> __smp_rescan_cpus(info, true);
> - memblock_free_early((unsigned long)info, sizeof(*info));
> + memblock_free(info, sizeof(*info));
> }
>
> /*
I'm a bit lost. IIUC memblock_free_early() and memblock_free() where
identical.
In the first hunk memblock_free() gets replaced by memblock_phys_free()
In the second hunk memblock_free_early() gets replaced by memblock_free()
I think it would be easier to follow if you could split it in several
patches:
- First patch: Create memblock_phys_free() and change all relevant
memblock_free() to memblock_phys_free() - Or change memblock_free() to
memblock_phys_free() and make memblock_free() an alias of it.
- Second patch: Make memblock_free_ptr() become memblock_free() and
change all remaining callers to the new semantics (IIUC
memblock_free(__pa(ptr)) becomes memblock_free(ptr) and make
memblock_free_ptr() an alias of memblock_free()
- Fourth patch: Replace and drop memblock_free_ptr()
- Fifth patch: Drop memblock_free_early() and memblock_free_early_nid()
(All users should have been upgraded to memblock_free_phys() in patch 1
or memblock_free() in patch 2)
Christophe
^ permalink raw reply
* Re: [PATCH 3/3] memblock: cleanup memblock_free interface
From: Juergen Gross @ 2021-09-23 8:15 UTC (permalink / raw)
To: Mike Rapoport, Linus Torvalds
Cc: devicetree, linux-efi, Mike Rapoport, kvm, linux-s390, linux-sh,
linux-um, linux-kernel, kasan-dev, linux-mips, linux-mm, iommu,
linux-usb, linux-alpha, sparclinux, xen-devel, Andrew Morton,
linux-snps-arc, linuxppc-dev, linux-riscv, linux-arm-kernel
In-Reply-To: <20210923074335.12583-4-rppt@kernel.org>
[-- Attachment #1.1.1: Type: text/plain, Size: 1042 bytes --]
On 23.09.21 09:43, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> For ages memblock_free() interface dealt with physical addresses even
> despite the existence of memblock_alloc_xx() functions that return a
> virtual pointer.
>
> Introduce memblock_phys_free() for freeing physical ranges and repurpose
> memblock_free() to free virtual pointers to make the following pairing
> abundantly clear:
>
> int memblock_phys_free(phys_addr_t base, phys_addr_t size);
> phys_addr_t memblock_phys_alloc(phys_addr_t base, phys_addr_t size);
>
> void *memblock_alloc(phys_addr_t size, phys_addr_t align);
> void memblock_free(void *ptr, size_t size);
>
> Replace intermediate memblock_free_ptr() with memblock_free() and drop
> unnecessary aliases memblock_free_early() and memblock_free_early_nid().
>
> Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
arch/x86/xen/ parts: Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply
* Re: [PATCH 2/3] xen/x86: free_p2m_page: use memblock_free_ptr() to free a virtual pointer
From: Juergen Gross @ 2021-09-23 8:10 UTC (permalink / raw)
To: Mike Rapoport, Linus Torvalds
Cc: devicetree, linux-efi, Mike Rapoport, kvm, linux-s390, linux-sh,
linux-um, linux-kernel, kasan-dev, linux-mips, linux-mm, iommu,
linux-usb, linux-alpha, sparclinux, xen-devel, Andrew Morton,
linux-snps-arc, linuxppc-dev, linux-riscv, linux-arm-kernel
In-Reply-To: <20210923074335.12583-3-rppt@kernel.org>
[-- Attachment #1.1.1: Type: text/plain, Size: 410 bytes --]
On 23.09.21 09:43, Mike Rapoport wrote:
> From: Mike Rapoport <rppt@linux.ibm.com>
>
> free_p2m_page() wrongly passes a virtual pointer to memblock_free() that
> treats it as a physical address.
>
> Call memblock_free_ptr() instead that gets a virtual address to free the
> memory.
>
> Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Juergen
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3135 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply
* [PATCH 3/3] memblock: cleanup memblock_free interface
From: Mike Rapoport @ 2021-09-23 7:43 UTC (permalink / raw)
To: Linus Torvalds
Cc: devicetree, linux-efi, Mike Rapoport, kvm, linux-s390, linux-sh,
linux-um, linux-kernel, kasan-dev, linux-mips, linux-mm, iommu,
linux-usb, linux-alpha, sparclinux, xen-devel, Andrew Morton,
linux-snps-arc, linuxppc-dev, linux-riscv, linux-arm-kernel
In-Reply-To: <20210923074335.12583-1-rppt@kernel.org>
From: Mike Rapoport <rppt@linux.ibm.com>
For ages memblock_free() interface dealt with physical addresses even
despite the existence of memblock_alloc_xx() functions that return a
virtual pointer.
Introduce memblock_phys_free() for freeing physical ranges and repurpose
memblock_free() to free virtual pointers to make the following pairing
abundantly clear:
int memblock_phys_free(phys_addr_t base, phys_addr_t size);
phys_addr_t memblock_phys_alloc(phys_addr_t base, phys_addr_t size);
void *memblock_alloc(phys_addr_t size, phys_addr_t align);
void memblock_free(void *ptr, size_t size);
Replace intermediate memblock_free_ptr() with memblock_free() and drop
unnecessary aliases memblock_free_early() and memblock_free_early_nid().
Suggested-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
arch/alpha/kernel/core_irongate.c | 2 +-
arch/arc/mm/init.c | 2 +-
arch/arm/mach-hisi/platmcpm.c | 2 +-
arch/arm/mm/init.c | 2 +-
arch/arm64/mm/mmu.c | 4 ++--
arch/mips/mm/init.c | 2 +-
arch/mips/sgi-ip30/ip30-setup.c | 6 +++---
arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +-
arch/powerpc/kernel/paca.c | 4 ++--
arch/powerpc/kernel/setup-common.c | 2 +-
arch/powerpc/kernel/setup_64.c | 2 +-
arch/powerpc/platforms/powernv/pci-ioda.c | 2 +-
arch/powerpc/platforms/pseries/svm.c | 4 +---
arch/riscv/kernel/setup.c | 4 ++--
arch/s390/kernel/setup.c | 8 ++++----
arch/s390/kernel/smp.c | 4 ++--
arch/s390/kernel/uv.c | 2 +-
arch/s390/mm/kasan_init.c | 2 +-
arch/sh/boards/mach-ap325rxa/setup.c | 2 +-
arch/sh/boards/mach-ecovec24/setup.c | 4 ++--
arch/sh/boards/mach-kfr2r09/setup.c | 2 +-
arch/sh/boards/mach-migor/setup.c | 2 +-
arch/sh/boards/mach-se/7724/setup.c | 4 ++--
arch/sparc/kernel/smp_64.c | 2 +-
arch/um/kernel/mem.c | 2 +-
arch/x86/kernel/setup.c | 4 ++--
arch/x86/kernel/setup_percpu.c | 2 +-
arch/x86/mm/init.c | 2 +-
arch/x86/mm/kasan_init_64.c | 4 ++--
arch/x86/mm/numa.c | 2 +-
arch/x86/mm/numa_emulation.c | 2 +-
arch/x86/xen/mmu_pv.c | 6 +++---
arch/x86/xen/p2m.c | 2 +-
arch/x86/xen/setup.c | 6 +++---
drivers/base/arch_numa.c | 4 ++--
drivers/firmware/efi/memmap.c | 2 +-
drivers/macintosh/smu.c | 2 +-
drivers/of/kexec.c | 2 +-
drivers/of/of_reserved_mem.c | 4 ++--
drivers/s390/char/sclp_early.c | 2 +-
drivers/usb/early/xhci-dbc.c | 10 +++++-----
drivers/xen/swiotlb-xen.c | 2 +-
include/linux/memblock.h | 16 ++--------------
init/initramfs.c | 2 +-
init/main.c | 2 +-
kernel/dma/swiotlb.c | 2 +-
kernel/printk/printk.c | 4 ++--
lib/bootconfig.c | 2 +-
lib/cpumask.c | 2 +-
mm/cma.c | 2 +-
mm/memblock.c | 20 ++++++++++----------
mm/memory_hotplug.c | 2 +-
mm/percpu.c | 8 ++++----
mm/sparse.c | 2 +-
tools/bootconfig/include/linux/memblock.h | 2 +-
55 files changed, 92 insertions(+), 106 deletions(-)
diff --git a/arch/alpha/kernel/core_irongate.c b/arch/alpha/kernel/core_irongate.c
index 72af1e72d833..6b8ed12936b6 100644
--- a/arch/alpha/kernel/core_irongate.c
+++ b/arch/alpha/kernel/core_irongate.c
@@ -233,7 +233,7 @@ albacore_init_arch(void)
unsigned long size;
size = initrd_end - initrd_start;
- memblock_free(__pa(initrd_start), PAGE_ALIGN(size));
+ memblock_free((void *)initrd_start, PAGE_ALIGN(size));
if (!move_initrd(pci_mem))
printk("irongate_init_arch: initrd too big "
"(%ldK)\ndisabling initrd\n",
diff --git a/arch/arc/mm/init.c b/arch/arc/mm/init.c
index 699ecf119641..59408f6a02d4 100644
--- a/arch/arc/mm/init.c
+++ b/arch/arc/mm/init.c
@@ -173,7 +173,7 @@ static void __init highmem_init(void)
#ifdef CONFIG_HIGHMEM
unsigned long tmp;
- memblock_free(high_mem_start, high_mem_sz);
+ memblock_phys_free(high_mem_start, high_mem_sz);
for (tmp = min_high_pfn; tmp < max_high_pfn; tmp++)
free_highmem_page(pfn_to_page(tmp));
#endif
diff --git a/arch/arm/mach-hisi/platmcpm.c b/arch/arm/mach-hisi/platmcpm.c
index 96a484095194..258586e31333 100644
--- a/arch/arm/mach-hisi/platmcpm.c
+++ b/arch/arm/mach-hisi/platmcpm.c
@@ -339,7 +339,7 @@ static int __init hip04_smp_init(void)
err_sysctrl:
iounmap(relocation);
err_reloc:
- memblock_free(hip04_boot_method[0], hip04_boot_method[1]);
+ memblock_phys_free(hip04_boot_method[0], hip04_boot_method[1]);
err:
return ret;
}
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 6162a070a410..6d0cb0f7bc54 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -158,7 +158,7 @@ phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
panic("Failed to steal %pa bytes at %pS\n",
&size, (void *)_RET_IP_);
- memblock_free(phys, size);
+ memblock_phys_free(phys, size);
memblock_remove(phys, size);
return phys;
diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c
index cfd9deb347c3..f68c2d953617 100644
--- a/arch/arm64/mm/mmu.c
+++ b/arch/arm64/mm/mmu.c
@@ -738,8 +738,8 @@ void __init paging_init(void)
cpu_replace_ttbr1(lm_alias(swapper_pg_dir));
init_mm.pgd = swapper_pg_dir;
- memblock_free(__pa_symbol(init_pg_dir),
- __pa_symbol(init_pg_end) - __pa_symbol(init_pg_dir));
+ memblock_phys_free(__pa_symbol(init_pg_dir),
+ __pa_symbol(init_pg_end) - __pa_symbol(init_pg_dir));
memblock_allow_resize();
}
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 19347dc6bbf8..325e1552cbea 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -529,7 +529,7 @@ static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size,
static void __init pcpu_fc_free(void *ptr, size_t size)
{
- memblock_free_early(__pa(ptr), size);
+ memblock_free(ptr, size);
}
void __init setup_per_cpu_areas(void)
diff --git a/arch/mips/sgi-ip30/ip30-setup.c b/arch/mips/sgi-ip30/ip30-setup.c
index 44b1607e964d..75a34684e704 100644
--- a/arch/mips/sgi-ip30/ip30-setup.c
+++ b/arch/mips/sgi-ip30/ip30-setup.c
@@ -69,10 +69,10 @@ static void __init ip30_mem_init(void)
total_mem += size;
if (addr >= IP30_REAL_MEMORY_START)
- memblock_free(addr, size);
+ memblock_phys_free(addr, size);
else if ((addr + size) > IP30_REAL_MEMORY_START)
- memblock_free(IP30_REAL_MEMORY_START,
- size - IP30_MAX_PROM_MEMORY);
+ memblock_phys_free(IP30_REAL_MEMORY_START,
+ size - IP30_MAX_PROM_MEMORY);
}
pr_info("Detected %luMB of physical memory.\n", MEM_SHIFT(total_mem));
}
diff --git a/arch/powerpc/kernel/dt_cpu_ftrs.c b/arch/powerpc/kernel/dt_cpu_ftrs.c
index 358aee7c2d79..705757f1a809 100644
--- a/arch/powerpc/kernel/dt_cpu_ftrs.c
+++ b/arch/powerpc/kernel/dt_cpu_ftrs.c
@@ -1095,7 +1095,7 @@ static int __init dt_cpu_ftrs_scan_callback(unsigned long node, const char
cpufeatures_setup_finished();
- memblock_free(__pa(dt_cpu_features),
+ memblock_free(dt_cpu_features,
sizeof(struct dt_cpu_feature)*nr_dt_cpu_features);
return 0;
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 9bd30cac852b..4e3bde0e0679 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -322,7 +322,7 @@ void __init free_unused_pacas(void)
new_ptrs_size = sizeof(struct paca_struct *) * nr_cpu_ids;
if (new_ptrs_size < paca_ptrs_size)
- memblock_free(__pa(paca_ptrs) + new_ptrs_size,
+ memblock_free(paca_ptrs + new_ptrs_size,
paca_ptrs_size - new_ptrs_size);
paca_nr_cpu_ids = nr_cpu_ids;
@@ -331,7 +331,7 @@ void __init free_unused_pacas(void)
#ifdef CONFIG_PPC_BOOK3S_64
if (early_radix_enabled()) {
/* Ugly fixup, see new_slb_shadow() */
- memblock_free(__pa(paca_ptrs[boot_cpuid]->slb_shadow_ptr),
+ memblock_free(paca_ptrs[boot_cpuid]->slb_shadow_ptr,
sizeof(struct slb_shadow));
paca_ptrs[boot_cpuid]->slb_shadow_ptr = NULL;
}
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index b1e43b69a559..6b1338db8779 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -825,7 +825,7 @@ static void __init smp_setup_pacas(void)
set_hard_smp_processor_id(cpu, cpu_to_phys_id[cpu]);
}
- memblock_free(__pa(cpu_to_phys_id), nr_cpu_ids * sizeof(u32));
+ memblock_free(cpu_to_phys_id, nr_cpu_ids * sizeof(u32));
cpu_to_phys_id = NULL;
}
#endif
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index eaa79a0996d1..1777e992b20b 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -812,7 +812,7 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, size_t size,
static void __init pcpu_free_bootmem(void *ptr, size_t size)
{
- memblock_free(__pa(ptr), size);
+ memblock_free(ptr, size);
}
static int pcpu_cpu_distance(unsigned int from, unsigned int to)
diff --git a/arch/powerpc/platforms/powernv/pci-ioda.c b/arch/powerpc/platforms/powernv/pci-ioda.c
index 3dd35c327d1c..004cd6a96c8a 100644
--- a/arch/powerpc/platforms/powernv/pci-ioda.c
+++ b/arch/powerpc/platforms/powernv/pci-ioda.c
@@ -2981,7 +2981,7 @@ static void __init pnv_pci_init_ioda_phb(struct device_node *np,
if (!phb->hose) {
pr_err(" Can't allocate PCI controller for %pOF\n",
np);
- memblock_free(__pa(phb), sizeof(struct pnv_phb));
+ memblock_free(phb, sizeof(struct pnv_phb));
return;
}
diff --git a/arch/powerpc/platforms/pseries/svm.c b/arch/powerpc/platforms/pseries/svm.c
index 87f001b4c4e4..aa79a96a2749 100644
--- a/arch/powerpc/platforms/pseries/svm.c
+++ b/arch/powerpc/platforms/pseries/svm.c
@@ -55,9 +55,7 @@ void __init svm_swiotlb_init(void)
if (vstart && !swiotlb_init_with_tbl(vstart, io_tlb_nslabs, false))
return;
-
- memblock_free_early(__pa(vstart),
- PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
+ memblock_free(vstart, PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
panic("SVM: Cannot allocate SWIOTLB buffer");
}
diff --git a/arch/riscv/kernel/setup.c b/arch/riscv/kernel/setup.c
index b9620e5f00ba..b42bfdc67482 100644
--- a/arch/riscv/kernel/setup.c
+++ b/arch/riscv/kernel/setup.c
@@ -230,13 +230,13 @@ static void __init init_resources(void)
/* Clean-up any unused pre-allocated resources */
if (res_idx >= 0)
- memblock_free(__pa(mem_res), (res_idx + 1) * sizeof(*mem_res));
+ memblock_free(mem_res, (res_idx + 1) * sizeof(*mem_res));
return;
error:
/* Better an empty resource tree than an inconsistent one */
release_child_resources(&iomem_resource);
- memblock_free(__pa(mem_res), mem_res_sz);
+ memblock_free(mem_res, mem_res_sz);
}
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index 67e5fff96ee0..d09895bc66cc 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -693,7 +693,7 @@ static void __init reserve_crashkernel(void)
}
if (register_memory_notifier(&kdump_mem_nb)) {
- memblock_free(crash_base, crash_size);
+ memblock_phys_free(crash_base, crash_size);
return;
}
@@ -748,7 +748,7 @@ static void __init free_mem_detect_info(void)
get_mem_detect_reserved(&start, &size);
if (size)
- memblock_free(start, size);
+ memblock_phys_free(start, size);
}
static const char * __init get_mem_info_source(void)
@@ -793,7 +793,7 @@ static void __init check_initrd(void)
if (initrd_data.start && initrd_data.size &&
!memblock_is_region_memory(initrd_data.start, initrd_data.size)) {
pr_err("The initial RAM disk does not fit into the memory\n");
- memblock_free(initrd_data.start, initrd_data.size);
+ memblock_phys_free(initrd_data.start, initrd_data.size);
initrd_start = initrd_end = 0;
}
#endif
@@ -890,7 +890,7 @@ static void __init setup_randomness(void)
if (stsi(vmms, 3, 2, 2) == 0 && vmms->count)
add_device_randomness(&vmms->vm, sizeof(vmms->vm[0]) * vmms->count);
- memblock_free((unsigned long) vmms, PAGE_SIZE);
+ memblock_phys_free((unsigned long) vmms, PAGE_SIZE);
}
/*
diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
index 1a04e5bdf655..37826d8c4f74 100644
--- a/arch/s390/kernel/smp.c
+++ b/arch/s390/kernel/smp.c
@@ -723,7 +723,7 @@ void __init smp_save_dump_cpus(void)
/* Get the CPU registers */
smp_save_cpu_regs(sa, addr, is_boot_cpu, page);
}
- memblock_free(page, PAGE_SIZE);
+ memblock_phys_free(page, PAGE_SIZE);
diag_amode31_ops.diag308_reset();
pcpu_set_smt(0);
}
@@ -880,7 +880,7 @@ void __init smp_detect_cpus(void)
/* Add CPUs present at boot */
__smp_rescan_cpus(info, true);
- memblock_free_early((unsigned long)info, sizeof(*info));
+ memblock_free(info, sizeof(*info));
}
/*
diff --git a/arch/s390/kernel/uv.c b/arch/s390/kernel/uv.c
index 5a656c7b7a67..d57457b16fe5 100644
--- a/arch/s390/kernel/uv.c
+++ b/arch/s390/kernel/uv.c
@@ -64,7 +64,7 @@ void __init setup_uv(void)
}
if (uv_init(uv_stor_base, uv_info.uv_base_stor_len)) {
- memblock_free(uv_stor_base, uv_info.uv_base_stor_len);
+ memblock_phys_free(uv_stor_base, uv_info.uv_base_stor_len);
goto fail;
}
diff --git a/arch/s390/mm/kasan_init.c b/arch/s390/mm/kasan_init.c
index 3e4735168019..483b9dbe0970 100644
--- a/arch/s390/mm/kasan_init.c
+++ b/arch/s390/mm/kasan_init.c
@@ -399,5 +399,5 @@ void __init kasan_copy_shadow_mapping(void)
void __init kasan_free_early_identity(void)
{
- memblock_free(pgalloc_pos, pgalloc_freeable - pgalloc_pos);
+ memblock_phys_free(pgalloc_pos, pgalloc_freeable - pgalloc_pos);
}
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index bac8a058ebd7..c77b5f00a66a 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -560,7 +560,7 @@ static void __init ap325rxa_mv_mem_reserve(void)
if (!phys)
panic("Failed to allocate CEU memory\n");
- memblock_free(phys, size);
+ memblock_phys_free(phys, size);
memblock_remove(phys, size);
ceu_dma_membase = phys;
diff --git a/arch/sh/boards/mach-ecovec24/setup.c b/arch/sh/boards/mach-ecovec24/setup.c
index bab91a99124e..2b22ce792147 100644
--- a/arch/sh/boards/mach-ecovec24/setup.c
+++ b/arch/sh/boards/mach-ecovec24/setup.c
@@ -1502,7 +1502,7 @@ static void __init ecovec_mv_mem_reserve(void)
if (!phys)
panic("Failed to allocate CEU0 memory\n");
- memblock_free(phys, size);
+ memblock_phys_free(phys, size);
memblock_remove(phys, size);
ceu0_dma_membase = phys;
@@ -1510,7 +1510,7 @@ static void __init ecovec_mv_mem_reserve(void)
if (!phys)
panic("Failed to allocate CEU1 memory\n");
- memblock_free(phys, size);
+ memblock_phys_free(phys, size);
memblock_remove(phys, size);
ceu1_dma_membase = phys;
}
diff --git a/arch/sh/boards/mach-kfr2r09/setup.c b/arch/sh/boards/mach-kfr2r09/setup.c
index eeb5ce341efd..20f4db778ed6 100644
--- a/arch/sh/boards/mach-kfr2r09/setup.c
+++ b/arch/sh/boards/mach-kfr2r09/setup.c
@@ -633,7 +633,7 @@ static void __init kfr2r09_mv_mem_reserve(void)
if (!phys)
panic("Failed to allocate CEU memory\n");
- memblock_free(phys, size);
+ memblock_phys_free(phys, size);
memblock_remove(phys, size);
ceu_dma_membase = phys;
diff --git a/arch/sh/boards/mach-migor/setup.c b/arch/sh/boards/mach-migor/setup.c
index 6703a2122c0d..f60061283c48 100644
--- a/arch/sh/boards/mach-migor/setup.c
+++ b/arch/sh/boards/mach-migor/setup.c
@@ -633,7 +633,7 @@ static void __init migor_mv_mem_reserve(void)
if (!phys)
panic("Failed to allocate CEU memory\n");
- memblock_free(phys, size);
+ memblock_phys_free(phys, size);
memblock_remove(phys, size);
ceu_dma_membase = phys;
diff --git a/arch/sh/boards/mach-se/7724/setup.c b/arch/sh/boards/mach-se/7724/setup.c
index 8d6541ba0186..8bbf5a6aa423 100644
--- a/arch/sh/boards/mach-se/7724/setup.c
+++ b/arch/sh/boards/mach-se/7724/setup.c
@@ -966,7 +966,7 @@ static void __init ms7724se_mv_mem_reserve(void)
if (!phys)
panic("Failed to allocate CEU0 memory\n");
- memblock_free(phys, size);
+ memblock_phys_free(phys, size);
memblock_remove(phys, size);
ceu0_dma_membase = phys;
@@ -974,7 +974,7 @@ static void __init ms7724se_mv_mem_reserve(void)
if (!phys)
panic("Failed to allocate CEU1 memory\n");
- memblock_free(phys, size);
+ memblock_phys_free(phys, size);
memblock_remove(phys, size);
ceu1_dma_membase = phys;
}
diff --git a/arch/sparc/kernel/smp_64.c b/arch/sparc/kernel/smp_64.c
index 0224d8f19ed6..b98a7bbe6728 100644
--- a/arch/sparc/kernel/smp_64.c
+++ b/arch/sparc/kernel/smp_64.c
@@ -1567,7 +1567,7 @@ static void * __init pcpu_alloc_bootmem(unsigned int cpu, size_t size,
static void __init pcpu_free_bootmem(void *ptr, size_t size)
{
- memblock_free(__pa(ptr), size);
+ memblock_free(ptr, size);
}
static int __init pcpu_cpu_distance(unsigned int from, unsigned int to)
diff --git a/arch/um/kernel/mem.c b/arch/um/kernel/mem.c
index 8e636ce02949..0039771eb01c 100644
--- a/arch/um/kernel/mem.c
+++ b/arch/um/kernel/mem.c
@@ -47,7 +47,7 @@ void __init mem_init(void)
*/
brk_end = (unsigned long) UML_ROUND_UP(sbrk(0));
map_memory(brk_end, __pa(brk_end), uml_reserved - brk_end, 1, 1, 0);
- memblock_free(__pa(brk_end), uml_reserved - brk_end);
+ memblock_free((void *)brk_end, uml_reserved - brk_end);
uml_reserved = brk_end;
/* this will put all low memory onto the freelists */
diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
index 79f164141116..1bbe9b6173ef 100644
--- a/arch/x86/kernel/setup.c
+++ b/arch/x86/kernel/setup.c
@@ -322,7 +322,7 @@ static void __init reserve_initrd(void)
relocate_initrd();
- memblock_free(ramdisk_image, ramdisk_end - ramdisk_image);
+ memblock_phys_free(ramdisk_image, ramdisk_end - ramdisk_image);
}
#else
@@ -521,7 +521,7 @@ static void __init reserve_crashkernel(void)
}
if (crash_base >= (1ULL << 32) && reserve_crashkernel_low()) {
- memblock_free(crash_base, crash_size);
+ memblock_phys_free(crash_base, crash_size);
return;
}
diff --git a/arch/x86/kernel/setup_percpu.c b/arch/x86/kernel/setup_percpu.c
index 5afd98559193..7b65275544b2 100644
--- a/arch/x86/kernel/setup_percpu.c
+++ b/arch/x86/kernel/setup_percpu.c
@@ -135,7 +135,7 @@ static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size, size_t align)
static void __init pcpu_fc_free(void *ptr, size_t size)
{
- memblock_free_ptr(ptr, size);
+ memblock_free(ptr, size);
}
static int __init pcpu_cpu_distance(unsigned int from, unsigned int to)
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 23a14d82e783..1895986842b9 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -618,7 +618,7 @@ static void __init memory_map_top_down(unsigned long map_start,
*/
addr = memblock_phys_alloc_range(PMD_SIZE, PMD_SIZE, map_start,
map_end);
- memblock_free(addr, PMD_SIZE);
+ memblock_phys_free(addr, PMD_SIZE);
real_end = addr + PMD_SIZE;
/* step_size need to be small so pgt_buf from BRK could cover it */
diff --git a/arch/x86/mm/kasan_init_64.c b/arch/x86/mm/kasan_init_64.c
index ef885370719a..e7b9b464a82f 100644
--- a/arch/x86/mm/kasan_init_64.c
+++ b/arch/x86/mm/kasan_init_64.c
@@ -49,7 +49,7 @@ static void __init kasan_populate_pmd(pmd_t *pmd, unsigned long addr,
p = early_alloc(PMD_SIZE, nid, false);
if (p && pmd_set_huge(pmd, __pa(p), PAGE_KERNEL))
return;
- memblock_free_ptr(p, PMD_SIZE);
+ memblock_free(p, PMD_SIZE);
}
p = early_alloc(PAGE_SIZE, nid, true);
@@ -85,7 +85,7 @@ static void __init kasan_populate_pud(pud_t *pud, unsigned long addr,
p = early_alloc(PUD_SIZE, nid, false);
if (p && pud_set_huge(pud, __pa(p), PAGE_KERNEL))
return;
- memblock_free_ptr(p, PUD_SIZE);
+ memblock_free(p, PUD_SIZE);
}
p = early_alloc(PAGE_SIZE, nid, true);
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 1e9b93b088db..c6b1213086d6 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -355,7 +355,7 @@ void __init numa_reset_distance(void)
/* numa_distance could be 1LU marking allocation failure, test cnt */
if (numa_distance_cnt)
- memblock_free_ptr(numa_distance, size);
+ memblock_free(numa_distance, size);
numa_distance_cnt = 0;
numa_distance = NULL; /* enable table creation */
}
diff --git a/arch/x86/mm/numa_emulation.c b/arch/x86/mm/numa_emulation.c
index e801e30089c4..1a02b791d273 100644
--- a/arch/x86/mm/numa_emulation.c
+++ b/arch/x86/mm/numa_emulation.c
@@ -517,7 +517,7 @@ void __init numa_emulation(struct numa_meminfo *numa_meminfo, int numa_dist_cnt)
}
/* free the copied physical distance table */
- memblock_free_ptr(phys_dist, phys_size);
+ memblock_free(phys_dist, phys_size);
return;
no_emu:
diff --git a/arch/x86/xen/mmu_pv.c b/arch/x86/xen/mmu_pv.c
index 8d751939c6f3..0c831ad78933 100644
--- a/arch/x86/xen/mmu_pv.c
+++ b/arch/x86/xen/mmu_pv.c
@@ -1025,7 +1025,7 @@ static void __init xen_free_ro_pages(unsigned long paddr, unsigned long size)
for (; vaddr < vaddr_end; vaddr += PAGE_SIZE)
make_lowmem_page_readwrite(vaddr);
- memblock_free(paddr, size);
+ memblock_phys_free(paddr, size);
}
static void __init xen_cleanmfnmap_free_pgtbl(void *pgtbl, bool unpin)
@@ -1151,7 +1151,7 @@ static void __init xen_pagetable_p2m_free(void)
xen_cleanhighmap(addr, addr + size);
size = PAGE_ALIGN(xen_start_info->nr_pages *
sizeof(unsigned long));
- memblock_free(__pa(addr), size);
+ memblock_free((void *)addr, size);
} else {
xen_cleanmfnmap(addr);
}
@@ -1955,7 +1955,7 @@ void __init xen_relocate_p2m(void)
pfn_end = p2m_pfn_end;
}
- memblock_free(PFN_PHYS(pfn), PAGE_SIZE * (pfn_end - pfn));
+ memblock_phys_free(PFN_PHYS(pfn), PAGE_SIZE * (pfn_end - pfn));
while (pfn < pfn_end) {
if (pfn == p2m_pfn) {
pfn = p2m_pfn_end;
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 141bb9dbd2fb..58db86f7b384 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -197,7 +197,7 @@ static void * __ref alloc_p2m_page(void)
static void __ref free_p2m_page(void *p)
{
if (unlikely(!slab_is_available())) {
- memblock_free_ptr(p, PAGE_SIZE);
+ memblock_free(p, PAGE_SIZE);
return;
}
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 8bfc10330107..f387fc7e5250 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -153,7 +153,7 @@ static void __init xen_del_extra_mem(unsigned long start_pfn,
break;
}
}
- memblock_free(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns));
+ memblock_phys_free(PFN_PHYS(start_pfn), PFN_PHYS(n_pfns));
}
/*
@@ -719,7 +719,7 @@ static void __init xen_reserve_xen_mfnlist(void)
return;
xen_relocate_p2m();
- memblock_free(start, size);
+ memblock_phys_free(start, size);
}
/**
@@ -885,7 +885,7 @@ char * __init xen_memory_setup(void)
xen_phys_memcpy(new_area, start, size);
pr_info("initrd moved from [mem %#010llx-%#010llx] to [mem %#010llx-%#010llx]\n",
start, start + size, new_area, new_area + size);
- memblock_free(start, size);
+ memblock_phys_free(start, size);
boot_params.hdr.ramdisk_image = new_area;
boot_params.ext_ramdisk_image = new_area >> 32;
}
diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
index f6d0efd01188..cad34cec3acc 100644
--- a/drivers/base/arch_numa.c
+++ b/drivers/base/arch_numa.c
@@ -165,7 +165,7 @@ static void * __init pcpu_fc_alloc(unsigned int cpu, size_t size,
static void __init pcpu_fc_free(void *ptr, size_t size)
{
- memblock_free_early(__pa(ptr), size);
+ memblock_free(ptr, size);
}
void __init setup_per_cpu_areas(void)
@@ -264,7 +264,7 @@ void __init numa_free_distance(void)
size = numa_distance_cnt * numa_distance_cnt *
sizeof(numa_distance[0]);
- memblock_free_ptr(numa_distance, size);
+ memblock_free(numa_distance, size);
numa_distance_cnt = 0;
numa_distance = NULL;
}
diff --git a/drivers/firmware/efi/memmap.c b/drivers/firmware/efi/memmap.c
index 2ff1883dc788..4df55a55da84 100644
--- a/drivers/firmware/efi/memmap.c
+++ b/drivers/firmware/efi/memmap.c
@@ -35,7 +35,7 @@ void __init __efi_memmap_free(u64 phys, unsigned long size, unsigned long flags)
if (slab_is_available())
memblock_free_late(phys, size);
else
- memblock_free(phys, size);
+ memblock_phys_free(phys, size);
} else if (flags & EFI_MEMMAP_SLAB) {
struct page *p = pfn_to_page(PHYS_PFN(phys));
unsigned int order = get_order(size);
diff --git a/drivers/macintosh/smu.c b/drivers/macintosh/smu.c
index fe63d5ee201b..f62152111236 100644
--- a/drivers/macintosh/smu.c
+++ b/drivers/macintosh/smu.c
@@ -570,7 +570,7 @@ int __init smu_init (void)
fail_db_node:
of_node_put(smu->db_node);
fail_bootmem:
- memblock_free_ptr(smu, sizeof(struct smu_device));
+ memblock_free(smu, sizeof(struct smu_device));
smu = NULL;
fail_np:
of_node_put(np);
diff --git a/drivers/of/kexec.c b/drivers/of/kexec.c
index 761fd870d1db..8d07f73a4389 100644
--- a/drivers/of/kexec.c
+++ b/drivers/of/kexec.c
@@ -170,7 +170,7 @@ int ima_free_kexec_buffer(void)
if (ret)
return ret;
- return memblock_free(addr, size);
+ return memblock_phys_free(addr, size);
}
diff --git a/drivers/of/of_reserved_mem.c b/drivers/of/of_reserved_mem.c
index 59c1390cdf42..c48d0dce13eb 100644
--- a/drivers/of/of_reserved_mem.c
+++ b/drivers/of/of_reserved_mem.c
@@ -45,7 +45,7 @@ static int __init early_init_dt_alloc_reserved_memory_arch(phys_addr_t size,
if (nomap) {
err = memblock_mark_nomap(base, size);
if (err)
- memblock_free(base, size);
+ memblock_phys_free(base, size);
}
return err;
@@ -282,7 +282,7 @@ void __init fdt_init_reserved_mem(void)
if (nomap)
memblock_clear_nomap(rmem->base, rmem->size);
else
- memblock_free(rmem->base, rmem->size);
+ memblock_phys_free(rmem->base, rmem->size);
}
}
}
diff --git a/drivers/s390/char/sclp_early.c b/drivers/s390/char/sclp_early.c
index f3d5c7f4c13d..98247a4a64b7 100644
--- a/drivers/s390/char/sclp_early.c
+++ b/drivers/s390/char/sclp_early.c
@@ -139,7 +139,7 @@ int __init sclp_early_get_core_info(struct sclp_core_info *info)
}
sclp_fill_core_info(info, sccb);
out:
- memblock_free_early((unsigned long)sccb, length);
+ memblock_free(sccb, length);
return rc;
}
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index be4ecbabdd58..933d77ad0a64 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -185,7 +185,7 @@ static void __init xdbc_free_ring(struct xdbc_ring *ring)
if (!seg)
return;
- memblock_free(seg->dma, PAGE_SIZE);
+ memblock_phys_free(seg->dma, PAGE_SIZE);
ring->segment = NULL;
}
@@ -665,10 +665,10 @@ int __init early_xdbc_setup_hardware(void)
xdbc_free_ring(&xdbc.in_ring);
if (xdbc.table_dma)
- memblock_free(xdbc.table_dma, PAGE_SIZE);
+ memblock_phys_free(xdbc.table_dma, PAGE_SIZE);
if (xdbc.out_dma)
- memblock_free(xdbc.out_dma, PAGE_SIZE);
+ memblock_phys_free(xdbc.out_dma, PAGE_SIZE);
xdbc.table_base = NULL;
xdbc.out_buf = NULL;
@@ -987,8 +987,8 @@ static int __init xdbc_init(void)
xdbc_free_ring(&xdbc.evt_ring);
xdbc_free_ring(&xdbc.out_ring);
xdbc_free_ring(&xdbc.in_ring);
- memblock_free(xdbc.table_dma, PAGE_SIZE);
- memblock_free(xdbc.out_dma, PAGE_SIZE);
+ memblock_phys_free(xdbc.table_dma, PAGE_SIZE);
+ memblock_phys_free(xdbc.out_dma, PAGE_SIZE);
writel(0, &xdbc.xdbc_reg->control);
early_iounmap(xdbc.xhci_base, xdbc.xhci_length);
diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c
index 8c10edf9efe6..bad266ea3bcd 100644
--- a/drivers/xen/swiotlb-xen.c
+++ b/drivers/xen/swiotlb-xen.c
@@ -240,7 +240,7 @@ void __init xen_swiotlb_init_early(void)
*/
rc = xen_swiotlb_fixup(start, nslabs);
if (rc) {
- memblock_free(__pa(start), PAGE_ALIGN(bytes));
+ memblock_free(start, PAGE_ALIGN(bytes));
if (nslabs > 1024 && repeat--) {
/* Min is 2MB */
nslabs = max(1024UL, ALIGN(nslabs >> 1, IO_TLB_SEGSIZE));
diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index 34de69b3b8ba..e1f73b81d595 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -103,7 +103,7 @@ void memblock_allow_resize(void);
int memblock_add_node(phys_addr_t base, phys_addr_t size, int nid);
int memblock_add(phys_addr_t base, phys_addr_t size);
int memblock_remove(phys_addr_t base, phys_addr_t size);
-int memblock_free(phys_addr_t base, phys_addr_t size);
+int memblock_phys_free(phys_addr_t base, phys_addr_t size);
int memblock_reserve(phys_addr_t base, phys_addr_t size);
#ifdef CONFIG_HAVE_MEMBLOCK_PHYS_MAP
int memblock_physmem_add(phys_addr_t base, phys_addr_t size);
@@ -117,8 +117,8 @@ int memblock_mark_mirror(phys_addr_t base, phys_addr_t size);
int memblock_mark_nomap(phys_addr_t base, phys_addr_t size);
int memblock_clear_nomap(phys_addr_t base, phys_addr_t size);
+void memblock_free(void *ptr, size_t size);
void memblock_free_all(void);
-void memblock_free_ptr(void *ptr, size_t size);
void reset_node_managed_pages(pg_data_t *pgdat);
void reset_all_zones_managed_pages(void);
@@ -441,18 +441,6 @@ static inline void *memblock_alloc_node(phys_addr_t size,
MEMBLOCK_ALLOC_ACCESSIBLE, nid);
}
-static inline void memblock_free_early(phys_addr_t base,
- phys_addr_t size)
-{
- memblock_free(base, size);
-}
-
-static inline void memblock_free_early_nid(phys_addr_t base,
- phys_addr_t size, int nid)
-{
- memblock_free(base, size);
-}
-
static inline void memblock_free_late(phys_addr_t base, phys_addr_t size)
{
__memblock_free_late(base, size);
diff --git a/init/initramfs.c b/init/initramfs.c
index a842c0544745..c48748217c28 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -607,7 +607,7 @@ void __weak __init free_initrd_mem(unsigned long start, unsigned long end)
unsigned long aligned_start = ALIGN_DOWN(start, PAGE_SIZE);
unsigned long aligned_end = ALIGN(end, PAGE_SIZE);
- memblock_free(__pa(aligned_start), aligned_end - aligned_start);
+ memblock_free((void*)aligned_start, aligned_end - aligned_start);
#endif
free_reserved_area((void *)start, (void *)end, POISON_FREE_INITMEM,
diff --git a/init/main.c b/init/main.c
index 3f7216934441..a0714600a83f 100644
--- a/init/main.c
+++ b/init/main.c
@@ -924,7 +924,7 @@ static void __init print_unknown_bootoptions(void)
end += sprintf(end, " %s", *p);
pr_notice("Unknown command line parameters:%s\n", unknown_options);
- memblock_free_ptr(unknown_options, len);
+ memblock_free(unknown_options, len);
}
asmlinkage __visible void __init __no_sanitize_address start_kernel(void)
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c
index 87c40517e822..02656d7ccbfd 100644
--- a/kernel/dma/swiotlb.c
+++ b/kernel/dma/swiotlb.c
@@ -247,7 +247,7 @@ swiotlb_init(int verbose)
return;
fail_free_mem:
- memblock_free_early(__pa(tlb), bytes);
+ memblock_free(tlb, bytes);
fail:
pr_warn("Cannot allocate buffer");
}
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index a8d0a58deebc..2cae1bfa6be7 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -1166,9 +1166,9 @@ void __init setup_log_buf(int early)
return;
err_free_descs:
- memblock_free_ptr(new_descs, new_descs_size);
+ memblock_free(new_descs, new_descs_size);
err_free_log_buf:
- memblock_free_ptr(new_log_buf, new_log_buf_len);
+ memblock_free(new_log_buf, new_log_buf_len);
}
static bool __read_mostly ignore_loglevel;
diff --git a/lib/bootconfig.c b/lib/bootconfig.c
index 5ae248b29373..547558d80e64 100644
--- a/lib/bootconfig.c
+++ b/lib/bootconfig.c
@@ -792,7 +792,7 @@ void __init xbc_destroy_all(void)
xbc_data = NULL;
xbc_data_size = 0;
xbc_node_num = 0;
- memblock_free_ptr(xbc_nodes, sizeof(struct xbc_node) * XBC_NODE_MAX);
+ memblock_free(xbc_nodes, sizeof(struct xbc_node) * XBC_NODE_MAX);
xbc_nodes = NULL;
brace_index = 0;
}
diff --git a/lib/cpumask.c b/lib/cpumask.c
index c3c76b833384..a971a82d2f43 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -188,7 +188,7 @@ EXPORT_SYMBOL(free_cpumask_var);
*/
void __init free_bootmem_cpumask_var(cpumask_var_t mask)
{
- memblock_free_early(__pa(mask), cpumask_size());
+ memblock_free(mask, cpumask_size());
}
#endif
diff --git a/mm/cma.c b/mm/cma.c
index 995e15480937..f9a53bc708f2 100644
--- a/mm/cma.c
+++ b/mm/cma.c
@@ -378,7 +378,7 @@ int __init cma_declare_contiguous_nid(phys_addr_t base,
return 0;
free_mem:
- memblock_free(base, size);
+ memblock_phys_free(base, size);
err:
pr_err("Failed to reserve %ld MiB\n", (unsigned long)size / SZ_1M);
return ret;
diff --git a/mm/memblock.c b/mm/memblock.c
index 184dcd2e5d99..affcfdda0ff8 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -472,7 +472,7 @@ static int __init_memblock memblock_double_array(struct memblock_type *type,
kfree(old_array);
else if (old_array != memblock_memory_init_regions &&
old_array != memblock_reserved_init_regions)
- memblock_free_ptr(old_array, old_alloc_size);
+ memblock_free(old_array, old_alloc_size);
/*
* Reserve the new array if that comes from the memblock. Otherwise, we
@@ -796,28 +796,28 @@ int __init_memblock memblock_remove(phys_addr_t base, phys_addr_t size)
}
/**
- * memblock_free_ptr - free boot memory allocation
- * @ptr: starting address of the boot memory allocation
+ * memblock_free - free boot memory allocation
+ * @ptr: starting *virtual* address of the boot memory allocation
* @size: size of the boot memory block in bytes
*
* Free boot memory block previously allocated by memblock_alloc_xx() API.
* The freeing memory will not be released to the buddy allocator.
*/
-void __init_memblock memblock_free_ptr(void *ptr, size_t size)
+void __init_memblock memblock_free(void *ptr, size_t size)
{
if (ptr)
- memblock_free(__pa(ptr), size);
+ memblock_phys_free(__pa(ptr), size);
}
/**
- * memblock_free - free boot memory block
- * @base: phys starting address of the boot memory block
+ * memblock_free_phys - free boot memory block
+ * @base: starting *physical* address of the boot memory block
* @size: size of the boot memory block in bytes
*
- * Free boot memory block previously allocated by memblock_alloc_xx() API.
+ * Free boot memory block previously allocated by memblock_phys_alloc_xx() API.
* The freeing memory will not be released to the buddy allocator.
*/
-int __init_memblock memblock_free(phys_addr_t base, phys_addr_t size)
+int __init_memblock memblock_phys_free(phys_addr_t base, phys_addr_t size)
{
phys_addr_t end = base + size - 1;
@@ -1934,7 +1934,7 @@ static void __init free_memmap(unsigned long start_pfn, unsigned long end_pfn)
* memmap array.
*/
if (pg < pgend)
- memblock_free(pg, pgend - pg);
+ memblock_phys_free(pg, pgend - pg);
}
/*
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 9fd0be32a281..feffaa9423fe 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -2204,7 +2204,7 @@ static int __ref try_remove_memory(u64 start, u64 size)
arch_remove_memory(start, size, altmap);
if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) {
- memblock_free(start, size);
+ memblock_phys_free(start, size);
memblock_remove(start, size);
}
diff --git a/mm/percpu.c b/mm/percpu.c
index e0a986818903..f5b2c2ea5a54 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -2472,7 +2472,7 @@ struct pcpu_alloc_info * __init pcpu_alloc_alloc_info(int nr_groups,
*/
void __init pcpu_free_alloc_info(struct pcpu_alloc_info *ai)
{
- memblock_free_early(__pa(ai), ai->__ai_size);
+ memblock_free(ai, ai->__ai_size);
}
/**
@@ -3134,7 +3134,7 @@ int __init pcpu_embed_first_chunk(size_t reserved_size, size_t dyn_size,
out_free:
pcpu_free_alloc_info(ai);
if (areas)
- memblock_free_early(__pa(areas), areas_size);
+ memblock_free(areas, areas_size);
return rc;
}
#endif /* BUILD_EMBED_FIRST_CHUNK */
@@ -3256,7 +3256,7 @@ int __init pcpu_page_first_chunk(size_t reserved_size,
free_fn(page_address(pages[j]), PAGE_SIZE);
rc = -ENOMEM;
out_free_ar:
- memblock_free_early(__pa(pages), pages_size);
+ memblock_free(pages, pages_size);
pcpu_free_alloc_info(ai);
return rc;
}
@@ -3286,7 +3286,7 @@ static void * __init pcpu_dfl_fc_alloc(unsigned int cpu, size_t size,
static void __init pcpu_dfl_fc_free(void *ptr, size_t size)
{
- memblock_free_early(__pa(ptr), size);
+ memblock_free(ptr, size);
}
void __init setup_per_cpu_areas(void)
diff --git a/mm/sparse.c b/mm/sparse.c
index 120bc8ea5293..e5c84b0cf0c9 100644
--- a/mm/sparse.c
+++ b/mm/sparse.c
@@ -451,7 +451,7 @@ static void *sparsemap_buf_end __meminitdata;
static inline void __meminit sparse_buffer_free(unsigned long size)
{
WARN_ON(!sparsemap_buf || size == 0);
- memblock_free_early(__pa(sparsemap_buf), size);
+ memblock_free(sparsemap_buf, size);
}
static void __init sparse_buffer_init(unsigned long size, int nid)
diff --git a/tools/bootconfig/include/linux/memblock.h b/tools/bootconfig/include/linux/memblock.h
index f2e506f7d57f..e6ea42e97b22 100644
--- a/tools/bootconfig/include/linux/memblock.h
+++ b/tools/bootconfig/include/linux/memblock.h
@@ -6,6 +6,6 @@
#define SMP_CACHE_BYTES 0
#define memblock_alloc(size, align) malloc(size)
-#define memblock_free_ptr(paddr, size) free(paddr)
+#define memblock_free(paddr, size) free(paddr)
#endif
--
2.28.0
^ permalink raw reply related
* [PATCH 2/3] xen/x86: free_p2m_page: use memblock_free_ptr() to free a virtual pointer
From: Mike Rapoport @ 2021-09-23 7:43 UTC (permalink / raw)
To: Linus Torvalds
Cc: devicetree, linux-efi, Mike Rapoport, kvm, linux-s390, linux-sh,
linux-um, linux-kernel, kasan-dev, linux-mips, linux-mm, iommu,
linux-usb, linux-alpha, sparclinux, xen-devel, Andrew Morton,
linux-snps-arc, linuxppc-dev, linux-riscv, linux-arm-kernel
In-Reply-To: <20210923074335.12583-1-rppt@kernel.org>
From: Mike Rapoport <rppt@linux.ibm.com>
free_p2m_page() wrongly passes a virtual pointer to memblock_free() that
treats it as a physical address.
Call memblock_free_ptr() instead that gets a virtual address to free the
memory.
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
arch/x86/xen/p2m.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 5e6e236977c7..141bb9dbd2fb 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -197,7 +197,7 @@ static void * __ref alloc_p2m_page(void)
static void __ref free_p2m_page(void *p)
{
if (unlikely(!slab_is_available())) {
- memblock_free((unsigned long)p, PAGE_SIZE);
+ memblock_free_ptr(p, PAGE_SIZE);
return;
}
--
2.28.0
^ permalink raw reply related
* [PATCH 1/3] arch_numa: simplify numa_distance allocation
From: Mike Rapoport @ 2021-09-23 7:43 UTC (permalink / raw)
To: Linus Torvalds
Cc: devicetree, linux-efi, Mike Rapoport, kvm, linux-s390, linux-sh,
linux-um, linux-kernel, kasan-dev, linux-mips, linux-mm, iommu,
linux-usb, linux-alpha, sparclinux, xen-devel, Andrew Morton,
linux-snps-arc, linuxppc-dev, linux-riscv, linux-arm-kernel
In-Reply-To: <20210923074335.12583-1-rppt@kernel.org>
From: Mike Rapoport <rppt@linux.ibm.com>
Memory allocation of numa_distance uses memblock_phys_alloc_range() without
actual range limits, converts the returned physical address to virtual and
then only uses the virtual address for further initialization.
Simplify this by replacing memblock_phys_alloc_range() with
memblock_alloc().
Signed-off-by: Mike Rapoport <rppt@linux.ibm.com>
---
drivers/base/arch_numa.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/base/arch_numa.c b/drivers/base/arch_numa.c
index 00fb4120a5b3..f6d0efd01188 100644
--- a/drivers/base/arch_numa.c
+++ b/drivers/base/arch_numa.c
@@ -275,15 +275,13 @@ void __init numa_free_distance(void)
static int __init numa_alloc_distance(void)
{
size_t size;
- u64 phys;
int i, j;
size = nr_node_ids * nr_node_ids * sizeof(numa_distance[0]);
- phys = memblock_phys_alloc_range(size, PAGE_SIZE, 0, PFN_PHYS(max_pfn));
- if (WARN_ON(!phys))
+ numa_distance = memblock_alloc(size, PAGE_SIZE);
+ if (WARN_ON(!numa_distance))
return -ENOMEM;
- numa_distance = __va(phys);
numa_distance_cnt = nr_node_ids;
/* fill with the default distances */
--
2.28.0
^ permalink raw reply related
* [PATCH 0/3] memblock: cleanup memblock_free interface
From: Mike Rapoport @ 2021-09-23 7:43 UTC (permalink / raw)
To: Linus Torvalds
Cc: devicetree, linux-efi, Mike Rapoport, kvm, linux-s390, linux-sh,
linux-um, linux-kernel, kasan-dev, linux-mips, linux-mm, iommu,
linux-usb, linux-alpha, sparclinux, xen-devel, Andrew Morton,
linux-snps-arc, linuxppc-dev, linux-riscv, linux-arm-kernel
From: Mike Rapoport <rppt@linux.ibm.com>
Hi,
Following the discussion on [1] this is the fix for memblock freeing APIs
mismatch.
The first patch is a cleanup of numa_distance allocation in arch_numa I've
spotted during the conversion.
The second patch is a fix for Xen memory freeing on some of the error
paths.
The core change is in the third patch that makes memblock_free() a
counterpart of memblock_alloc() and adds memblock_phys_alloc() to be a
counterpart of memblock_phys_alloc().
Since scripts/get_maintainer.pl returned more than 100 addresses I've
trimmed the distribution list only to the relevant lists.
[1] https://lore.kernel.org/all/CAHk-=wj9k4LZTz+svCxLYs5Y1=+yKrbAUArH1+ghyG3OLd8VVg@mail.gmail.com
Mike Rapoport (3):
arch_numa: simplify numa_distance allocation
xen/x86: free_p2m_page: use memblock_free_ptr() to free a virtual pointer
memblock: cleanup memblock_free interface
arch/alpha/kernel/core_irongate.c | 2 +-
arch/arc/mm/init.c | 2 +-
arch/arm/mach-hisi/platmcpm.c | 2 +-
arch/arm/mm/init.c | 2 +-
arch/arm64/mm/mmu.c | 4 ++--
arch/mips/mm/init.c | 2 +-
arch/mips/sgi-ip30/ip30-setup.c | 6 +++---
arch/powerpc/kernel/dt_cpu_ftrs.c | 2 +-
arch/powerpc/kernel/paca.c | 4 ++--
arch/powerpc/kernel/setup-common.c | 2 +-
arch/powerpc/kernel/setup_64.c | 2 +-
arch/powerpc/platforms/powernv/pci-ioda.c | 2 +-
arch/powerpc/platforms/pseries/svm.c | 4 +---
arch/riscv/kernel/setup.c | 4 ++--
arch/s390/kernel/setup.c | 8 ++++----
arch/s390/kernel/smp.c | 4 ++--
arch/s390/kernel/uv.c | 2 +-
arch/s390/mm/kasan_init.c | 2 +-
arch/sh/boards/mach-ap325rxa/setup.c | 2 +-
arch/sh/boards/mach-ecovec24/setup.c | 4 ++--
arch/sh/boards/mach-kfr2r09/setup.c | 2 +-
arch/sh/boards/mach-migor/setup.c | 2 +-
arch/sh/boards/mach-se/7724/setup.c | 4 ++--
arch/sparc/kernel/smp_64.c | 2 +-
arch/um/kernel/mem.c | 2 +-
arch/x86/kernel/setup.c | 4 ++--
arch/x86/kernel/setup_percpu.c | 2 +-
arch/x86/mm/init.c | 2 +-
arch/x86/mm/kasan_init_64.c | 4 ++--
arch/x86/mm/numa.c | 2 +-
arch/x86/mm/numa_emulation.c | 2 +-
arch/x86/xen/mmu_pv.c | 6 +++---
arch/x86/xen/p2m.c | 2 +-
arch/x86/xen/setup.c | 6 +++---
drivers/base/arch_numa.c | 10 ++++------
drivers/firmware/efi/memmap.c | 2 +-
drivers/macintosh/smu.c | 2 +-
drivers/of/kexec.c | 2 +-
drivers/of/of_reserved_mem.c | 4 ++--
drivers/s390/char/sclp_early.c | 2 +-
drivers/usb/early/xhci-dbc.c | 10 +++++-----
drivers/xen/swiotlb-xen.c | 2 +-
include/linux/memblock.h | 16 ++--------------
init/initramfs.c | 2 +-
init/main.c | 2 +-
kernel/dma/swiotlb.c | 2 +-
kernel/printk/printk.c | 4 ++--
lib/bootconfig.c | 2 +-
lib/cpumask.c | 2 +-
mm/cma.c | 2 +-
mm/memblock.c | 20 ++++++++++----------
mm/memory_hotplug.c | 2 +-
mm/percpu.c | 8 ++++----
mm/sparse.c | 2 +-
tools/bootconfig/include/linux/memblock.h | 2 +-
55 files changed, 94 insertions(+), 110 deletions(-)
base-commit: e4e737bb5c170df6135a127739a9e6148ee3da82
--
2.28.0
^ permalink raw reply
* Re: [PATCH AUTOSEL 5.10 01/26] ibmvnic: check failover_pending in login response
From: Pavel Machek @ 2021-09-23 7:33 UTC (permalink / raw)
To: Sasha Levin
Cc: linux-kernel, stable, netdev, drt, kuba, Sukadev Bhattiprolu,
linuxppc-dev, David S . Miller
In-Reply-To: <20210923033839.1421034-1-sashal@kernel.org>
[-- Attachment #1: Type: text/plain, Size: 303 bytes --]
Hi!
Something went wrong with this series. I only see first 7 patches. I
thought it might be local problem, but I only see 7 patches on lore...
https://lore.kernel.org/lkml/20210923033839.1421034-1-sashal@kernel.org/
Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply
* Re: [PATCH] powerpc/paravirt: correct preempt debug splat in vcpu_is_preempted()
From: Michael Ellerman @ 2021-09-23 7:29 UTC (permalink / raw)
To: Nathan Lynch, Srikar Dronamraju; +Cc: linuxppc-dev, npiggin
In-Reply-To: <87bl4ko1cp.fsf@linux.ibm.com>
Nathan Lynch <nathanl@linux.ibm.com> writes:
> Srikar Dronamraju <srikar@linux.vnet.ibm.com> writes:
>
>> * Nathan Lynch <nathanl@linux.ibm.com> [2021-09-22 11:01:12]:
>>
>>> Srikar Dronamraju <srikar@linux.vnet.ibm.com> writes:
>>> > * Nathan Lynch <nathanl@linux.ibm.com> [2021-09-20 22:12:13]:
>>> >
>>> >> vcpu_is_preempted() can be used outside of preempt-disabled critical
>>> >> sections, yielding warnings such as:
>>> >>
>>> >> BUG: using smp_processor_id() in preemptible [00000000] code: systemd-udevd/185
>>> >> caller is rwsem_spin_on_owner+0x1cc/0x2d0
>>> >> CPU: 1 PID: 185 Comm: systemd-udevd Not tainted 5.15.0-rc2+ #33
>>> >> Call Trace:
>>> >> [c000000012907ac0] [c000000000aa30a8] dump_stack_lvl+0xac/0x108 (unreliable)
>>> >> [c000000012907b00] [c000000001371f70] check_preemption_disabled+0x150/0x160
>>> >> [c000000012907b90] [c0000000001e0e8c] rwsem_spin_on_owner+0x1cc/0x2d0
>>> >> [c000000012907be0] [c0000000001e1408] rwsem_down_write_slowpath+0x478/0x9a0
>>> >> [c000000012907ca0] [c000000000576cf4] filename_create+0x94/0x1e0
>>> >> [c000000012907d10] [c00000000057ac08] do_symlinkat+0x68/0x1a0
>>> >> [c000000012907d70] [c00000000057ae18] sys_symlink+0x58/0x70
>>> >> [c000000012907da0] [c00000000002e448] system_call_exception+0x198/0x3c0
>>> >> [c000000012907e10] [c00000000000c54c] system_call_common+0xec/0x250
>>> >>
>>> >> The result of vcpu_is_preempted() is always subject to invalidation by
>>> >> events inside and outside of Linux; it's just a best guess at a point in
>>> >> time. Use raw_smp_processor_id() to avoid such warnings.
>>> >
>>> > Typically smp_processor_id() and raw_smp_processor_id() except for the
>>> > CONFIG_DEBUG_PREEMPT.
>>>
>>> Sorry, I don't follow...
>>
>> I meant, Unless CONFIG_DEBUG_PREEMPT, smp_processor_id() is defined as
>> raw_processor_id().
>>
>>>
>>> > In the CONFIG_DEBUG_PREEMPT case, smp_processor_id()
>>> > is actually debug_smp_processor_id(), which does all the checks.
>>>
>>> Yes, OK.
>>>
>>> > I believe these checks in debug_smp_processor_id() are only valid for x86
>>> > case (aka cases were they have __smp_processor_id() defined.)
>>>
>>> Hmm, I am under the impression that the checks in
>>> debug_smp_processor_id() are valid regardless of whether the arch
>>> overrides __smp_processor_id().
>>
>> From include/linux/smp.h
>>
>> /*
>> * Allow the architecture to differentiate between a stable and unstable read.
>> * For example, x86 uses an IRQ-safe asm-volatile read for the unstable but a
>> * regular asm read for the stable.
>> */
>> #ifndef __smp_processor_id
>> #define __smp_processor_id(x) raw_smp_processor_id(x)
>> #endif
>>
>> As far as I see, only x86 has a definition of __smp_processor_id.
>> So for archs like Powerpc, __smp_processor_id(), is always
>> defined as raw_smp_processor_id(). Right?
>
> Sure, yes.
>
>> I would think debug_smp_processor_id() would be useful if __smp_processor_id()
>> is different from raw_smp_processor_id(). Do note debug_smp_processor_id()
>> calls raw_smp_processor_id().
Agree.
> I do not think the utility of debug_smp_processor_id() is related to
> whether the arch defines __smp_processor_id().
>
>> Or can I understand how debug_smp_processor_id() is useful if
>> __smp_processor_id() is defined as raw_smp_processor_id()?
debug_smp_processor_id() is useful on powerpc, as well as other arches,
because it checks that we're in a context where the processor id won't
change out from under us.
eg. something like this is unsafe:
int counts[NR_CPUS];
int tmp, cpu;
cpu = smp_processor_id();
tmp = counts[cpu];
<- preempted here and migrated to another CPU
counts[cpu] = tmp + 1;
> So, for powerpc with DEBUG_PREEMPT unset, a call to smp_procesor_id()
> expands to __smp_processor_id() which expands to raw_smp_processor_id(),
> avoiding the preempt safety checks. This is working as intended.
>
> For powerpc with DEBUG_PREEMPT=y, a call to smp_processor_id() expands
> to the out of line call to debug_smp_processor_id(), which calls
> raw_smp_processor_id() and performs the checks, warning if called in an
> inappropriate context, as seen here. Also working as intended.
>
> AFAICT __smp_processor_id() is a performance/codegen-oriented hook, and
> not really related to the debug facility. Please see 9ed7d75b2f09d
> ("x86/percpu: Relax smp_processor_id()").
Yeah good find.
cheers
^ permalink raw reply
* Re: [PATCH v3 5/6] powerpc/64/interrupt: reduce expensive debug tests
From: Christophe Leroy @ 2021-09-23 5:13 UTC (permalink / raw)
To: Nicholas Piggin, linuxppc-dev
In-Reply-To: <20210922145452.352571-6-npiggin@gmail.com>
Le 22/09/2021 à 16:54, Nicholas Piggin a écrit :
> Move the assertions requiring restart table searches under
> CONFIG_PPC_IRQ_SOFT_MASK_DEBUG.
>
> Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
> ---
> arch/powerpc/include/asm/interrupt.h | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/interrupt.h b/arch/powerpc/include/asm/interrupt.h
> index e178d143671a..0e84e99af37b 100644
> --- a/arch/powerpc/include/asm/interrupt.h
> +++ b/arch/powerpc/include/asm/interrupt.h
> @@ -97,6 +97,11 @@ static inline void srr_regs_clobbered(void)
> local_paca->hsrr_valid = 0;
> }
> #else
> +static inline unsigned long search_kernel_restart_table(unsigned long addr)
> +{
> + return 0;
> +}
> +
Not sure you need that. Moving the 64s prototype out of the #ifdef would
do it as well.
> static inline bool is_implicit_soft_masked(struct pt_regs *regs)
> {
> return false;
> @@ -190,13 +195,14 @@ static inline void interrupt_enter_prepare(struct pt_regs *regs, struct interrup
> */
> if (TRAP(regs) != INTERRUPT_PROGRAM) {
> CT_WARN_ON(ct_state() != CONTEXT_KERNEL);
> - BUG_ON(is_implicit_soft_masked(regs));
> + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
> + BUG_ON(is_implicit_soft_masked(regs));
> }
> -#ifdef CONFIG_PPC_BOOK3S
> +
> /* Move this under a debugging check */
> - if (arch_irq_disabled_regs(regs))
> + if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG) &&
> + arch_irq_disabled_regs(regs))
> BUG_ON(search_kernel_restart_table(regs->nip));
> -#endif
> }
> if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
> BUG_ON(!arch_irq_disabled_regs(regs) && !(regs->msr & MSR_EE));
>
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox