linux-parisc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeroen Roovers <jer@xs4all.nl>
To: Helge Deller <deller@gmx.de>
Cc: Meelis Roos <mroos@linux.ee>,
	linux-parisc@vger.kernel.org,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	John David Anglin <dave.anglin@bell.net>
Subject: Re: [RFC PATCH] parisc: Add wrapper syscalls to fix O_NONBLOCK flag usage
Date: Fri, 23 Oct 2020 09:02:32 +0200	[thread overview]
Message-ID: <20201023090232.3b56d308@wim.jer> (raw)
In-Reply-To: <b187505a-2ca1-c385-3b4e-16ae49f5c1ce@gmx.de>

On Thu, 22 Oct 2020 22:29:18 +0200
Helge Deller <deller@gmx.de> wrote:

> On 10/22/20 9:11 PM, Meelis Roos wrote:
> >
> > 22.10.20 19:40 Helge Deller wrotw:  
> >> This patch adds wrapper functions for the relevant syscalls. The
> >> wrappers masks out any old invalid O_NONBLOCK flags, reports in the
> >> syslog if the old O_NONBLOCK value was used and then calls the
> >> target syscall with the new O_NONBLOCK value.
> >>
> >> Fixes: 75ae04206a4d ("parisc: Define O_NONBLOCK to become
> >> 000200000") Signed-off-by: Helge Deller <deller@gmx.de>  
> >
> > Works for me on RP2470 - boots up in full functionality and logs
> > the recompilation warning about systemd-udevd and syslog-ng.
> >
> > Tested-by: Meelis Roos <mroos@linux.ee>  
> 
> Thank you Meelis & Jeroen for testing!
> 
> The big question is:
> We have two options
> a) revert my original commit 75ae04206a4d ("parisc: Define O_NONBLOCK
> to become 000200000"), or b) apply and submit this new patch on top
> of it.
> 
> The benefit in b) is that we will get long term rid of the two-bit
> O_NONBLOCK define and thus will get more compatible to other Linux
> architectures. This comes with the downside of (at least for a few
> years) added overhead for those non-performance critical syscalls.

The performance issue is resolved once the installed kernel
headers/libc have been updated accordingly. I think after that the
overhead should be minimal.

> 
> The benefit with a) is that we then step back again and stay
> compatible now. The downside is, that in the future we may run into
> other issues and need to keep special-handling in some other syscalls
> forever.
> 
> I'm still for going with b), and I hope we got all corner cases ruled
> out. Opinions?

I think the performance penalty isn't that great, but could be
improved, so I'd go for b) with a small change. The warning that it
issues seems redundant, because the immediate problem has already been
"solved", and because the proposed solution does not work:

+{
+	if (flags & O_NONBLOCK_MASK_OUT) {
+		struct task_struct *tsk = current;
+		pr_warn("%s(%d) uses old O_NONBLOCK value. "
+			"Please recompile the application.\n",
+			tsk->comm, tsk->pid);
+	}
+	return flags & ~O_NONBLOCK_MASK_OUT;
+}
+

The text assumes that the officially packaged kernel headers are in
sync with the kernel, which normally isn't the case as most
distributions seem to either pick an LTS kernel for their toolchain, or
keep the installed kernel in sync with the installed kernel headers,
but do not prevent running newer kernels and may even encourage doing
so. Simply recompiling the programs that use the old O_NONBLOCK value
does not solve the problem in most cases.

If you'd remove that if() { pr_warn } entirely, you'd probably be
rid of most of the performance penalty anyway.


Regards,
     jer

  reply	other threads:[~2020-10-23  7:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-29 12:20 [RFC PATCH] parisc: Define O_NONBLOCK to become 000200000 Helge Deller
2020-10-20 17:21 ` Jeroen Roovers
2020-10-21  6:07   ` Helge Deller
2020-10-22 15:38     ` Jeroen Roovers
2020-10-22 16:14       ` Helge Deller
2020-10-22 16:40         ` [RFC PATCH] parisc: Add wrapper syscalls to fix O_NONBLOCK flag usage Helge Deller
2020-10-22 19:11           ` Meelis Roos
2020-10-22 20:29             ` Helge Deller
2020-10-23  7:02               ` Jeroen Roovers [this message]
2020-10-23  8:35                 ` Helge Deller
2020-10-23  8:53                   ` Jeroen Roovers
2020-10-23 18:15                     ` Helge Deller
2020-10-22 20:00           ` Jeroen Roovers
2020-10-23  7:25           ` Rolf Eike Beer
2020-10-23  8:18             ` Helge Deller
2020-10-23  8:31               ` Helge Deller
2020-10-23  8:58                 ` Rolf Eike Beer
2020-10-23 18:18           ` [RFC PATCH v3] " Helge Deller
2020-10-24  8:22             ` Jeroen Roovers
2020-10-24  8:24               ` Jeroen Roovers
2020-10-24  8:34                 ` Helge Deller
2020-10-24 14:11                   ` John David Anglin
2020-10-24  9:59             ` Jeroen Roovers
2020-10-25 11:48               ` Helge Deller

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=20201023090232.3b56d308@wim.jer \
    --to=jer@xs4all.nl \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=dave.anglin@bell.net \
    --cc=deller@gmx.de \
    --cc=linux-parisc@vger.kernel.org \
    --cc=mroos@linux.ee \
    /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;
as well as URLs for NNTP newsgroup(s).