Message ID | ea50404604bdbe1547601b6ea0af89e3da8886b0.1550088114.git.khalid.aziz@oracle.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Add support for eXclusive Page Frame Ownership | expand |
On 2/14/19 8:54 AM, Tycho Andersen wrote: > Hi, > > On Wed, Feb 13, 2019 at 05:01:30PM -0700, Khalid Aziz wrote: >> From: Juerg Haefliger <juerg.haefliger@canonical.com> >> >> If the page is unmapped by XPFO, a data cache flush results in a fatal >> page fault, so let's temporarily map the region, flush the cache, and then >> unmap it. >> >> v6: actually flush in the face of xpfo, and temporarily map the underlying >> memory so it can be flushed correctly >> >> CC: linux-arm-kernel@lists.infradead.org >> Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com> >> Signed-off-by: Tycho Andersen <tycho@docker.com> >> --- >> arch/arm64/mm/flush.c | 7 +++++++ >> 1 file changed, 7 insertions(+) >> >> diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c >> index 30695a868107..fad09aafd9d5 100644 >> --- a/arch/arm64/mm/flush.c >> +++ b/arch/arm64/mm/flush.c >> @@ -20,6 +20,7 @@ >> #include <linux/export.h> >> #include <linux/mm.h> >> #include <linux/pagemap.h> >> +#include <linux/xpfo.h> >> >> #include <asm/cacheflush.h> >> #include <asm/cache.h> >> @@ -28,9 +29,15 @@ >> void sync_icache_aliases(void *kaddr, unsigned long len) >> { >> unsigned long addr = (unsigned long)kaddr; >> + unsigned long num_pages = XPFO_NUM_PAGES(addr, len); >> + void *mapping[num_pages]; > > What version does this build on? Presumably -Wvla will cause an error > here, but, > >> if (icache_is_aliasing()) { >> + xpfo_temp_map(kaddr, len, mapping, >> + sizeof(mapping[0]) * num_pages); >> __clean_dcache_area_pou(kaddr, len); > > Here, we map the pages to some random address via xpfo_temp_map(), > then pass the *original* address (which may not have been mapped) to > __clean_dcache_area_pou(). So I think this whole approach is wrong. > > If we want to do it this way, it may be that we need some > xpfo_map_contiguous() type thing, but since we're just going to flush > it anyway, that seems a little crazy. Maybe someone who knows more > about arm64 knows a better way? > > Tycho > Hi Tycho, You are right. Things don't quite look right with this patch. I don't know arm64 well enough either, so I will wait for someone more knowledgeable to make a recommendation here. On a side note, do you mind if I update your address in your signed-off-by from tycho@docker.com when I send the next version of this series? Thanks, Khalid
On Thu, Feb 14, 2019 at 10:29:52AM -0700, Khalid Aziz wrote: > On a side note, do you mind if I update your address in your > signed-off-by from tycho@docker.com when I send the next version of this > series? Sure that would be great thanks. This e-mail is a good one to use. Cheers, Tycho
diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 30695a868107..fad09aafd9d5 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -20,6 +20,7 @@ #include <linux/export.h> #include <linux/mm.h> #include <linux/pagemap.h> +#include <linux/xpfo.h> #include <asm/cacheflush.h> #include <asm/cache.h> @@ -28,9 +29,15 @@ void sync_icache_aliases(void *kaddr, unsigned long len) { unsigned long addr = (unsigned long)kaddr; + unsigned long num_pages = XPFO_NUM_PAGES(addr, len); + void *mapping[num_pages]; if (icache_is_aliasing()) { + xpfo_temp_map(kaddr, len, mapping, + sizeof(mapping[0]) * num_pages); __clean_dcache_area_pou(kaddr, len); + xpfo_temp_unmap(kaddr, len, mapping, + sizeof(mapping[0]) * num_pages); __flush_icache_all(); } else { flush_icache_range(addr, addr + len);