Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1732495 > unrolled thread
| Started by | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| First post | 2017-09-14 20:30 +0200 |
| Last post | 2017-09-18 23:30 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v6 07/11] arm64/mm, xpfo: temporarily map dcache regions Mark Rutland <mark.rutland@arm.com> - 2017-09-14 20:30 +0200
Re: [PATCH v6 07/11] arm64/mm, xpfo: temporarily map dcache regions Tycho Andersen <tycho@docker.com> - 2017-09-18 23:30 +0200
| From | Mark Rutland <mark.rutland@arm.com> |
|---|---|
| Date | 2017-09-14 20:30 +0200 |
| Subject | Re: [PATCH v6 07/11] arm64/mm, xpfo: temporarily map dcache regions |
| Message-ID | <upH3H-7A-9@gated-at.bofh.it> |
On Thu, Sep 07, 2017 at 11:36:05AM -0600, Tycho Andersen 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 21a8d828cbf4..e335e3fd4fca 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);
Does this create the mapping in-place?
Can we not just kmap_atomic() an alias? Or is there a problem with that?
Thanks,
Mark.
[toc] | [next] | [standalone]
| From | Tycho Andersen <tycho@docker.com> |
|---|---|
| Date | 2017-09-18 23:30 +0200 |
| Message-ID | <urbM6-3wY-11@gated-at.bofh.it> |
| In reply to | #1732495 |
On Thu, Sep 14, 2017 at 07:25:56PM +0100, Mark Rutland wrote:
> On Thu, Sep 07, 2017 at 11:36:05AM -0600, Tycho Andersen 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 21a8d828cbf4..e335e3fd4fca 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);
>
> Does this create the mapping in-place?
>
> Can we not just kmap_atomic() an alias? Or is there a problem with that?
I think what we really want is something like vmap(), looking at
xpfo_temp_map() it seems like the implementation is completely wrong.
I wonder if what you mentioned at LSS is possible though: doing cache
management with userspace primitives instead of mapping the region
just to flush it.
Cheers,
Tycho
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web