linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Juergen Gross <jgross@suse.com>,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	mhocko@suse.com, Jonathan Corbet <corbet@lwn.net>
Subject: Re: [PATCH 3/3] kernel/smp: add more data to CSD lock debugging
Date: Fri, 26 Feb 2021 10:12:05 -0800	[thread overview]
Message-ID: <20210226181205.GZ2743@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <YDkkFBerBlW5uUBS@hirez.programming.kicks-ass.net>

On Fri, Feb 26, 2021 at 05:38:44PM +0100, Peter Zijlstra wrote:
> 
> I hate all of this, but if this will finally catch the actual problem,
> we can then revert all this, so sure.

OK, I will bite...  What exactly do you hate about it?

							Thanx, Paul

> Also, I think this will conflict with the patches from Nadav that I have
> queued:
> 
>   https://lkml.kernel.org/r/20210220231712.2475218-1-namit@vmware.com
> 
> which I'll be pushing to tip/x86/mm once -rc1 happens.
> 
> On Fri, Feb 26, 2021 at 12:25:21PM +0100, Juergen Gross wrote:
> 
> > +static void __smp_call_single_queue_debug(int cpu, struct llist_node *node)
> > +{
> > +	unsigned int this_cpu = smp_processor_id();
> > +	struct cfd_seq_local *seq = this_cpu_ptr(&cfd_seq_local);
> > +	struct call_function_data *cfd = this_cpu_ptr(&cfd_data);
> > +	struct cfd_percpu *pcpu = per_cpu_ptr(cfd->pcpu, cpu);
> > +
> > +	cfd_seq_store(pcpu->seq_queue, this_cpu, cpu, CFD_SEQ_QUEUE);
> > +	if (llist_add(node, &per_cpu(call_single_queue, cpu))) {
> > +		cfd_seq_store(pcpu->seq_ipi, this_cpu, cpu, CFD_SEQ_IPI);
> > +		cfd_seq_store(seq->ping, this_cpu, cpu, CFD_SEQ_PING);
> > +		send_call_function_single_ipi(cpu);
> > +		cfd_seq_store(seq->pinged, this_cpu, cpu, CFD_SEQ_PINGED);
> > +	} else {
> > +		cfd_seq_store(pcpu->seq_noipi, this_cpu, cpu, CFD_SEQ_NOIPI);
> > +	}
> > +}
> >  #else
> > +#define cfd_seq_store(var, src, dst, type)
> > +
> >  static void csd_lock_record(call_single_data_t *csd)
> >  {
> >  }
> > @@ -290,6 +396,19 @@ static DEFINE_PER_CPU_SHARED_ALIGNED(call_single_data_t, csd_data);
> >  
> >  void __smp_call_single_queue(int cpu, struct llist_node *node)
> >  {
> > +#ifdef CONFIG_CSD_LOCK_WAIT_DEBUG
> > +	if (static_branch_unlikely(&csdlock_debug_extended)) {
> > +		unsigned int type;
> > +
> > +		type = CSD_TYPE(container_of(node, call_single_data_t,
> > +					     node.llist));
> > +		if (type == CSD_TYPE_SYNC || type == CSD_TYPE_ASYNC) {
> > +			__smp_call_single_queue_debug(cpu, node);
> > +			return;
> > +		}
> > +	}
> > +#endif
> 
> This is a bit weird, might as well put it in generic_exec_single()
> because there you still know the type matches.
> 
> 
> > @@ -712,12 +840,21 @@ static void smp_call_function_many_cond(const struct cpumask *mask,
> >  		csd->node.src = smp_processor_id();
> >  		csd->node.dst = cpu;
> >  #endif
> > -		if (llist_add(&csd->node.llist, &per_cpu(call_single_queue, cpu)))
> > +		cfd_seq_store(pcpu->seq_queue, this_cpu, cpu, CFD_SEQ_QUEUE);
> > +		if (llist_add(&csd->node.llist, &per_cpu(call_single_queue, cpu))) {
> >  			__cpumask_set_cpu(cpu, cfd->cpumask_ipi);
> > +			cfd_seq_store(pcpu->seq_ipi, this_cpu, cpu, CFD_SEQ_IPI);
> > +		} else {
> > +			cfd_seq_store(pcpu->seq_noipi, this_cpu, cpu, CFD_SEQ_NOIPI);
> > +		}
> >  	}
> >  
> >  	/* Send a message to all CPUs in the map */
> > +	cfd_seq_store(this_cpu_ptr(&cfd_seq_local)->ping, this_cpu,
> > +		      CFD_SEQ_NOCPU, CFD_SEQ_PING);
> >  	arch_send_call_function_ipi_mask(cfd->cpumask_ipi);
> > +	cfd_seq_store(this_cpu_ptr(&cfd_seq_local)->pinged, this_cpu,
> > +		      CFD_SEQ_NOCPU, CFD_SEQ_PINGED);
> 
> Too bad we can't share with the single case, a well.

  reply	other threads:[~2021-02-26 18:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-26 11:25 [PATCH 0/3] kernel/smp.c: add more CSD lock debugging Juergen Gross
2021-02-26 11:25 ` [PATCH 1/3] kernel/smp: add boot parameter for controlling " Juergen Gross
2021-02-26 11:25 ` [PATCH 2/3] kernel/smp: prepare more " Juergen Gross
2021-02-26 11:25 ` [PATCH 3/3] kernel/smp: add more data to " Juergen Gross
2021-02-26 16:38   ` Peter Zijlstra
2021-02-26 18:12     ` Paul E. McKenney [this message]
2021-02-26 21:05       ` Peter Zijlstra
2021-03-01  0:07         ` Paul E. McKenney
2021-03-01 15:45           ` Peter Zijlstra
2021-03-01 15:53             ` Jürgen Groß
2021-03-01 16:45               ` Paul E. McKenney

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=20210226181205.GZ2743@paulmck-ThinkPad-P72 \
    --to=paulmck@kernel.org \
    --cc=corbet@lwn.net \
    --cc=jgross@suse.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhocko@suse.com \
    --cc=peterz@infradead.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).