Linux wireless drivers development
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Christian Lamparter <chunkeey@googlemail.com>
Cc: linux-wireless@vger.kernel.org, tglx@linutronix.de
Subject: Locking in carl9170
Date: Mon, 11 Jun 2018 22:21:56 +0200	[thread overview]
Message-ID: <20180611202156.ts3ldjvmjqpsi56o@linutronix.de> (raw)

I've been locking at the USB completion handler and stumbled upon this
driver. The code path:
 carl9170_usb_rx_irq_complete()
 -> carl9170_handle_command_response()
  -> carl9170_cmd_callback()
     spin_lock(&ar->cmd_lock);

  -> carl9170_update_beacon()
      spin_lock_bh(&ar->beacon_lock);

  -> carl9170_tx_process_status()
   -> __carl9170_tx_process_status()
    -> carl9170_get_queued_skb()
       spin_lock_bh(&queue->lock);

      -> carl9170_release_dev_space()
         spin_lock_bh(&ar->mem_lock);
…

I planned to make all locks use spin_lock_irqsave().
carl9170_usb_rx_irq_complete() is called by HCD's completion handler
which is invoked mostly in IRQ context except for EHCI/DWC2 which invoke
the completion callback in tasklet/BH context. Currently there is a
local_irq_save() before invoking the ->complete callback which I plan to
remove, therefore the push-down. The _irqsave() would reflect the
current status. 
The locks I mentioned use only the _bh() suffix in other places. I
*think* lockdep is not complaining about this on EHCI but should
complain on other controllers which really complete in IRQ-context.
Could you please check if this is the case?

Sebastian

             reply	other threads:[~2018-06-11 20:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-11 20:21 Sebastian Andrzej Siewior [this message]
2018-06-12 16:56 ` Locking in carl9170 Christian Lamparter
2018-06-13 16:08   ` Sebastian Andrzej Siewior

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=20180611202156.ts3ldjvmjqpsi56o@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=chunkeey@googlemail.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /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