All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Anton Blanchard <anton@samba.org>
Cc: Don Zickus <dzickus@redhat.com>,
	x86@kernel.org, Russell King <linux@arm.linux.org.uk>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	peterz@infradead.org, hpa@zytor.com,
	linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Ingo Molnar <mingo@redhat.com>, Paul Mackerras <paulus@samba.org>,
	linux-arm-kernel@lists.infradead.org,
	Andrew Morton <akpm@linux-foundation.org>,
	linuxppc-dev@lists.ozlabs.org,
	Thomas Gleixner <tglx@linutronix.de>,
	sam.bobroff@au1.ibm.com, Arjan van de Ven <arjan@infradead.org>
Subject: Re: [PATCH 1/7] Add die_spin_lock_{irqsave,irqrestore}
Date: Tue, 24 Feb 2015 07:41:07 +0100	[thread overview]
Message-ID: <20150224064107.GB15387@gmail.com> (raw)
In-Reply-To: <1424748634-9153-2-git-send-email-anton@samba.org>


* Anton Blanchard <anton@samba.org> wrote:

> +static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;
> +static int die_owner = -1;
> +static unsigned int die_nest_count;
> +
> +unsigned long __die_spin_lock_irqsave(void)
> +{
> +	unsigned long flags;
> +	int cpu;
> +
> +	/* racy, but better than risking deadlock. */
> +	raw_local_irq_save(flags);
> +
> +	cpu = smp_processor_id();
> +	if (!arch_spin_trylock(&die_lock)) {
> +		if (cpu != die_owner)
> +			arch_spin_lock(&die_lock);

So why not trylock and time out here after a few seconds, 
instead of indefinitely supressing some potentially vital 
output due to some other CPU crashing/locking with the lock 
held?

> +	}
> +	die_nest_count++;
> +	die_owner = cpu;
> +
> +	return flags;

I suspect this would work in most cases.

If we fix the deadlock potential, and get a true global 
ordering of various oopses/warnings as they triggered (or 
at least timestamping them), then I'm sold on this I guess, 
it will likely improve things.

Thanks,

	Ingo

WARNING: multiple messages have this Message-ID (diff)
From: mingo@kernel.org (Ingo Molnar)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/7] Add die_spin_lock_{irqsave,irqrestore}
Date: Tue, 24 Feb 2015 07:41:07 +0100	[thread overview]
Message-ID: <20150224064107.GB15387@gmail.com> (raw)
In-Reply-To: <1424748634-9153-2-git-send-email-anton@samba.org>


* Anton Blanchard <anton@samba.org> wrote:

> +static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;
> +static int die_owner = -1;
> +static unsigned int die_nest_count;
> +
> +unsigned long __die_spin_lock_irqsave(void)
> +{
> +	unsigned long flags;
> +	int cpu;
> +
> +	/* racy, but better than risking deadlock. */
> +	raw_local_irq_save(flags);
> +
> +	cpu = smp_processor_id();
> +	if (!arch_spin_trylock(&die_lock)) {
> +		if (cpu != die_owner)
> +			arch_spin_lock(&die_lock);

So why not trylock and time out here after a few seconds, 
instead of indefinitely supressing some potentially vital 
output due to some other CPU crashing/locking with the lock 
held?

> +	}
> +	die_nest_count++;
> +	die_owner = cpu;
> +
> +	return flags;

I suspect this would work in most cases.

If we fix the deadlock potential, and get a true global 
ordering of various oopses/warnings as they triggered (or 
at least timestamping them), then I'm sold on this I guess, 
it will likely improve things.

Thanks,

	Ingo

WARNING: multiple messages have this Message-ID (diff)
From: Ingo Molnar <mingo@kernel.org>
To: Anton Blanchard <anton@samba.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Paul Mackerras <paulus@samba.org>,
	Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	sam.bobroff@au1.ibm.com, Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>,
	hpa@zytor.com, Russell King <linux@arm.linux.org.uk>,
	peterz@infradead.org, Don Zickus <dzickus@redhat.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,
	x86@kernel.org, Linus Torvalds <torvalds@linux-foundation.org>,
	Arjan van de Ven <arjan@infradead.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: Re: [PATCH 1/7] Add die_spin_lock_{irqsave,irqrestore}
Date: Tue, 24 Feb 2015 07:41:07 +0100	[thread overview]
Message-ID: <20150224064107.GB15387@gmail.com> (raw)
In-Reply-To: <1424748634-9153-2-git-send-email-anton@samba.org>


* Anton Blanchard <anton@samba.org> wrote:

> +static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;
> +static int die_owner = -1;
> +static unsigned int die_nest_count;
> +
> +unsigned long __die_spin_lock_irqsave(void)
> +{
> +	unsigned long flags;
> +	int cpu;
> +
> +	/* racy, but better than risking deadlock. */
> +	raw_local_irq_save(flags);
> +
> +	cpu = smp_processor_id();
> +	if (!arch_spin_trylock(&die_lock)) {
> +		if (cpu != die_owner)
> +			arch_spin_lock(&die_lock);

So why not trylock and time out here after a few seconds, 
instead of indefinitely supressing some potentially vital 
output due to some other CPU crashing/locking with the lock 
held?

> +	}
> +	die_nest_count++;
> +	die_owner = cpu;
> +
> +	return flags;

I suspect this would work in most cases.

If we fix the deadlock potential, and get a true global 
ordering of various oopses/warnings as they triggered (or 
at least timestamping them), then I'm sold on this I guess, 
it will likely improve things.

Thanks,

	Ingo

  reply	other threads:[~2015-02-24  6:41 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24  3:30 [PATCH 0/7] Serialise oopses, BUGs, WARNs, dump_stack, soft lockups and hard lockups Anton Blanchard
2015-02-24  3:30 ` Anton Blanchard
2015-02-24  3:30 ` Anton Blanchard
2015-02-24  3:30 ` [PATCH 1/7] Add die_spin_lock_{irqsave,irqrestore} Anton Blanchard
2015-02-24  3:30   ` Anton Blanchard
2015-02-24  3:30   ` Anton Blanchard
2015-02-24  6:41   ` Ingo Molnar [this message]
2015-02-24  6:41     ` Ingo Molnar
2015-02-24  6:41     ` Ingo Molnar
2015-02-24  7:27     ` Ingo Molnar
2015-02-24  7:27       ` Ingo Molnar
2015-02-24  7:27       ` Ingo Molnar
2015-02-24  9:56     ` David Laight
2015-02-24  9:56       ` David Laight
2015-02-24  9:56       ` David Laight
2015-02-24  3:30 ` [PATCH 2/7] powerpc: Use die_spin_lock_{irqsave,irqrestore} Anton Blanchard
2015-02-24  3:30   ` Anton Blanchard
2015-02-24  3:30   ` Anton Blanchard
2015-02-24  3:30 ` [PATCH 3/7] arm: " Anton Blanchard
2015-02-24  3:30   ` Anton Blanchard
2015-02-24  3:30   ` Anton Blanchard
2015-02-24  3:30 ` [PATCH 4/7] x86: " Anton Blanchard
2015-02-24  3:30   ` Anton Blanchard
2015-02-24  3:30   ` Anton Blanchard
2015-02-24  3:30 ` [PATCH 5/7] watchdog: Serialise soft lockup errors with die_spin_lock_{irqsave, irqrestore} Anton Blanchard
2015-02-24  3:30   ` [PATCH 5/7] watchdog: Serialise soft lockup errors with die_spin_lock_{irqsave,irqrestore} Anton Blanchard
2015-02-24  3:30   ` [PATCH 5/7] watchdog: Serialise soft lockup errors with die_spin_lock_{irqsave, irqrestore} Anton Blanchard
2015-02-24  3:30 ` [PATCH 6/7] dump_stack: Serialise dump_stack " Anton Blanchard
2015-02-24  3:30   ` [PATCH 6/7] dump_stack: Serialise dump_stack with die_spin_lock_{irqsave,irqrestore} Anton Blanchard
2015-02-24  3:30   ` [PATCH 6/7] dump_stack: Serialise dump_stack with die_spin_lock_{irqsave, irqrestore} Anton Blanchard
2015-02-24  3:30 ` [PATCH 7/7] powerpc: Serialise BUG and WARNs " Anton Blanchard
2015-02-24  3:30   ` [PATCH 7/7] powerpc: Serialise BUG and WARNs with die_spin_lock_{irqsave,irqrestore} Anton Blanchard
2015-02-24  3:30   ` [PATCH 7/7] powerpc: Serialise BUG and WARNs with die_spin_lock_{irqsave, irqrestore} Anton Blanchard
2015-02-24  6:35 ` [PATCH 0/7] Serialise oopses, BUGs, WARNs, dump_stack, soft lockups and hard lockups Ingo Molnar
2015-02-24  6:35   ` Ingo Molnar
2015-02-24  6:35   ` Ingo Molnar
2015-02-24  9:39   ` Arjan van de Ven
2015-02-24  9:39     ` Arjan van de Ven
2015-02-24  9:39     ` Arjan van de Ven
2015-02-24 10:43     ` Russell King - ARM Linux
2015-02-24 10:43       ` Russell King - ARM Linux
2015-02-24 10:43       ` Russell King - ARM Linux

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=20150224064107.GB15387@gmail.com \
    --to=mingo@kernel.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=anton@samba.org \
    --cc=arjan@infradead.org \
    --cc=dzickus@redhat.com \
    --cc=hpa@zytor.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sam.bobroff@au1.ibm.com \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.