linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Russell King - ARM Linux <linux@armlinux.org.uk>
To: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: Oleksandr Shamray <oleksandrs@mellanox.com>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"jiri@resnulli.us" <jiri@resnulli.us>,
	"'Chip Bilbrey'" <chip@bilbrey.org>,
	"arnd@arndb.de" <arnd@arndb.de>,
	"linux-api@vger.kernel.org" <linux-api@vger.kernel.org>,
	"openbmc@lists.ozlabs.org" <openbmc@lists.ozlabs.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"openocd-devel-owner@lists.sourceforge.net" 
	<openocd-devel-owner@lists.sourceforge.net>,
	"mec@shout.net" <mec@shout.net>, Jiri Pirko <jiri@mellanox.com>,
	"robh+dt@kernel.org" <robh+dt@kernel.org>,
	"joel@jms.id.au" <joel@jms.id.au>,
	"linux-serial@vger.kernel.org" <linux-serial@vger.kernel.org>,
	"tklauser@distanz.ch" <tklauser@distanz.ch>,
	"mchehab@kernel.org" <mchehab@kernel.org>,
	"davem@davemloft.net" <davem@davemloft.net>,
	"linux-arm-kernel@lists.infradead.org" 
	<linux-arm-kernel@lists.infradead.org>
Subject: Re: [v11,1/4] drivers: jtag: Add JTAG core driver
Date: Tue, 14 Nov 2017 11:19:16 +0000	[thread overview]
Message-ID: <20171114111916.GO12318@n2100.armlinux.org.uk> (raw)
In-Reply-To: <20171114111046.GA23820@kroah.com>

On Tue, Nov 14, 2017 at 12:10:46PM +0100, gregkh@linuxfoundation.org wrote:
> On Tue, Nov 14, 2017 at 10:34:49AM +0000, Oleksandr Shamray wrote:
> > Greg, what you can suggest about it. May be better to add again single-open()-per-device lock with right locking way like:
> > 
> > >if (mutex_lock_interruptible(&jtag->open_lock)) {
> 
> You would stall an open?  Why not just return saying you can't do that?

Greg, I think you need to look at the code again.

>From the snippet in the email, this lock is not held while the device is
open, as you apparently think it is.  It's a short-term lock that is
held to ensure atomic access to the jtag->opened member, so that two
concurrent opens are unable to operate lock-step, resulting in
jtag->opened becoming 2.

The open function snippet in the email drops the lock as soon as it has
incremented jtag->opened, or encounters an error.

It seems entirely sensible, rather than using an atomic_t counter, as
it means that other openers are held off until the current opener has
either succeeded in opening the device or failed to open it.

-- 
RMK's Patch system: http://www.armlinux.org.uk/developer/patches/
FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up
According to speedtest.net: 8.21Mbps down 510kbps up

  reply	other threads:[~2017-11-14 11:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-03 15:54 [patch v11 0/4] JTAG driver introduction Oleksandr Shamray
2017-11-03 15:54 ` [patch v11 1/4] drivers: jtag: Add JTAG core driver Oleksandr Shamray
2017-11-04 11:36   ` Greg KH
2017-11-05 22:32   ` [v11,1/4] " Chip Bilbrey
2017-11-06 14:28     ` Oleksandr Shamray
2017-11-14 10:34     ` Oleksandr Shamray
2017-11-14 11:10       ` gregkh
2017-11-14 11:19         ` Russell King - ARM Linux [this message]
2017-11-14 11:31           ` gregkh
2017-11-03 15:54 ` [patch v11 2/4] drivers: jtag: Add Aspeed SoC 24xx and 25xx families JTAG master driver Oleksandr Shamray
2017-11-03 15:54 ` [patch v11 3/4] Documentation: jtag: Add bindings for " Oleksandr Shamray
2017-11-03 15:54 ` [patch v11 4/4] Documentation: jtag: Add ABI documentation Oleksandr Shamray
2017-11-07 10:36   ` Tobias Klauser

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=20171114111916.GO12318@n2100.armlinux.org.uk \
    --to=linux@armlinux.org.uk \
    --cc=arnd@arndb.de \
    --cc=chip@bilbrey.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jiri@mellanox.com \
    --cc=jiri@resnulli.us \
    --cc=joel@jms.id.au \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=mec@shout.net \
    --cc=oleksandrs@mellanox.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=openocd-devel-owner@lists.sourceforge.net \
    --cc=robh+dt@kernel.org \
    --cc=tklauser@distanz.ch \
    /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).