From: Julien Grall <julien.grall@linaro.org>
To: Andrew Cooper <andrew.cooper3@citrix.com>,
Xen-devel <xen-devel@lists.xen.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
Wei Liu <wei.liu2@citrix.com>,
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
George Dunlap <George.Dunlap@eu.citrix.com>,
Tim Deegan <tim@xen.org>, Julien Grall <julien.grall@arm.com>,
Jan Beulich <JBeulich@suse.com>
Subject: Re: [PATCH for-4.10] common/spinlock: Improve the output from check_lock() if it trips
Date: Thu, 2 Nov 2017 13:52:44 +0000 [thread overview]
Message-ID: <ee69cc2b-bddf-25b5-6b10-d408e53fe790@linaro.org> (raw)
In-Reply-To: <1509446950-28463-1-git-send-email-andrew.cooper3@citrix.com>
Hi Andrew,
On 31/10/17 10:49, Andrew Cooper wrote:
> If check_lock() triggers, a crash will occur. Instead of simply identifying
> "the irq context was different", indicate the expected and current irq
> context.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Release-acked-by: Julien Grall <julien.grall@linaro.org>
Cheers,
> ---
> CC: George Dunlap <George.Dunlap@eu.citrix.com>
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
> CC: Stefano Stabellini <sstabellini@kernel.org>
> CC: Tim Deegan <tim@xen.org>
> CC: Wei Liu <wei.liu2@citrix.com>
> CC: Julien Grall <julien.grall@arm.com>
>
> check_lock() only exists in debug builds, which makes this a low risk change
> for 4.10.
> ---
> xen/common/spinlock.c | 8 +++++++-
> 1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/xen/common/spinlock.c b/xen/common/spinlock.c
> index 44b07b7..8f2ba08 100644
> --- a/xen/common/spinlock.c
> +++ b/xen/common/spinlock.c
> @@ -44,7 +44,13 @@ static void check_lock(struct lock_debug *debug)
> if ( unlikely(debug->irq_safe != irq_safe) )
> {
> int seen = cmpxchg(&debug->irq_safe, -1, irq_safe);
> - BUG_ON(seen == !irq_safe);
> +
> + if ( seen == !irq_safe )
> + {
> + printk("CHECKLOCK FAILURE: prev irqsafe: %d, curr irqsafe %d\n",
> + seen, irq_safe);
> + BUG();
> + }
> }
> }
>
>
--
Julien Grall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2017-11-02 13:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 10:49 [PATCH for-4.10] common/spinlock: Improve the output from check_lock() if it trips Andrew Cooper
2017-10-31 10:52 ` Wei Liu
2017-10-31 10:53 ` George Dunlap
2017-11-02 13:52 ` Julien Grall [this message]
2017-11-06 11:09 ` Jan Beulich
2017-11-13 16:05 ` Julien Grall
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=ee69cc2b-bddf-25b5-6b10-d408e53fe790@linaro.org \
--to=julien.grall@linaro.org \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=julien.grall@arm.com \
--cc=konrad.wilk@oracle.com \
--cc=sstabellini@kernel.org \
--cc=tim@xen.org \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/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).