From: Szymon Janc <szymon.janc@tieto.com>
To: Johan Hedberg <johan.hedberg@gmail.com>
Cc: Andre Guedes <andre.guedes@openbossa.org>,
"linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH 02/12] Bluetooth: Add basic start/complete HCI transaction functions
Date: Fri, 15 Feb 2013 10:18:14 +0100 [thread overview]
Message-ID: <11735985.64bebk47LR@uw000953> (raw)
In-Reply-To: <20130215090604.GB10022@x220>
Hi Johan,
On Friday 15 of February 2013 11:06:04 Johan Hedberg wrote:
> Hi Szymon,
>
> On Fri, Feb 15, 2013, Szymon Janc wrote:
> > On Friday 15 of February 2013 10:22:36 Johan Hedberg wrote:
> > > > > +int hci_start_transaction(struct hci_dev *hdev)
> > > > > +{
> > > > > + struct hci_transaction *transaction;
> > > > > + int err;
> > > > > +
> > > > > + hci_transaction_lock(hdev);
> > > > > +
> > > > > + /* We can't start a new transaction if there's another one in
> > > > > + * progress of being built.
> > > > > + */
> > > > > + if (hdev->build_transaction) {
> > > > > + err = -EBUSY;
> > > > > + goto unlock;
> > > > > + }
> > > > > +
> > > > > + transaction = kmalloc(sizeof(*transaction), GFP_ATOMIC);
> > > >
> > > > I've failed to see why we need GFP_ATOMIC here. As this code is not
> > > > running in any atomic section, we can allocate memory using
> > > > GFP_KERNEL.
> > >
> > > Since one of the intentions of this API is to create an async version of
> > > hci_request() I think it's better to keep GFP_ATOMIC here. One situation
> > > where you couldn't for sure use hci_request() is if you're in an atomic
> > > section and then a HCI request would be the only other alternative.
> >
> > You lock mutex in hci_start_transaction so it is non-atomic anyway..
>
> This has me a bit confused since hci_dev_lock() also uses the same. Does
> this mean that there's no code at all in the Bluetooth subsystem anymore
> that can run in atomic context? (since most things require locking at
> least the hdev struct). I remember seeing some time back (after the
> whole workqueue conversion) bugs arising from incorrect GFP_ATOMIC ->
> GFP_KERNEL conversions (none of which luckily made it to Linus' tree), so at
> least some parts seemed to still be atomic. Do a grep for GFP_ATOMIC in
> net/bluetooth/ and you'll find plenty of them.
The bug (by me btw:P) you are probably referring to was due to rwlock which
is spin lock and raise sleeping in atomic warning even if run e.g. from wq.
--
BR
Szymon Janc
next prev parent reply other threads:[~2013-02-15 9:18 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 14:50 [PATCH 00/12] Bluetooth: Asynchronous HCI transaction API Johan Hedberg
2013-02-13 14:50 ` [PATCH 01/12] Bluetooth: Add initial hooks for HCI transaction support Johan Hedberg
2013-02-13 14:50 ` [PATCH 02/12] Bluetooth: Add basic start/complete HCI transaction functions Johan Hedberg
2013-02-14 17:48 ` Andre Guedes
2013-02-15 8:22 ` Johan Hedberg
2013-02-15 8:36 ` Szymon Janc
2013-02-15 9:06 ` Johan Hedberg
2013-02-15 9:18 ` Szymon Janc [this message]
2013-02-15 9:52 ` Johan Hedberg
2013-02-13 14:50 ` [PATCH 03/12] Bluetooth: Add hci_transaction_cmd_complete function Johan Hedberg
2013-02-14 17:48 ` Andre Guedes
2013-02-13 14:50 ` [PATCH 04/12] Bluetooth: Add hci_transaction_from_skb function Johan Hedberg
2013-02-13 14:50 ` [PATCH 05/12] Bluetooth: Switch from hdev->cmd_q to using transactions Johan Hedberg
2013-02-13 14:50 ` [PATCH 06/12] Bluetooth: Remove unused hdev->cmd_q HCI command queue Johan Hedberg
2013-02-13 14:50 ` [PATCH 07/12] Bluetooth: Fix mgmt powered indication by using a HCI transaction Johan Hedberg
2013-02-13 14:50 ` [PATCH 08/12] Bluetooth: Enable HCI transaction support cmd_status 0 Johan Hedberg
2013-02-14 17:48 ` Andre Guedes
2013-02-13 14:50 ` [PATCH 09/12] Bluetooth: Add HCI init sequence support for HCI transactions Johan Hedberg
2013-02-13 17:10 ` Anderson Lizardo
2013-02-15 8:17 ` Johan Hedberg
2013-02-13 14:50 ` [PATCH 10/12] Bluetooth: Convert hci_request to use " Johan Hedberg
2013-02-13 14:50 ` [PATCH 11/12] Bluetooth: Remove unused hdev->init_last_cmd Johan Hedberg
2013-02-13 14:50 ` [PATCH 12/12] Bluetooth: Remove empty HCI event handlers Johan Hedberg
[not found] ` <CAMXE1-pn2V-6mgvqpwDygaqgsUr90yV7BS_txyzGQytA4gTABw@mail.gmail.com>
2013-02-18 7:51 ` Johan Hedberg
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=11735985.64bebk47LR@uw000953 \
--to=szymon.janc@tieto.com \
--cc=andre.guedes@openbossa.org \
--cc=johan.hedberg@gmail.com \
--cc=linux-bluetooth@vger.kernel.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.