linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>
Cc: <vkoul@kernel.org>, <peter.ujfalusi@linux.intel.com>,
	<yung-chuan.liao@linux.intel.com>, <sanyog.r.kale@intel.com>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<patches@opensource.cirrus.com>
Subject: Re: [PATCH] soundwire: intel_auxdevice: Don't disable IRQs before removing children
Date: Tue, 17 Dec 2024 10:24:33 +0000	[thread overview]
Message-ID: <Z2FRYfHoHX4Dv+C2@opensource.cirrus.com> (raw)
In-Reply-To: <3eb98099-75da-4464-97d1-9e8538375e34@linux.dev>

On Mon, Dec 16, 2024 at 11:35:23AM -0600, Pierre-Louis Bossart wrote:
> On 12/12/24 5:02 AM, Charles Keepax wrote:
> > Currently the auxiliary device for the link disables IRQs before it
> > calls sdw_bus_master_delete(). This has the side effect that
> > none of the devices on the link can access their own registers whilst
> > their remove functions run, because the IRQs are required for bus
> > transactions to function. Obviously, devices should be able to access
> > their own registers during disable to park the device suitably.
> 
> What does 'park the device suitably' mean really? That sounds
> scary. What happens if the manager abruptly ceases to operate and
> yanks the power? Does the device catch on fire? On a related note,
> the manager should *never* expect to find the device in a 'suitable'
> state but always proceed with complete re-initialization.
> 
> It would be good to expand on the issue, introducing new locks
> is one of those "no good deed goes unpunished" situations.
> 

I would agree that one should never make hardware that needs parked
to avoid damage, but people do stupid things. Also, it doesn't
have to be as catastrophic as that, it is usually a case of wanting
to move the device into its lowest power state, turn off regulators
on the device etc.

> > It would appear the reason for the disabling of the IRQs is that the IRQ
> > handler iterates through a linked list of all the links, once a link is
> > removed the memory pointed at by this linked list is freed, but not
> > removed from the linked_list itself. Add a list_del() for the linked
> > list item, note whilst the list itself is contained in the intel_init
> > portion of the code, the list remove needs to be attached to the
> > auxiliary device for the link, since that owns the memory that the list
> > points at. Locking is also required to ensure the IRQ handler runs
> > before or after any additions/removals from the list.
> 
> that sounds very detailed but the initial reason for all this is still
> unclear.

If you want, I can add the exact reason I am adding this change to
the commit message, which is that regmap IRQ sensibly masks IRQs
as they are removed, so when the cs42l43 removes one sees a bunch
of failed transations, as the bus has broken. But to be honest I
feel like it is overly specific, one could construct any number of
similar situations, the real problem here is it is completely normal
and reasonable to want to communicate with a device in remove and
we should support that.

Thanks,
Charles

  reply	other threads:[~2024-12-17 10:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-12 11:02 [PATCH] soundwire: intel_auxdevice: Don't disable IRQs before removing children Charles Keepax
2024-12-16 17:35 ` Pierre-Louis Bossart
2024-12-17 10:24   ` Charles Keepax [this message]
2024-12-17 10:49   ` Richard Fitzgerald
2024-12-17 23:49     ` Pierre-Louis Bossart
2024-12-18  9:51       ` Charles Keepax
2024-12-18 20:45         ` Pierre-Louis Bossart
2024-12-18 21:40           ` Pierre-Louis Bossart
2024-12-19 10:27             ` Charles Keepax
2024-12-20 17:59               ` Charles Keepax
2025-01-02 22:14               ` Pierre-Louis Bossart

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=Z2FRYfHoHX4Dv+C2@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    --cc=peter.ujfalusi@linux.intel.com \
    --cc=pierre-louis.bossart@linux.dev \
    --cc=sanyog.r.kale@intel.com \
    --cc=vkoul@kernel.org \
    --cc=yung-chuan.liao@linux.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;
as well as URLs for NNTP newsgroup(s).