mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Sakari Ailus" <sakari.ailus@linux.intel.com>,
	"Wentong Wu" <wentong.wu@intel.com>
Cc: "Hans de Goede" <hdegoede@redhat.com>,
	"Tomas Winkler" <tomas.winkler@intel.com>,
	"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2 1/3] mei: vsc: Call wake_up() in the threaded IRQ handler
Date: Mon, 04 Mar 2024 11:58:19 +0100	[thread overview]
Message-ID: <44216ff8-740b-45ca-9902-b52a04901655@app.fastmail.com> (raw)
In-Reply-To: <Zdc0M9Uf2zn63P0e@kekkonen.localdomain>

On Thu, Feb 22, 2024, at 12:46, Sakari Ailus wrote:
> Hi Wentong,
>
> On Thu, Feb 22, 2024 at 03:26:18AM +0000, Wu, Wentong wrote:
>> > From: Sakari Ailus <sakari.ailus@linux.intel.com>
>> > 
>> > The hard IRQ handler vsc_tp_irq() is called with a raw spinlock taken.
>> > wake_up() acquires a spinlock, a sleeping lock on PREEMPT_RT.
>> 
>> Does this mean we can't use wake_up() in isr? 
>
> Good question. A lot of callers currently do.

If driver has a traditional (non-threaded) handler, it should
always work fine: on non-PREEMPT_RT it can take the spinlock
and on PREEMPT_RT it automatically turns into a threaded
handler that can still call it.

> In this case, handle_edge_irq() takes the raw spinlock and acquiring the
> wake queue spinlock in wake_up() leads to sleeping IRQs disabled (see
> below).
>
> I don't think there's any harm in moving the wake_up() to the threaded
> handler.

It causes an extra bit of latency for the non-PREEMPT_RT case
because you now always have to go through two task switches.
This is probably fine if you don't care about latency. 

You can probably replace the open-coded completion (wait queue
head plus atomic) with a normal 'struct completion' and
call complete() in the isr instead. This one seems to only
take a raw spinlock already.

    Arnd

  reply	other threads:[~2024-03-04 10:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-19 19:58 [PATCH v2 0/3] MEI VSC fixes and cleanups Sakari Ailus
2024-02-19 19:58 ` [PATCH v2 1/3] mei: vsc: Call wake_up() in the threaded IRQ handler Sakari Ailus
2024-02-22  3:26   ` Wu, Wentong
2024-02-22 11:46     ` Sakari Ailus
2024-03-04 10:58       ` Arnd Bergmann [this message]
2024-02-28  8:19   ` Wu, Wentong
2024-03-04 10:42     ` Sakari Ailus
2024-02-19 19:58 ` [PATCH v2 2/3] mei: vsc: Don't use sleeping condition in wait_event_timeout() Sakari Ailus
2024-02-22  4:30   ` Wu, Wentong
2024-03-05 17:11   ` Andy Shevchenko
2024-03-05 17:17     ` Arnd Bergmann
2024-02-19 19:58 ` [PATCH v2 3/3] mei: vsc: Assign pinfo fields in variable declaration Sakari Ailus
2024-02-22  4:32   ` Wu, Wentong
2024-03-05 17:13   ` Andy Shevchenko

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=44216ff8-740b-45ca-9902-b52a04901655@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=tomas.winkler@intel.com \
    --cc=wentong.wu@intel.com \
    /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

all inboxes | Powered by JetHome®