From: Al Viro <viro@ZenIV.linux.org.uk>
To: "majun (F)" <majun258@huawei.com>
Cc: ebiederm@xmission.com, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org, akpm@linux-foundation.org,
dhowells@redhat.com, Waiman.Long@hp.com, dingtianhong@huawei.com,
guohanjun@huawei.com, fanjinke1@huawei.com
Subject: Re: [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function
Date: Wed, 2 Mar 2016 17:57:51 +0000 [thread overview]
Message-ID: <20160302175751.GJ17997@ZenIV.linux.org.uk> (raw)
In-Reply-To: <20160302172954.GI17997@ZenIV.linux.org.uk>
On Wed, Mar 02, 2016 at 05:29:54PM +0000, Al Viro wrote:
> And no, it doesn't save the irq state anywhere - both disable and enable
> are unconditional. schedule() always returns with irqs enabled.
PS: look at it that way: how would you expect a context switch to behave?
Suppose we blocked because we needed to write some dirty pages on disk
to be able to free them; we *can't* keep irqs disabled through all of that,
right? After all, disk controller needs to be able to tell us it's done
writing; hard to do that with interrupts disabled, not to mention that
keeping them disabled for typical duration of disk write would be rather
antisocial. So no matter how schedule() behaves wrt irqs, doing it with
irqs disabled would either invite deadlocks, or enable irqs at least for
a while. Even if it remembered that you used to have them disabled and
re-disabled them when switching back, you would still lose whatever protection
you were getting from having them disabled in the first place. If e.g.
you call request_irq() before being done setting the things up for
interrupt handler and count on finishing that before reenabling irqs, you
would need irqs to _stay_ disabled through all of that. And with any
blocking allocations there's no way to guarantee that.
prev parent reply other threads:[~2016-03-02 17:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 2:47 [PATCH] Change the spin_lock/unlock_irq interface in proc_alloc_inum() function MaJun
2016-03-02 3:09 ` Al Viro
2016-03-02 6:32 ` majun (F)
2016-03-02 17:29 ` Al Viro
2016-03-02 17:57 ` Al Viro [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=20160302175751.GJ17997@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=Waiman.Long@hp.com \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=dingtianhong@huawei.com \
--cc=ebiederm@xmission.com \
--cc=fanjinke1@huawei.com \
--cc=guohanjun@huawei.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=majun258@huawei.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