All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@whamcloud.com>
To: lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH 4/7] lustre: give different tcd_lock types different classes.
Date: Mon, 30 Jul 2018 21:32:54 +0000	[thread overview]
Message-ID: <737EAA0C-F4F2-4C5A-ACDC-85BB557ACA5F@whamcloud.com> (raw)
In-Reply-To: <153292257292.26496.6025900918938045378.stgit@noble>

On Jul 29, 2018, at 21:49, NeilBrown <neilb@suse.com> wrote:
> 
> There are three different trace contexts:
> process, softirq, irq.
> Each has its own lock (tcd_lock) which is locked
> as appropriate for that context.
> lockdep currently doesn't see that they are different
> and so deduces that the different uses might lead to
> deadlocks.
> So use separate calls to spin_lock_init() so that they
> each get a separate lock class, and lockdep sees no
> problem.
> 
> Signed-off-by: NeilBrown <neilb@suse.com>

Reviewed-by: Andreas Dilger <adilger@whamcloud.com>

> ---
> drivers/staging/lustre/lnet/libcfs/tracefile.c |   18 +++++++++++++++++-
> 1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/lustre/lnet/libcfs/tracefile.c b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> index d4c80cf254e4..40048165fc16 100644
> --- a/drivers/staging/lustre/lnet/libcfs/tracefile.c
> +++ b/drivers/staging/lustre/lnet/libcfs/tracefile.c
> @@ -1285,7 +1285,23 @@ int cfs_tracefile_init(int max_pages)
> 	cfs_tcd_for_each(tcd, i, j) {
> 		int factor = pages_factor[i];
> 
> -		spin_lock_init(&tcd->tcd_lock);
> +		/* Note that we have three separate calls so
> +		 * they the locks get three separate classes
> +		 * and lockdep never thinks they are related.
> +		 * As they are used in different interrupt
> +		 * contexts, lockdep think the usage would conflict.
> +		 */
> +		switch(i) {
> +		case CFS_TCD_TYPE_PROC:
> +			spin_lock_init(&tcd->tcd_lock);
> +			break;
> +		case CFS_TCD_TYPE_SOFTIRQ:
> +			spin_lock_init(&tcd->tcd_lock);
> +			break;
> +		case CFS_TCD_TYPE_IRQ:
> +			spin_lock_init(&tcd->tcd_lock);
> +			break;
> +		}
> 		tcd->tcd_pages_factor = factor;
> 		tcd->tcd_type = i;
> 		tcd->tcd_cpu = j;
> 
> 

Cheers, Andreas
---
Andreas Dilger
CTO Whamcloud




-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 235 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.lustre.org/pipermail/lustre-devel-lustre.org/attachments/20180730/6120dad5/attachment.sig>

  reply	other threads:[~2018-07-30 21:32 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-30  3:49 [lustre-devel] [PATCH 0/7] lustre: ad-hoc fixes NeilBrown
2018-07-30  3:49 ` [lustre-devel] [PATCH 5/7] lustre/libcfs: discard cfs_trace_allocate_string_buffer() NeilBrown
2018-07-30 21:37   ` Andreas Dilger
2018-08-02  3:47   ` James Simmons
2018-07-30  3:49 ` [lustre-devel] [PATCH 3/7] lustre/libfs: move debugfs registration from libcfs_setup back to libcfs_init NeilBrown
2018-07-30 21:32   ` Andreas Dilger
2018-08-02  3:46   ` James Simmons
2018-07-30  3:49 ` [lustre-devel] [PATCH 1/7] lustre: use schedule_timeout_$state() NeilBrown
2018-07-30 21:30   ` Andreas Dilger
2018-08-02  3:45   ` James Simmons
2018-07-30  3:49 ` [lustre-devel] [PATCH 4/7] lustre: give different tcd_lock types different classes NeilBrown
2018-07-30 21:32   ` Andreas Dilger [this message]
2018-08-02  3:46   ` James Simmons
2018-07-30  3:49 ` [lustre-devel] [PATCH 2/7] lustre/libcfs: fix freeing after kmalloc failure NeilBrown
2018-07-30 21:31   ` Andreas Dilger
2018-08-02  3:46   ` James Simmons
2018-07-30  3:49 ` [lustre-devel] [PATCH 7/7] lustre: change TASK_NOLOAD to TASK_IDLE NeilBrown
2018-07-30 21:43   ` Andreas Dilger
2018-08-02  3:48   ` James Simmons
2018-08-02  4:18     ` NeilBrown
2018-08-02 12:48       ` Patrick Farrell
2018-07-30  3:49 ` [lustre-devel] [PATCH 6/7] lustre: lnet: convert ni_refs to percpu_refcount NeilBrown
2018-08-02  3:47   ` James Simmons
2018-07-30 21:45 ` [lustre-devel] [PATCH 0/7] lustre: ad-hoc fixes Andreas Dilger

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=737EAA0C-F4F2-4C5A-ACDC-85BB557ACA5F@whamcloud.com \
    --to=adilger@whamcloud.com \
    --cc=lustre-devel@lists.lustre.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.