From: David Laight <David.Laight@ACULAB.COM>
To: 'Al Viro' <viro@zeniv.linux.org.uk>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: kernel test robot <oliver.sang@intel.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>, Borislav Petkov <bp@alien8.de>,
Peter Zijlstra <peterz@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
"lkp@lists.01.org" <lkp@lists.01.org>,
kernel test robot <lkp@intel.com>,
"Huang, Ying" <ying.huang@intel.com>,
Feng Tang <feng.tang@intel.com>,
"zhengjun.xing@intel.com" <zhengjun.xing@intel.com>
Subject: RE: [x86] d55564cfc2: will-it-scale.per_thread_ops -5.8% regression
Date: Fri, 8 Jan 2021 09:29:42 +0000 [thread overview]
Message-ID: <e5316226f4174de7925c895cca65a94e@AcuMS.aculab.com> (raw)
In-Reply-To: <20210107195734.GL3579531@ZenIV.linux.org.uk>
From: Al Viro
> Sent: 07 January 2021 19:58
>
> On Thu, Jan 07, 2021 at 11:33:36AM -0800, Linus Torvalds wrote:
>
> > In fact, even some threaded app that does what I suspect it could do
> > would likely be ok with it 99% of the time. Because the situation
> > where you change the fd in the poll array is likely not the common
> > case, and even if some -1 file descriptor gets overwritten by a valid
> > one by the poll() system call again, it probably ends up being very
> > hard to see a failure.
> >
> > Which just makes me even more nervous.
>
> Hmm... But anything like that will have another problem - we do
> copyin only once. And we repeat fdget() on each iteration of
> do_poll() loop. Sure, we don't actually put anything on the
> queues after the first time around, and __pollwait() keeps the
> ones we are actually waiting for pinned, but... If another
> thread stores -1 to ->fd, then closes what used to be there
> and moves on, what will it see? ->poll() calls will be done
> for whatever file we'd reused the descriptor for. Sure,
> the kernel won't break, but the caller of poll() would need
> to be very careful about what it sees...
>
> Frankly, I'd consider seeing that kind of games in the userland
> as a big red flag; I'm not saying it's OK to break the suckers
> even worse than they are now, but I'm curious whether anything
> in the userland does it *and* how many bugs does it have around
> those uses of poll()...
It is much more likely that an application will change the 'events'
field - in particular enabling POLLOUT if a write() returned EAGAIN.
It could also change the fd, but defer doing the actual close() until
much later - that needs to be synchronised between the application
threads.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
next prev parent reply other threads:[~2021-01-08 9:31 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-07 13:47 [x86] d55564cfc2: will-it-scale.per_thread_ops -5.8% regression kernel test robot
2021-01-07 17:43 ` Linus Torvalds
2021-01-07 18:33 ` Al Viro
2021-01-07 18:40 ` Al Viro
2021-01-07 18:55 ` Al Viro
2021-01-07 18:47 ` Linus Torvalds
2021-01-07 18:58 ` Al Viro
2021-01-07 19:04 ` Al Viro
2021-01-07 19:33 ` Linus Torvalds
2021-01-07 19:57 ` Al Viro
2021-01-08 9:29 ` David Laight [this message]
2021-01-08 9:37 ` David Laight
2021-01-08 9:51 ` Peter Zijlstra
2021-01-08 10:44 ` David Laight
2021-01-08 9:49 ` David Laight
2021-01-08 6:13 ` Oliver Sang
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=e5316226f4174de7925c895cca65a94e@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=bp@alien8.de \
--cc=feng.tang@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=lkp@lists.01.org \
--cc=mingo@kernel.org \
--cc=oliver.sang@intel.com \
--cc=peterz@infradead.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=ying.huang@intel.com \
--cc=zhengjun.xing@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox