All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Anderson Lizardo <anderson.lizardo@openbossa.org>
Cc: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com>,
	BlueZ development <linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH 11/11] android/tester: Make bt_callbacks thread-safe
Date: Sun, 2 Feb 2014 08:55:49 -0800	[thread overview]
Message-ID: <EF441CC3-EFCF-4A2A-8ADF-D9F6FF262E4D@holtmann.org> (raw)
In-Reply-To: <CAJdJm_OCbUjZVEoNL1y7911zk3QgsQKmQjAJfQh15fhLeTGutA@mail.gmail.com>

Hi Anderson,

>> This patch adds wrappers for BT HAL callback which execute them in main
>> thread instead of notification_handler() thread. Otherwise test
>> execution is prone to race conditions since we do not provide any
>> locking mechanism for tester.
> 
> In my opinion, this is becoming too messy. I'm getting races even
> inside the emulator code: sometimes bthost->ncmd becomes zero before a
> HCI command is sent by the emulated host because the Command Status /
> Command Complete comes after the command is written to the socket, but
> before bthost->ncmd is decremented.
> 
> Also try running android-tester under valgrind. At least for me, I get
> a few failures that I don't have when running without valgrind (at
> least one in HIDHost apparently due to if_bluetooth->enable() not
> being called on test setup and thus the tests rely on finishing before
> the controller is powered off by the kernel after initialization).
> 
> IMHO, the best approach would be to keep all HAL API usage in a
> separate process, and keep android-tester single-threaded. Of course,
> this could extra complexity for the required IPC between
> android-tester and this new process...
> 
> Again, I'm not familiar with how HAL API works, all this is just based
> on my failed attempt to make android-tester run reliably under
> valgrind.

I have to agree. We might better spawn processes for this. Our emulator code was never designed to be thread safe and never will be. We are just hiding the real problem here and it will break somewhere else later on.

Regards

Marcel


  reply	other threads:[~2014-02-02 16:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-02 11:16 [PATCH 00/11] Add bonding test cases Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 01/11] android/tester: Coding style and syntax fix Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 02/11] android/tester: Add create bond with PIN success test case Andrzej Kaczmarek
2014-02-02 12:45   ` Anderson Lizardo
2014-02-02 11:16 ` [PATCH 03/11] android/tester: Add create bond with PIN fail " Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 04/11] android/tester: Add create bond with SSP sucess " Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 05/11] android/tester: Add create bond with SSP fail " Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 06/11] android/tester: Add create bond with no discovery " Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 07/11] android/tester: Add create bond with bad addr fail " Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 08/11] android/tester: Add cancel bond success " Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 09/11] android/tester: Add remove " Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 10/11] android/tester: Add remove bond bad addr dev " Andrzej Kaczmarek
2014-02-02 11:16 ` [PATCH 11/11] android/tester: Make bt_callbacks thread-safe Andrzej Kaczmarek
2014-02-02 13:27   ` Anderson Lizardo
2014-02-02 16:55     ` Marcel Holtmann [this message]
2014-02-02 20:12       ` Anderson Lizardo
2014-02-16 21:04       ` Szymon Janc

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=EF441CC3-EFCF-4A2A-8ADF-D9F6FF262E4D@holtmann.org \
    --to=marcel@holtmann.org \
    --cc=anderson.lizardo@openbossa.org \
    --cc=andrzej.kaczmarek@tieto.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.