From: Keir Fraser <keir.xen@gmail.com>
To: Dan Magenheimer <dan.magenheimer@oracle.com>, xen-devel@lists.xen.org
Cc: Zhenzhong Duan <zhenzhong.duan@oracle.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Subject: Re: preemption and locking: why joined at the hip?
Date: Fri, 31 Aug 2012 21:08:02 +0100 [thread overview]
Message-ID: <CC66D832.3D8B3%keir.xen@gmail.com> (raw)
In-Reply-To: <16d6e254-acff-4212-b5ed-0b3dd5b40ea5@default>
On 31/08/2012 20:47, "Dan Magenheimer" <dan.magenheimer@oracle.com> wrote:
> Tracking down a tmem problem in 4.2.0-rcN that crashes the
> hypervisor, I've discovered a 4.2 changeset that forces
> a preemption_enable/disable for every lock/unlock.
>
> Tmem has dynamically allocated "objects" that contain a
> lock. The lock is held when the object is destroyed.
> No reason to unlock something that's about to be destroyed.
> But with the preempt_enable/disable in the generic locking code,
> and the fact that do_softirq ASSERTs that preempt_count
> must be zero, a crash occurs.
>
> While I'm suitably embarrassed that tmem has not yet
> been tested with any recent -unstable, and I note that the
> workaround is simple (forcing an unlock before destroying the
> object containing the held lock), I have to ask if
> this change is really a good idea or is it unnecessary
> babysitting?
It is to prevent a vcpu from sleeping (eg on a waitqueue) while holding
spinlocks. If this were to happen, the possibility for deadlocks is obvious.
Hence it provides handy belt & braces sanity checking for this situation.
So just clean up after yourself and only destroy locks that are not locked.
;) I'm not clear why you'd be holding the lock during object destruction
anyway -- if anyone else could be spinning on the lock, it would not be safe
to free the lock.
-- Keir
> Dan
prev parent reply other threads:[~2012-08-31 20:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-31 19:47 preemption and locking: why joined at the hip? Dan Magenheimer
2012-08-31 20:08 ` Keir Fraser [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=CC66D832.3D8B3%keir.xen@gmail.com \
--to=keir.xen@gmail.com \
--cc=dan.magenheimer@oracle.com \
--cc=konrad.wilk@oracle.com \
--cc=xen-devel@lists.xen.org \
--cc=zhenzhong.duan@oracle.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;
as well as URLs for NNTP newsgroup(s).