All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jarek Poplawski <jarkao2@o2.pl>
To: Jon Maloy <jon.maloy@ericsson.com>
Cc: Eric Sesterhenn <snakebyte@gmx.de>,
	Per Liden <per.liden@ericsson.com>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	"'tipc-discussion\@lists\.sourceforge\.net'" 
	<tipc-discussion@lists.sourceforge.net>
Subject: Re: [PATCH] tipc: checking returns and Re: Possible Circular Locking in TIPC
Date: Fri, 5 Jan 2007 08:58:57 +0100	[thread overview]
Message-ID: <20070105075857.GB1675@ff.dom.local> (raw)
In-Reply-To: <459D2854.1000405@ericsson.com>

On Thu, Jan 04, 2007 at 04:16:20PM +0000, Jon Maloy wrote:
> Regards
> ///jon
> 
> Jarek Poplawski wrote:
> 
> >
> >I know lockdep is sometimes
> >too careful but nevertheless some change is needed
> >to fix a real bug or give additional information
> >to lockdep. 
> > 
> >
> I don't know lockdep well enough yet, but I will try to find out if that
> is possible.

If you are sure there is no circular locking possible
between these two functions and this entry->lock here
isn't endangered by other functions, you could try to
make lockdep "silent" like this: 


        write_lock_bh(&ref_table_lock);
        if (tipc_ref_table.first_free) {
                index = tipc_ref_table.first_free;
                entry = &(tipc_ref_table.entries[index]);
                index_mask = tipc_ref_table.index_mask;
                /* take lock in case a previous user of entry still holds it */

-                spin_lock_bh(&entry->lock, );
+		local_bh_disable();
+		spin_lock_nested(&entry->lock, SINGLE_DEPTH_NESTING);

                next_plus_upper = entry->data.next_plus_upper;
                tipc_ref_table.first_free = next_plus_upper & index_mask;
                reference = (next_plus_upper & ~index_mask) + index;
                entry->data.reference = reference;
                entry->object = object;
                if (lock != 0)
                        *lock = &entry->lock;

/* may stay as is or: */
-                spin_unlock_bh(&entry->lock);
+		spin_unlock(&entry->lock);
+		local_bh_enable();

        }
        write_unlock_bh(&ref_table_lock);


Cheers,
Jarek P.

  reply	other threads:[~2007-01-05  7:57 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-22 14:28 Possible Circular Locking in TIPC Eric Sesterhenn
2006-12-28 12:17 ` [PATCH] tipc: checking returns and " Jarek Poplawski
2007-01-03 23:16   ` Jon Maloy
2007-01-04 12:28     ` Jarek Poplawski
2007-01-04 16:16       ` Jon Maloy
2007-01-05  7:58         ` Jarek Poplawski [this message]
2007-01-05 17:22           ` Jon Maloy

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=20070105075857.GB1675@ff.dom.local \
    --to=jarkao2@o2.pl \
    --cc=jon.maloy@ericsson.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=per.liden@ericsson.com \
    --cc=snakebyte@gmx.de \
    --cc=tipc-discussion@lists.sourceforge.net \
    /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.