linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Gustavo Padovan <padovan@profusion.mobi>
To: Mat Martineau <mathewm@codeaurora.org>
Cc: Marcel Holtmann <marcel@holtmann.org>,
	Andre Guedes <andre.guedes@openbossa.org>,
	linux-bluetooth@vger.kernel.org
Subject: Re: [PATCH 5/7] Bluetooth: LE scan infra-structure
Date: Fri, 16 Dec 2011 17:13:49 -0200	[thread overview]
Message-ID: <20111216191349.GA7046@joana> (raw)
In-Reply-To: <alpine.DEB.2.02.1112151101550.24351@mathewm-linux>

Hi Mat,

* Mat Martineau <mathewm@codeaurora.org> [2011-12-15 11:25:49 -0800]:

> 
> Marcel & Andre -
> 
> On Wed, 14 Dec 2011, Marcel Holtmann wrote:
> 
> >Hi Andre,
> >
> >>This patch adds to hci_core an infra-structure to scan LE devices.
> >>
> >>The LE scan is implemented using a work_struct which is enqueued
> >>on hdev->workqueue. The LE scan work sends commands (Set LE Scan
> >>Parameters and Set LE Scan Enable) to the controller and waits for
> >>its results. If commands were executed successfully a timer is set
> >>to disable the ongoing scanning after some amount of time.
> >
> >so I rather hold off on these until we get the tasklet removal patches
> >merged. The mgmt processing will then also be done in process context
> >and we can just sleep. This should make code like this a lot simpler.
> 
> 
> While execution on a workqueue can sleep, it's not a good idea to
> block for a long time like this patch does.  A single-threaded
> workqueue (like the hdev workqueue) will not run the next scheduled
> work until the current work function returns.  If code executing in
> a workqueue suspends execution by using a wait queue, like
> le_scan_workqueue(), then all other pending work is blocked until
> le_scan_workqueue() returns.

Yes, we know this issue, I'll be looking to this issue quite soon.
Btw, having a single-threaded is not the real problem if we use
create_workqueue() instead but in system with only one CPU we will have the
same problem.

> 
> It might be better to think of workqueues as having similar
> restrictions to tasklets, except you can use GFP_KERNEL when
> allocating and can block while acquiring locks.
> 
> 
> In getting rid of tasklets, I think we also need to not use timers
> (which also execute in softirq context), and use the delayed_work
> calls instead.  That way we can assume all net/bluetooth code runs
> in process context, except for calls up from the driver layer.

I'm taking care of that as well, timers are a problem if we run the rest of
the code in process context.

If you wanna take a look to the work I've been doing I pushing it to this
tree:
http://git.kernel.org/?p=linux/kernel/git/padovan/bluetooth-testing.git

This is in an unstable state, I still see some locking issues like
deadlocks in the code, but I plan to move fast and merge this into
bluetooth-next soon.

Comments are welcome!

	Gustavo

  parent reply	other threads:[~2011-12-16 19:13 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-14 16:25 [PATCH 0/7] MGMT Start Discovery command LE-Only Support Andre Guedes
2011-12-14 16:25 ` [PATCH 1/7] Bluetooth: Add 'eir_len' param to mgmt_device_found() Andre Guedes
2011-12-14 16:25 ` [PATCH 2/7] Bluetooth: Report LE devices Andre Guedes
2011-12-14 16:25 ` [PATCH 3/7] Bluetooth: LE scan should send MGMT Discovering events Andre Guedes
2011-12-14 16:25 ` [PATCH 4/7] Bluetooth: Add helper functions to send LE scan commands Andre Guedes
2011-12-14 16:25 ` [PATCH 5/7] Bluetooth: LE scan infra-structure Andre Guedes
2011-12-14 19:36   ` Marcel Holtmann
2011-12-15 19:25     ` Mat Martineau
2011-12-15 20:00       ` Andre Guedes
2011-12-16 18:21         ` Mat Martineau
2011-12-15 20:05       ` David Herrmann
2011-12-16 19:20         ` Does it make sense to have the hdev workqueue serialized? Mat Martineau
2011-12-16 19:26           ` Changes to workqueues (was: Does it make sense to have the hdev workqueue serialized?) Mat Martineau
2011-12-16 20:05           ` Does it make sense to have the hdev workqueue serialized? Gustavo Padovan
2011-12-16 23:35             ` Mat Martineau
2011-12-17  1:04           ` Marcel Holtmann
2011-12-16 19:13       ` Gustavo Padovan [this message]
2011-12-14 16:25 ` [PATCH 6/7] Bluetooth: Add hci_do_le_scan() to hci_core Andre Guedes
2011-12-14 16:25 ` [PATCH 7/7] Bluetooth: MGMT start discovery LE-Only support Andre Guedes

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=20111216191349.GA7046@joana \
    --to=padovan@profusion.mobi \
    --cc=andre.guedes@openbossa.org \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=mathewm@codeaurora.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).