public inbox for linux-m68k@lists.linux-m68k.org
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Christoph Hellwig <hch@lst.de>,
	Greg Ungerer <gerg@linux-m68k.org>,
	linux-m68k <linux-m68k@lists.linux-m68k.org>,
	uClinux development list <uclinux-dev@uclinux.org>
Subject: Re: [PATCH] m68knommu: remove set_fs()
Date: Thu, 8 Jul 2021 15:40:49 +1200	[thread overview]
Message-ID: <3c736dc7-dd0c-0691-ece4-e7dc9aaa3a54@gmail.com> (raw)
In-Reply-To: <CAHk-=wgjWebav7K_F7WS7KiwOAYr8KktsZiaV+jYP5LU5RB3Sg@mail.gmail.com>

Hi Linus,

going back to this one, I missed that bit earlier - the last three hunks
of your patch replaced KERNEL_DS by USER_DATA, everywhere else it's
replaced by SUPER_DATA. Typo, or something too subtle for me to grasp?

Cheers,

    Michael


Am 06.07.21 um 08:39 schrieb Linus Torvalds:
> On Mon, Jul 5, 2021 at 1:46 AM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>> Probably this should be
>>
>>     select SET_FS if CPU_HAS_ADDRESS_SPACES
> Actually, I don't think m68k has a single real "set_fs()" at all, and
> it should just be converted as-is to not use CONFIG_SET_FS.
>
> Yes, there is a "set_fs()" function, but none of the remaining uses
> actually are the traditional kernel style of "use kernel addresses as
> user addresses". So as far as the *kernel* is concerned, m68k already
> looks like a no-SET_FS architecture, and "set-fs()" is purely a
> syntactic thing.
>
> So I think the right thing to do looks something like this:
>
>  - make the rule be that SFC/DFC is always normally USER_DATA
>
>  - the special m68k sequences that need to play with special segments
> will always do
>
>         preempt_disable();
>         set_segment(..whatever segment they need..);
>         .. do the special operation ..
>         set_segment(USER_DATA);
>         preempt_enable();
>
>  - set_fs() goes away entirely, because the user access functions
> always work on USER_DATA and SFC/DFC is always right for them.
>
> Anyway, I'm attaching a COMPLETELY UNTESTED AND ALMOST CERTAINLY VERY
> VERY BROKEN patch that is likely not at all correct, but shows what I
> think the solution should be.
>
> The important thing is really just the removal of SET_FS entirely, the
> rest is me winging it.
>
> NOTE! The above very much assumes that all the special non-USER_DATA
> accesses can always be done with preemption disabled. Why? Because I
> also made the context switching always just save USER_DATA as the
> segment. I didn't *remove* the segment switching - because I'm not
> sure if that "just disable preemption across things that do segment
> games" is actually valid.
>
> So *if* that preempt_disable/enable is ok, then the segment switching
> can just be removed entirely at context switch time.
>
> And if it is *not* ok, then the preempt_disable/enable should go away,
> and the context switch should save/restore the actual SFC/DFC value.
>
> Again - let me be very very clear: the only m68k I've ever used was a
> 68008. It didn't have segments. This patch is COMPLETE GARBAGE. Do not
> trust it. Do not use it for anything but a "Linus suggests maybe
> something along these lines could work".
>
> This has not even been build-tested, and I'm pretty sure it won't
> build as-is. It really is a "Linus did some pattern matching and a few
> grep's".
>
> Oh, and if the magical SFC/DFC games can happen in interrupts, then
> the "preempt_disable/enable" actually needs to be a full interrupt
> disable/enable, or the code needs to re-introduce that "save old
> value, restore it". So that's another assumption this example patch
> makes - that the SFC/DFC games only happen in process context. Which
> may be complete garbage too.
>
> Did I mention that I think this patch is garbage? Because it really is.
>
>                 Linus

  parent reply	other threads:[~2021-07-08  3:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-05  5:57 RFC: stop implementing set_fs for m68knommu Christoph Hellwig
2021-07-05  5:57 ` [PATCH] m68knommu: remove set_fs() Christoph Hellwig
2021-07-05  8:44   ` Geert Uytterhoeven
2021-07-05  8:56     ` Christoph Hellwig
2021-07-05 11:33       ` Geert Uytterhoeven
2021-07-05 11:51         ` Christoph Hellwig
2021-07-05 20:39     ` Linus Torvalds
2021-07-06  4:13       ` Christoph Hellwig
2021-07-06 18:36         ` Linus Torvalds
2021-07-07 14:25           ` Christoph Hellwig
2021-07-07 17:41             ` Linus Torvalds
2021-07-08  1:39             ` Michael Schmitz
2021-07-08  3:40       ` Michael Schmitz [this message]
2021-07-08  4:14         ` Linus Torvalds
2021-07-08  4:17           ` Christoph Hellwig
2021-07-08  6:33           ` Michael Schmitz

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=3c736dc7-dd0c-0691-ece4-e7dc9aaa3a54@gmail.com \
    --to=schmitzmic@gmail.com \
    --cc=geert@linux-m68k.org \
    --cc=gerg@linux-m68k.org \
    --cc=hch@lst.de \
    --cc=linux-m68k@lists.linux-m68k.org \
    --cc=torvalds@linux-foundation.org \
    --cc=uclinux-dev@uclinux.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox