Message ID | 20230724181320.471386-1-aneesh.kumar@linux.ibm.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 6722b25712054c0f903b839b8f5088438dd04df3 |
Headers | show |
Series | powerpc/mm/altmap: Fix altmap boundary check | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/github-powerpc_selftests | success | Successfully ran 8 jobs. |
snowpatch_ozlabs/github-powerpc_ppctests | success | Successfully ran 8 jobs. |
snowpatch_ozlabs/github-powerpc_clang | success | Successfully ran 6 jobs. |
snowpatch_ozlabs/github-powerpc_sparse | success | Successfully ran 4 jobs. |
snowpatch_ozlabs/github-powerpc_kernel_qemu | success | Successfully ran 23 jobs. |
On 24.07.23 20:13, Aneesh Kumar K.V wrote: > altmap->free includes the entire free space from which altmap blocks > can be allocated. So when checking whether the kernel is doing altmap > block free, compute the boundary correctly. > > Cc: David Hildenbrand <david@redhat.com> > Cc: Dan Williams <dan.j.williams@intel.com> > Fixes: 9ef34630a461 ("powerpc/mm: Fallback to RAM if the altmap is unusable") > Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> > --- > arch/powerpc/mm/init_64.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c > index fe1b83020e0d..0ec5b45b1e86 100644 > --- a/arch/powerpc/mm/init_64.c > +++ b/arch/powerpc/mm/init_64.c > @@ -314,8 +314,7 @@ void __ref vmemmap_free(unsigned long start, unsigned long end, > start = ALIGN_DOWN(start, page_size); > if (altmap) { > alt_start = altmap->base_pfn; > - alt_end = altmap->base_pfn + altmap->reserve + > - altmap->free + altmap->alloc + altmap->align; > + alt_end = altmap->base_pfn + altmap->reserve + altmap->free; Right, align is treated like allocated and align+alloc cannot exceed free. Reviewed-by: David Hildenbrand <david@redhat.com>
On Mon, 24 Jul 2023 23:43:20 +0530, Aneesh Kumar K.V wrote: > altmap->free includes the entire free space from which altmap blocks > can be allocated. So when checking whether the kernel is doing altmap > block free, compute the boundary correctly. > > Applied to powerpc/fixes. [1/1] powerpc/mm/altmap: Fix altmap boundary check https://git.kernel.org/powerpc/c/6722b25712054c0f903b839b8f5088438dd04df3 cheers
diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c index fe1b83020e0d..0ec5b45b1e86 100644 --- a/arch/powerpc/mm/init_64.c +++ b/arch/powerpc/mm/init_64.c @@ -314,8 +314,7 @@ void __ref vmemmap_free(unsigned long start, unsigned long end, start = ALIGN_DOWN(start, page_size); if (altmap) { alt_start = altmap->base_pfn; - alt_end = altmap->base_pfn + altmap->reserve + - altmap->free + altmap->alloc + altmap->align; + alt_end = altmap->base_pfn + altmap->reserve + altmap->free; } pr_debug("vmemmap_free %lx...%lx\n", start, end);
altmap->free includes the entire free space from which altmap blocks can be allocated. So when checking whether the kernel is doing altmap block free, compute the boundary correctly. Cc: David Hildenbrand <david@redhat.com> Cc: Dan Williams <dan.j.williams@intel.com> Fixes: 9ef34630a461 ("powerpc/mm: Fallback to RAM if the altmap is unusable") Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.ibm.com> --- arch/powerpc/mm/init_64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)