All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Christoph Hellwig <hch@lst.de>, Nick Hu <nickhu@andestech.com>,
	Greentime Hu <green.hu@gmail.com>,
	Vincent Chen <deanbo422@gmail.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	Linux-Arch <linux-arch@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 5/6] uaccess: add force_uaccess_{begin,end} helpers
Date: Tue, 14 Jul 2020 09:12:11 +0200	[thread overview]
Message-ID: <20200714071211.GC776@lst.de> (raw)
In-Reply-To: <CAMuHMdUCmEeU0G9wkUxZKm5tC9YoB-KXSSCLKwpSia746Myebw@mail.gmail.com>

On Mon, Jul 13, 2020 at 03:19:42PM +0200, Geert Uytterhoeven wrote:
> > This used to set KERNEL_DS, and now it sets USER_DS, which looks wrong
> > superficially.
> 
> Thanks for noticing, and sorry for missing that myself.
> 
> The same issue is present for SuperH:
> 
>     -               set_fs(KERNEL_DS);
>     +               oldfs = force_uaccess_begin();
> 
> So the patch description should be:
> 
>     "Add helpers to wraper the get_fs/set_fs magic for undoing any damage
>      done by set_fs(USER_DS)."
> 
> and leave alone users setting KERNEL_DS?

Yes, this was broken.  Fixed for the next version.

> > If the new behaviour is fine it suggests that the old behaviour was
> > wrong, or that this is superfluous and could go entirely.
> >
> > Geert?
> 
> Nope, on m68k, TLB cache operations operate on the current address space.
> Hence to flush a kernel TLB entry, you have to switch to KERNEL_DS first.
> 
> If we're guaranteed to be already using KERNEL_DS, I guess the
> address space handling can be removed.  But can we be sure?

We can't be sure yet.  But with a lot of my pending work we should be
able to get there in the not too far future.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Mark Rutland <mark.rutland@arm.com>,
	Linux-Arch <linux-arch@vger.kernel.org>,
	Nick Hu <nickhu@andestech.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-riscv <linux-riscv@lists.infradead.org>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Greentime Hu <green.hu@gmail.com>,
	Paul Walmsley <paul.walmsley@sifive.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vincent Chen <deanbo422@gmail.com>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 5/6] uaccess: add force_uaccess_{begin,end} helpers
Date: Tue, 14 Jul 2020 09:12:11 +0200	[thread overview]
Message-ID: <20200714071211.GC776@lst.de> (raw)
In-Reply-To: <CAMuHMdUCmEeU0G9wkUxZKm5tC9YoB-KXSSCLKwpSia746Myebw@mail.gmail.com>

On Mon, Jul 13, 2020 at 03:19:42PM +0200, Geert Uytterhoeven wrote:
> > This used to set KERNEL_DS, and now it sets USER_DS, which looks wrong
> > superficially.
> 
> Thanks for noticing, and sorry for missing that myself.
> 
> The same issue is present for SuperH:
> 
>     -               set_fs(KERNEL_DS);
>     +               oldfs = force_uaccess_begin();
> 
> So the patch description should be:
> 
>     "Add helpers to wraper the get_fs/set_fs magic for undoing any damage
>      done by set_fs(USER_DS)."
> 
> and leave alone users setting KERNEL_DS?

Yes, this was broken.  Fixed for the next version.

> > If the new behaviour is fine it suggests that the old behaviour was
> > wrong, or that this is superfluous and could go entirely.
> >
> > Geert?
> 
> Nope, on m68k, TLB cache operations operate on the current address space.
> Hence to flush a kernel TLB entry, you have to switch to KERNEL_DS first.
> 
> If we're guaranteed to be already using KERNEL_DS, I guess the
> address space handling can be removed.  But can we be sure?

We can't be sure yet.  But with a lot of my pending work we should be
able to get there in the not too far future.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2020-07-14  7:12 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-10 13:57 clean up address limit helpers Christoph Hellwig
2020-07-10 13:57 ` Christoph Hellwig
2020-07-10 13:57 ` [PATCH 1/6] syscalls: use uaccess_kernel in addr_limit_user_check Christoph Hellwig
2020-07-10 13:57   ` Christoph Hellwig
2020-07-10 13:57 ` [PATCH 2/6] nds32: use uaccess_kernel in show_regs Christoph Hellwig
2020-07-10 13:57   ` Christoph Hellwig
2020-07-13 10:02   ` Greentime Hu
2020-07-13 10:02     ` Greentime Hu
2020-07-10 13:57 ` [PATCH 3/6] riscv: include <asm/pgtable.h> in <asm/uaccess.h> Christoph Hellwig
2020-07-10 13:57   ` Christoph Hellwig
2020-07-21 23:02   ` Palmer Dabbelt
2020-07-21 23:02     ` Palmer Dabbelt
2020-07-10 13:57 ` [PATCH 4/6] uaccess: remove segment_eq Christoph Hellwig
2020-07-10 13:57   ` Christoph Hellwig
2020-07-13  9:16   ` Geert Uytterhoeven
2020-07-13  9:16     ` Geert Uytterhoeven
2020-07-13 10:05   ` Greentime Hu
2020-07-13 10:05     ` Greentime Hu
2020-07-10 13:57 ` [PATCH 5/6] uaccess: add force_uaccess_{begin,end} helpers Christoph Hellwig
2020-07-10 13:57   ` Christoph Hellwig
2020-07-13  9:12   ` Geert Uytterhoeven
2020-07-13  9:12     ` Geert Uytterhoeven
2020-07-13 10:06   ` Greentime Hu
2020-07-13 10:06     ` Greentime Hu
2020-07-13 12:21   ` Mark Rutland
2020-07-13 12:21     ` Mark Rutland
2020-07-13 13:19     ` Geert Uytterhoeven
2020-07-13 13:19       ` Geert Uytterhoeven
2020-07-13 13:19       ` Geert Uytterhoeven
2020-07-14  7:12       ` Christoph Hellwig [this message]
2020-07-14  7:12         ` Christoph Hellwig
2020-07-13 12:26   ` Mark Rutland
2020-07-13 12:26     ` Mark Rutland
2020-07-10 13:57 ` [PATCH 6/6] exec: use force_uaccess_begin during exec and exit Christoph Hellwig
2020-07-10 13:57   ` Christoph Hellwig
2020-07-10 15:25 ` clean up address limit helpers Linus Torvalds
2020-07-10 15:25   ` Linus Torvalds
2020-07-14  7:09   ` Christoph Hellwig
2020-07-14  7:09     ` Christoph Hellwig
2020-07-14 15:33     ` Linus Torvalds
2020-07-14 15:33       ` Linus Torvalds
  -- strict thread matches above, loose matches on Subject: below --
2020-07-14 10:54 clean up address limit helpers v2 Christoph Hellwig
2020-07-14 10:55 ` [PATCH 5/6] uaccess: add force_uaccess_{begin,end} helpers Christoph Hellwig
2020-07-14 10:55   ` Christoph Hellwig
2020-07-14 15:29   ` Linus Torvalds
2020-07-14 15:29     ` Linus Torvalds

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=20200714071211.GC776@lst.de \
    --to=hch@lst.de \
    --cc=akpm@linux-foundation.org \
    --cc=deanbo422@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=green.hu@gmail.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=nickhu@andestech.com \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=torvalds@linux-foundation.org \
    /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.