From: Ulisses Furquim <ulisses@profusion.mobi>
To: Marcel Holtmann <marcel@holtmann.org>,
Andre Guedes <andre.guedes@openbossa.org>,
linux-bluetooth@vger.kernel.org
Subject: Re: [RFC 4/4] Bluetooth: Interleaved discovery support
Date: Fri, 17 Feb 2012 13:25:23 -0200 [thread overview]
Message-ID: <CAA37ikbYxEbKhHbOmjEjRENoHraFLF7WvFhRBHvRRMw2U+=f_g@mail.gmail.com> (raw)
In-Reply-To: <20120217150030.GA9941@x220>
Hi,
On Fri, Feb 17, 2012 at 1:00 PM, Johan Hedberg <johan.hedberg@gmail.com> wr=
ote:
>
> Hi,
>
> On Fri, Feb 17, 2012, Johan Hedberg wrote:
> > > > > The locking doesn't look right to me above. hci_do_inquiry should=
be
> > > > > called with the lock held. I think it might be simpler if you mak=
e
> > > > > mgmt_interleaved_discovery() require the caller to hold the lock.
> > > >
> > > > Yes, you're right. I just realized hci_do_inquiry now calls inquiry=
_
> > > > cache_flush which requires hdev->lock held. I'll fix this too. Than=
ks.
> > >
> > > please keep the lock inside mgmt_interleaved_discovery() for now. We
> > > have enough locking crazy. I don't wanna add to it by making the call=
er
> > > deal with it right now.
> >
> > The calling code looks like this:
> >
> > +
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 if (hdev->discovery.type =3D=3D DISCOV_TY=
PE_INTERLEAVED) {
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 mgmt_interleaved_discover=
y(hdev);
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 } else {
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 hci_dev_lock(hdev);
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 hci_discovery_set_state(h=
dev, DISCOVERY_STOPPED);
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 hci_dev_unlock(hdev);
> > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 }
> >
> > I was thinking that if mgmt_interleaved_discovery required the lock to
> > be held this code would become simpler:
> >
> > =A0 =A0 =A0 hci_dev_lock(hdev);
> >
> > =A0 =A0 =A0 if (hdev->discovery.type =3D=3D DISCOV_TYPE_INTERLEAVED)
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 mgmt_interleaved_discovery(hdev);
> > =A0 =A0 =A0 else
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 hci_discovery_set_state(hdev, DISCOVERY_STO=
PPED);
> >
> > =A0 =A0 =A0 hci_dev_unlock(hdev);
>
> Furthermore, almost all calls from hci_core.c or hci_event.c into mgmt.c
> (that pass hdev as a parameter) have hdev locked so this would just be
> maintaining consistency.
Makes sense to me. Any reason not be this way, Marcel?
Regards,
--
Ulisses Furquim
ProFUSION embedded systems
http://profusion.mobi
Mobile: +55 19 9250 0942
Skype: ulissesffs
next prev parent reply other threads:[~2012-02-17 15:25 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-16 21:50 [RFC 0/4] MGMT Start Discovery interleaved support Andre Guedes
2012-02-16 21:50 ` [RFC 1/4] Bluetooth: Prepare start_discovery Andre Guedes
2012-02-16 22:15 ` Johan Hedberg
2012-02-16 23:30 ` Andre Guedes
2012-02-17 8:44 ` Marcel Holtmann
2012-02-17 8:43 ` Marcel Holtmann
2012-02-16 21:50 ` [RFC 2/4] Bluetooth: Track discovery type Andre Guedes
2012-02-17 8:50 ` Marcel Holtmann
2012-02-16 21:50 ` [RFC 3/4] Bluetooth: Merge INQUIRY and LE_SCAN discovery states Andre Guedes
2012-02-17 8:50 ` Marcel Holtmann
2012-02-16 21:50 ` [RFC 4/4] Bluetooth: Interleaved discovery support Andre Guedes
2012-02-16 22:12 ` Johan Hedberg
2012-02-16 23:30 ` Andre Guedes
2012-02-17 8:48 ` Marcel Holtmann
2012-02-17 14:52 ` Johan Hedberg
2012-02-17 15:00 ` Johan Hedberg
2012-02-17 15:23 ` Ulisses Furquim
2012-02-17 15:25 ` Ulisses Furquim [this message]
2012-02-17 16:03 ` Marcel Holtmann
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='CAA37ikbYxEbKhHbOmjEjRENoHraFLF7WvFhRBHvRRMw2U+=f_g@mail.gmail.com' \
--to=ulisses@profusion.mobi \
--cc=andre.guedes@openbossa.org \
--cc=linux-bluetooth@vger.kernel.org \
--cc=marcel@holtmann.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).