From: "Song Bao Hua (Barry Song)" <song.bao.hua@hisilicon.com>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>
Cc: "linux-input@vger.kernel.org" <linux-input@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: RE: [PATCH] Input: ar1021 - use IRQ_NOAUTOEN flags to replace disable_irq
Date: Sat, 2 Jan 2021 07:58:13 +0000 [thread overview]
Message-ID: <0404c78f6be5434fbe9eab9539a2443d@hisilicon.com> (raw)
In-Reply-To: <X/AKvA8Wt0F6DjcU@google.com>
> -----Original Message-----
> From: Dmitry Torokhov [mailto:dmitry.torokhov@gmail.com]
> Sent: Saturday, January 2, 2021 6:55 PM
> To: Song Bao Hua (Barry Song) <song.bao.hua@hisilicon.com>
> Cc: linux-input@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] Input: ar1021 - use IRQ_NOAUTOEN flags to replace
> disable_irq
>
> Hi Barry,
Hi Dmitry,
Thanks for your quick reply.
>
> On Sat, Jan 02, 2021 at 05:29:02PM +1300, Barry Song wrote:
> > disable_irq() after request_irq is unsafe as it gives a time gap which
> > irq can come before disable_irq(). IRQ_NOAUTOEN is the common way to
> > avoid enabling IRQ due to requesting IRQ.
>
> Actually it is OK for the ISR to fire before the input device is
> registered, input core allows that.
>
Yep. probably the only issue left is that the code looks silly.
It enables the interrupt in request_irq() automatically and
disables it immediately. So a better way would be avoiding enabling
the IRQ during request_irq().
> What I would like to see is to allow passing something like
> IRQF_DISABLED to request_irq() so that we would not need neither
> irq_set_status_flags() nor disable_irq().
>
IRQF_DISABLED has been deleted for many years since Linux kernel
doesn't support interrupts enter while an irq handler is running
any more. That flag used to work for forbidding all interrupts
while kernel was running in one hardIRQ to avoid IRQ races for
kernel older than 2.6.32.
Maybe we can invent a new flag like IRQF_NOAUTOEN for request_irq()?
but right now all other drivers are using irq_set_status_flags
(IRQ_NOAUTOEN) since this request flag doesn't exist.
Do you think it is worth to add a new flag to replace many
irq_set_status_flags(irq, IRQ_NOAUTOEN);
request_irq();
in drivers/gpu, i2c, input, media, net, perf, tc, spi, tty,
usb, vfio?
and +Thomas to get his comments as well :-)
> Thanks.
>
> --
> Dmitry
Thanks
Barry
prev parent reply other threads:[~2021-01-02 7:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-02 4:29 [PATCH] Input: ar1021 - use IRQ_NOAUTOEN flags to replace disable_irq Barry Song
2021-01-02 5:55 ` Dmitry Torokhov
2021-01-02 7:58 ` Song Bao Hua (Barry Song) [this message]
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=0404c78f6be5434fbe9eab9539a2443d@hisilicon.com \
--to=song.bao.hua@hisilicon.com \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tglx@linutronix.de \
/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).