All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@zeniv.linux.org.uk>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-alpha@vger.kernel.org
Subject: Re: [PATCH v2 7/7] alpha: lazy FPU switching
Date: Fri, 2 Sep 2022 06:07:31 +0100	[thread overview]
Message-ID: <YxGPk1dDyCP2AWul@ZenIV> (raw)
In-Reply-To: <CAHk-=wjfCBF_xYtKacU920YFMKNDnesTUy-gYq8qHucLDTWNHQ@mail.gmail.com>

On Thu, Sep 01, 2022 at 09:24:52PM -0700, Linus Torvalds wrote:
> On Thu, Sep 1, 2022 at 6:50 PM Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> >         On each context switch we save the FPU registers on stack
> > of old process and restore FPU registers from the stack of new one.
> > That allows us to avoid doing that each time we enter/leave the
> > kernel mode; however, that can get suboptimal in some cases.
> 
> Do we really care, for what is effectively a dead architecture?

Umm...  To an extent we do - remember the fun bugs Eric had caught
wrt kernel threads that end up running with unusual stack layout?
That's where this series had come from - alpha is the worst offender
in that respect; it has batshit crazy amount of extras on top of
pt_regs and while the rest of that stuff could be dealt with, the
full set of FP registers is well beyond anything we could reasonably
save on each syscall entry.  And that also happens to be a killer
for ever switching to generic syscall glue.

So I wanted to see if such stuff could be dealt with; alpha FPU registers
were the worst example in the entire tree...
 
> This patch feels like something that might have made sense 25 years
> ago. Does it make sense today?
> 
> I guess I don't care (for the same reason), but just how much testing
> has this gotten, and what subtle bugs might this have?

Umm... kernel builds, libc builds (and self-tests), xfstests (qemu only;
sorry, but doing that on DS10 with IDE disk is just fucking awful).  Debian
updates, to an extent...
 
> With the asm even having a comment about how it only works because
> alpha doesn't do preemption (ARCH_NO_PREEMPT), but then the C code
> does do those preempt_disable/enable pairs, and I see an actual bug in
> there too:
> 
> Both alpha_read_fp_reg() and alpha_read_fp_reg_s() do a
> preempt_enable() -> preempt_enable() pair (ie the first one should be
> a preempt_disable()).

Will fix.

> Does that bug matter? No. ARCH_NO_PREEMPT means that it's all no-ops
> anyway. But it's wrong and I think shows the status of this patch -
> well-meaning, but maybe not really fully thought out.

Any review would obviously be welcome.  Again, as far as I'm concerned,
it's more of figuring out how painful does that kind of work end up
being.

Beginning of the series is a different story (and a good example of the
reasons for taking as much as possible out of asm glue into generic
C helpers - look at the first patch and note that TIF_NOTIFY_SIGNAL
is going to grow more uses in generic kernel).  TBH, I'm really sick
and tired of crawling through asm glue every year or so and coming
up with new piles of fun bugs ;-/  And it's not as if it had only
affected dead and stillborn architectures - riscv development is quite
alive...

  reply	other threads:[~2022-09-02  5:07 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-25  2:54 [PATCHES] alpha asm glue cleanups and fixes Al Viro
2021-09-25  2:55 ` [PATCH 1/6] alpha: fix TIF_NOTIFY_SIGNAL handling Al Viro
2021-09-25  2:55   ` [PATCH 2/6] alpha: _TIF_ALLWORK_MASK is unused Al Viro
2021-09-25  2:55   ` [PATCH 3/6] alpha: fix syscall entry in !AUDUT_SYSCALL case Al Viro
2021-09-25  2:55   ` [PATCH 4/6] alpha: fix handling of a3 on straced syscalls Al Viro
2021-09-25  2:55   ` [PATCH 5/6] alpha: syscall exit cleanup Al Viro
2021-09-25  2:55   ` [PATCH 6/6] alpha: ret_from_fork can go straight to ret_to_user Al Viro
2021-09-25  2:55   ` [PATCH 7/7] alpha: lazy FPU switching Al Viro
2021-09-25 19:07     ` Linus Torvalds
2021-09-25 20:43       ` Al Viro
2021-09-25 23:18         ` Linus Torvalds
2021-09-26  0:31           ` Al Viro
2021-10-30 20:46         ` Al Viro
2021-10-30 20:46           ` Al Viro
2021-10-30 21:25           ` Maciej W. Rozycki
2021-10-30 22:13             ` Al Viro
2021-09-26  9:08       ` John Paul Adrian Glaubitz
2021-09-25  2:59 ` [PATCHES] alpha asm glue cleanups and fixes Al Viro
2022-09-02  1:48 ` Al Viro
2022-09-02  1:50   ` [PATCH v2 1/7] alpha: fix TIF_NOTIFY_SIGNAL handling Al Viro
2022-09-02  1:50     ` [PATCH v2 2/7] alpha: _TIF_ALLWORK_MASK is unused Al Viro
2022-09-02  1:50     ` [PATCH v2 3/7] alpha: fix syscall entry in !AUDUT_SYSCALL case Al Viro
2022-09-02  1:50     ` [PATCH v2 4/7] alpha: fix handling of a3 on straced syscalls Al Viro
2022-09-02  1:50     ` [PATCH v2 5/7] alpha: syscall exit cleanup Al Viro
2022-09-02  1:50     ` [PATCH v2 6/7] alpha: ret_from_fork can go straight to ret_to_user Al Viro
2022-09-02  1:50     ` [PATCH v2 7/7] alpha: lazy FPU switching Al Viro
2022-09-02  4:24       ` Linus Torvalds
2022-09-02  5:07         ` Al Viro [this message]
2022-09-02  5:14           ` Al Viro

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=YxGPk1dDyCP2AWul@ZenIV \
    --to=viro@zeniv.linux.org.uk \
    --cc=linux-alpha@vger.kernel.org \
    --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.