All of lore.kernel.org
 help / color / mirror / Atom feed
From: Guo Ren <ren_guo@c-sky.com>
To: Greentime Hu <green.hu@gmail.com>
Cc: Greentime <greentime@andestech.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch <linux-arch@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Rob Herring <robh+dt@kernel.org>, netdev <netdev@vger.kernel.org>,
	Vincent Chen <deanbo422@gmail.com>,
	DTML <devicetree@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	David Howells <dhowells@redhat.com>,
	Will Deacon <will.deacon@arm.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-serial@vger.kernel.org,
	Geert Uytterhoeven <geert.uytterhoeven@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Mark Rutland <mark.rutland@arm.com>, Greg KH <greg@kroah.com>,
	Vincent Chen <vincentc@andestech.com>
Subject: Re: [PATCH v3 07/33] nds32: MMU initialization
Date: Mon, 18 Dec 2017 20:22:54 +0800	[thread overview]
Message-ID: <20171218122253.GA19382@gary-OptiPlex-3050> (raw)
In-Reply-To: <CAEbi=3dy+KGgftWOrbBpVPDZURiYVYwAyGWzd9z4T7RQYAk2FA@mail.gmail.com>

On Mon, Dec 18, 2017 at 07:21:30PM +0800, Greentime Hu wrote:
> Hi, Guo Ren:
> 
> 2017-12-18 17:08 GMT+08:00 Guo Ren <ren_guo@c-sky.com>:
> > Hi Greentime,
> >
> > On Fri, Dec 08, 2017 at 05:11:50PM +0800, Greentime Hu wrote:
> > [...]
> >>
> >> diff --git a/arch/nds32/mm/highmem.c b/arch/nds32/mm/highmem.c
> > [...]
> >> +void *kmap(struct page *page)
> >> +{
> >> +     unsigned long vaddr;
> >> +     might_sleep();
> >> +     if (!PageHighMem(page))
> >> +             return page_address(page);
> >> +     vaddr = (unsigned long)kmap_high(page);
> > Here should invalid the cpu_mmu_tlb's entry, Or invalid it in the
> > set_pte().
> >
> > eg:
> > vaddr0 = kmap(page0)
> > *vaddr0 = val0 //It will cause tlb-miss, and hard-refill to MMU-tlb
> > kunmap(page0)
> > vaddr1 = kmap(page1) // Mostly vaddr1 = vaddr0
> > val = vaddr1; //No tlb-miss and it will get page0's val not page1, because
> >                 last expired vaddr0's entry is left in CPU-MMU-tlb.
> >
> 
> Thanks.
> I will add __nds32__tlbop_inv(vaddr); to invalidate this mapping
> before retrun vaddr.

Sorry, perhaps I'm wrong. See
kmap->kmap_high->map_new_virtual->get_next_pkmap_nr(color).

Seems pkmap will return the vaddr by vaddr + 1 until
no_more_pkmaps(), and then flush_all_zero_pkmaps.
Just kmap_atomic need it, and you've done.

But I don't know why mips need flush_tlb_one in
arch/mips/mm/highmem.c:kmap(). VIPT? but kmap give the get_pkmap_color
for aliasing.

Best Regards
 Guo Ren

WARNING: multiple messages have this Message-ID (diff)
From: Guo Ren <ren_guo@c-sky.com>
To: Greentime Hu <green.hu@gmail.com>
Cc: Greentime <greentime@andestech.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-arch <linux-arch@vger.kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Rob Herring <robh+dt@kernel.org>, netdev <netdev@vger.kernel.org>,
	Vincent Chen <deanbo422@gmail.com>,
	DTML <devicetree@vger.kernel.org>,
	Al Viro <viro@zeniv.linux.org.uk>,
	David Howells <dhowells@redhat.com>,
	Will Deacon <will.deacon@arm.com>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-serial@vger.kernel.org,
	Geert Uytterhoeven <geert.uytterhoeven@gmail.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Mark Rutland <mark.rutland@arm.com>, Greg KH <greg@kroah.com>
Subject: Re: [PATCH v3 07/33] nds32: MMU initialization
Date: Mon, 18 Dec 2017 20:22:54 +0800	[thread overview]
Message-ID: <20171218122253.GA19382@gary-OptiPlex-3050> (raw)
In-Reply-To: <CAEbi=3dy+KGgftWOrbBpVPDZURiYVYwAyGWzd9z4T7RQYAk2FA@mail.gmail.com>

On Mon, Dec 18, 2017 at 07:21:30PM +0800, Greentime Hu wrote:
> Hi, Guo Ren:
> 
> 2017-12-18 17:08 GMT+08:00 Guo Ren <ren_guo@c-sky.com>:
> > Hi Greentime,
> >
> > On Fri, Dec 08, 2017 at 05:11:50PM +0800, Greentime Hu wrote:
> > [...]
> >>
> >> diff --git a/arch/nds32/mm/highmem.c b/arch/nds32/mm/highmem.c
> > [...]
> >> +void *kmap(struct page *page)
> >> +{
> >> +     unsigned long vaddr;
> >> +     might_sleep();
> >> +     if (!PageHighMem(page))
> >> +             return page_address(page);
> >> +     vaddr = (unsigned long)kmap_high(page);
> > Here should invalid the cpu_mmu_tlb's entry, Or invalid it in the
> > set_pte().
> >
> > eg:
> > vaddr0 = kmap(page0)
> > *vaddr0 = val0 //It will cause tlb-miss, and hard-refill to MMU-tlb
> > kunmap(page0)
> > vaddr1 = kmap(page1) // Mostly vaddr1 = vaddr0
> > val = vaddr1; //No tlb-miss and it will get page0's val not page1, because
> >                 last expired vaddr0's entry is left in CPU-MMU-tlb.
> >
> 
> Thanks.
> I will add __nds32__tlbop_inv(vaddr); to invalidate this mapping
> before retrun vaddr.

Sorry, perhaps I'm wrong. See
kmap->kmap_high->map_new_virtual->get_next_pkmap_nr(color).

Seems pkmap will return the vaddr by vaddr + 1 until
no_more_pkmaps(), and then flush_all_zero_pkmaps.
Just kmap_atomic need it, and you've done.

But I don't know why mips need flush_tlb_one in
arch/mips/mm/highmem.c:kmap(). VIPT? but kmap give the get_pkmap_color
for aliasing.

Best Regards
 Guo Ren

  reply	other threads:[~2017-12-18 12:23 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-08  9:11 [PATCH v3 00/33] Andes(nds32) Linux Kernel Port Greentime Hu
2017-12-08  9:11 ` [PATCH v3 01/33] asm-generic/io.h: move ioremap_nocache/ioremap_uc/ioremap_wc/ioremap_wt out of ifndef CONFIG_MMU Greentime Hu
2017-12-08  9:11 ` [PATCH v3 02/33] earlycon: add reg-offset to physical address before mapping Greentime Hu
2017-12-08  9:11 ` [PATCH v3 03/33] nds32: Assembly macros and definitions Greentime Hu
2017-12-08  9:11   ` Greentime Hu
2017-12-08  9:11 ` [PATCH v3 04/33] nds32: Kernel booting and initialization Greentime Hu
2017-12-08 13:19   ` Philippe Ombredanne
2017-12-08 13:19     ` Philippe Ombredanne
2017-12-08 13:25     ` Greentime Hu
2017-12-08 13:25       ` Greentime Hu
2017-12-08 13:25       ` Greentime Hu
2017-12-08 13:25       ` Greentime Hu
2017-12-08  9:11 ` [PATCH v3 05/33] nds32: Exception handling Greentime Hu
2017-12-08 15:05   ` Al Viro
2017-12-08  9:11 ` [PATCH v3 06/33] nds32: MMU definitions Greentime Hu
2017-12-08  9:11 ` [PATCH v3 07/33] nds32: MMU initialization Greentime Hu
2017-12-08  9:11   ` Greentime Hu
2017-12-18  9:08   ` Guo Ren
2017-12-18 11:21     ` Greentime Hu
2017-12-18 11:21       ` Greentime Hu
2017-12-18 12:22       ` Guo Ren [this message]
2017-12-18 12:22         ` Guo Ren
2017-12-19  6:56         ` Greentime Hu
2017-12-19  6:56           ` Greentime Hu
2017-12-08  9:11 ` [PATCH v3 08/33] nds32: MMU fault handling and page table management Greentime Hu
2017-12-08  9:11 ` [PATCH v3 09/33] nds32: Cache and TLB routines Greentime Hu
2017-12-13  2:16   ` Guo Ren
2017-12-13  5:45     ` Greentime Hu
2017-12-13  5:45       ` Greentime Hu
2017-12-13  8:19       ` Guo Ren
2017-12-13  8:19         ` Guo Ren
2017-12-13  8:30         ` Greentime Hu
2017-12-13  8:30           ` Greentime Hu
2017-12-13  8:53           ` Guo Ren
2017-12-13  8:53             ` Guo Ren
2017-12-13  9:03             ` Greentime Hu
2017-12-13  9:03               ` Greentime Hu
2017-12-13  9:45               ` Guo Ren
2017-12-13  9:45                 ` Guo Ren
2017-12-13 10:04                 ` Greentime Hu
2017-12-13 10:04                   ` Greentime Hu
2017-12-08  9:11 ` [PATCH v3 10/33] nds32: Process management Greentime Hu
2017-12-08  9:11 ` [PATCH v3 11/33] nds32: IRQ handling Greentime Hu
2017-12-08  9:11 ` [PATCH v3 12/33] nds32: Atomic operations Greentime Hu
2017-12-08  9:11   ` Greentime Hu
2017-12-08  9:11 ` [PATCH v3 13/33] nds32: Device specific operations Greentime Hu
2017-12-08  9:11   ` Greentime Hu
2017-12-08  9:11 ` [PATCH v3 14/33] nds32: DMA mapping API Greentime Hu
2017-12-08  9:11 ` [PATCH v3 15/33] nds32: ELF definitions Greentime Hu
2017-12-08  9:11 ` [PATCH v3 16/33] nds32: System calls handling Greentime Hu
2017-12-08  9:12 ` [PATCH v3 17/33] nds32: VDSO support Greentime Hu
2017-12-08 10:21   ` Mark Rutland
2017-12-08 11:54     ` Greentime Hu
2017-12-08 11:54       ` Greentime Hu
2017-12-08 11:54       ` Greentime Hu
2017-12-08 12:14       ` Mark Rutland
2017-12-08 12:14         ` Mark Rutland
2017-12-08 12:14         ` Mark Rutland
2017-12-12  1:58         ` Vincent Chen
2017-12-12  1:58           ` Vincent Chen
2017-12-08 12:29       ` Marc Zyngier
2017-12-08 12:46         ` Greentime Hu
2017-12-08 12:46           ` Greentime Hu
2017-12-08 12:46           ` Greentime Hu
2017-12-08  9:12 ` [PATCH v3 18/33] nds32: Signal handling support Greentime Hu
2017-12-08  9:12 ` [PATCH v3 19/33] nds32: Library functions Greentime Hu
2017-12-08  9:12   ` Greentime Hu
2017-12-08  9:12 ` [PATCH v3 20/33] nds32: Debugging support Greentime Hu
2017-12-08  9:12 ` [PATCH v3 21/33] nds32: L2 cache support Greentime Hu
2017-12-08  9:12 ` [PATCH v3 22/33] nds32: Loadable modules Greentime Hu
2017-12-08  9:12 ` [PATCH v3 23/33] nds32: Generic timers support Greentime Hu
2017-12-08 13:43   ` Linus Walleij
2017-12-08 13:43     ` Linus Walleij
2017-12-08  9:12 ` [PATCH v3 24/33] nds32: Device tree support Greentime Hu
2017-12-08 10:23   ` Mark Rutland
2017-12-08 10:27   ` Mark Rutland
2017-12-08  9:12 ` [PATCH v3 25/33] nds32: Miscellaneous header files Greentime Hu
2017-12-08  9:12 ` [PATCH v3 26/33] nds32: defconfig Greentime Hu
2017-12-08  9:12 ` [PATCH v3 27/33] nds32: Build infrastructure Greentime Hu
2017-12-08  9:12 ` [PATCH v3 28/33] MAINTAINERS: Add nds32 Greentime Hu
2017-12-08  9:12 ` [PATCH v3 29/33] dt-bindings: nds32 CPU Bindings Greentime Hu
2017-12-12 20:10   ` Rob Herring
2017-12-08  9:12 ` [PATCH v3 30/33] dt-bindings: nds32 SoC Bindings Greentime Hu
2017-12-12 20:12   ` Rob Herring
2017-12-08  9:12 ` [PATCH v3 31/33] dt-bindings: interrupt-controller: Andestech Internal Vector Interrupt Controller Greentime Hu
2017-12-12 17:33   ` Rob Herring
2017-12-12 17:33     ` Rob Herring
2017-12-08  9:12 ` [PATCH v3 32/33] irqchip: Andestech Internal Vector Interrupt Controller driver Greentime Hu
2017-12-08  9:12   ` Greentime Hu
2017-12-11  9:16   ` Marc Zyngier
2017-12-11  9:16     ` Marc Zyngier
2017-12-08  9:12 ` [PATCH v3 33/33] net: faraday add nds32 support Greentime Hu

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=20171218122253.GA19382@gary-OptiPlex-3050 \
    --to=ren_guo@c-sky.com \
    --cc=arnd@arndb.de \
    --cc=daniel.lezcano@linaro.org \
    --cc=deanbo422@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=dhowells@redhat.com \
    --cc=geert.uytterhoeven@gmail.com \
    --cc=green.hu@gmail.com \
    --cc=greentime@andestech.com \
    --cc=greg@kroah.com \
    --cc=jason@lakedaemon.net \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=netdev@vger.kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vincentc@andestech.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=will.deacon@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.