From: Petr Tesarik <ptesarik@suse.cz>
To: Tejun Heo <tj@kernel.org>, linux-mm@kvack.org
Cc: LKML <linux-kernel@vger.kernel.org>,
Vivek Goyal <vgoyal@redhat.com>,
surovegin@google.com, gthelen@google.com
Subject: [PATCH] Do not round per_cpu_ptr_to_phys to page boundary
Date: Fri, 16 Dec 2011 09:04:23 +0100 [thread overview]
Message-ID: <201112160904.23252.ptesarik@suse.cz> (raw)
In-Reply-To: <CAOS58YP8o9xQvZJtpEJobChhJ+pSDQ9PqDwaXFS_h+JFd65jOw@mail.gmail.com>
The phys_addr_t per_cpu_ptr_to_phys() function ignores the offset within a
page, whenever not using a simple translation using __pa().
Without this patch /sys/devices/system/cpu/cpu*/crash_notes shows incorrect
values, which breaks kdump. Other things may also be broken.
Signed-off-by: Petr Tesarik <ptesarik@suse.cz>
diff --git a/mm/percpu.c b/mm/percpu.c
index 3bb810a..1a1b5ac 100644
--- a/mm/percpu.c
+++ b/mm/percpu.c
@@ -998,6 +998,7 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr)
bool in_first_chunk = false;
unsigned long first_low, first_high;
unsigned int cpu;
+ phys_addr_t page_addr;
/*
* The following test on unit_low/high isn't strictly
@@ -1023,9 +1024,10 @@ phys_addr_t per_cpu_ptr_to_phys(void *addr)
if (!is_vmalloc_addr(addr))
return __pa(addr);
else
- return page_to_phys(vmalloc_to_page(addr));
+ page_addr = page_to_phys(vmalloc_to_page(addr));
} else
- return page_to_phys(pcpu_addr_to_page(addr));
+ page_addr = page_to_phys(pcpu_addr_to_page(addr));
+ return page_addr + offset_in_page(addr);
}
/**
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-12-16 8:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-13 23:33 Is per_cpu_ptr_to_phys broken? Petr Tesarik
2011-12-14 16:17 ` Cong Wang
2011-12-15 10:39 ` Petr Tesarik
2011-12-15 18:40 ` Tejun Heo
2011-12-16 8:04 ` Petr Tesarik [this message]
2011-12-16 8:40 ` [PATCH] Do not round per_cpu_ptr_to_phys to page boundary Petr Tesarik
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201112160904.23252.ptesarik@suse.cz \
--to=ptesarik@suse.cz \
--cc=gthelen@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=surovegin@google.com \
--cc=tj@kernel.org \
--cc=vgoyal@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).