From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Vinod Koul <vkoul@kernel.org>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Sanyog Kale <sanyog.r.kale@intel.com>,
Andy Gross <agross@kernel.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org
Cc: Patrick Lai <quic_plai@quicinc.com>
Subject: Re: [PATCH 5/6] soudnwire: master: protect concurrecnt check for bus->md
Date: Thu, 20 Apr 2023 11:42:18 -0500 [thread overview]
Message-ID: <7ee41bcb-8656-49ec-40b6-15072c080d08@linux.intel.com> (raw)
In-Reply-To: <20230420101617.142225-6-krzysztof.kozlowski@linaro.org>
typos in commit title...
On 4/20/23 05:16, Krzysztof Kozlowski wrote:
> The Soundwire master controllers might want to check for bus->md
Apologies for being pedantic but 'manager' and 'controller' are
different concepts in SoundWire, see DisCo spec.
It's not a 1:1 mapping, a controller can rely on M managers
> initialization to avoid race between early interrupt and finish of
> sdw_bus_master_add()/sdw_master_device_add(). Such early interrupt can
> happen if Soundwire devices are not powered off during their probe.
>
> Add a store release barrier, so the Soundwire controllers can safely
> check it in concurrent (e.g. in interrupt) way.
Can you elaborate on the race condition? I am not following what breaks,
and what entity generates the 'early interrupt'.
I am specifically concerned about adding this in common code without any
matching smp_load_acquire() - which is only added in the following patch
for the Qualcomm manager only, but not added for Intel/AMD managers. Is
this not a problem?
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
>
> ---
>
> Cc: Patrick Lai <quic_plai@quicinc.com>
> ---
> drivers/soundwire/master.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/soundwire/master.c b/drivers/soundwire/master.c
> index 9b05c9e25ebe..d5bf13e7e602 100644
> --- a/drivers/soundwire/master.c
> +++ b/drivers/soundwire/master.c
> @@ -161,7 +161,12 @@ int sdw_master_device_add(struct sdw_bus *bus, struct device *parent,
> /* add shortcuts to improve code readability/compactness */
> md->bus = bus;
> bus->dev = &md->dev;
> - bus->md = md;
> + /*
> + * Make sure the contents of md is stored before storing bus->md.
> + * Paired with new slave attached and slave status interrupts
> + * on the Soundwire master side.
> + */
> + smp_store_release(&bus->md, md);
>
> pm_runtime_set_autosuspend_delay(&bus->md->dev, SDW_MASTER_SUSPEND_DELAY_MS);
> pm_runtime_use_autosuspend(&bus->md->dev);
next prev parent reply other threads:[~2023-04-20 17:15 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-20 10:16 [PATCH 0/6] ASoC/soundwire: qcom: correctly probe devices after link init Krzysztof Kozlowski
2023-04-20 10:16 ` [PATCH 1/6] ASoC: wcd938x: switch to using gpiod API Krzysztof Kozlowski
2023-04-20 11:58 ` Mark Brown
2023-04-20 11:58 ` Mark Brown
2023-04-20 12:30 ` Krzysztof Kozlowski
2023-04-20 12:30 ` Krzysztof Kozlowski
2023-04-20 12:32 ` Krzysztof Kozlowski
2023-04-20 12:32 ` Krzysztof Kozlowski
2023-04-20 13:00 ` Mark Brown
2023-04-20 13:00 ` Mark Brown
2023-04-20 14:16 ` Krzysztof Kozlowski
2023-04-20 14:16 ` Krzysztof Kozlowski
2023-04-20 16:28 ` Mark Brown
2023-04-20 16:28 ` Mark Brown
2023-04-20 17:51 ` Krzysztof Kozlowski
2023-04-20 17:51 ` Krzysztof Kozlowski
2023-04-20 18:19 ` Mark Brown
2023-04-20 18:19 ` Mark Brown
2023-04-20 10:16 ` [PATCH 2/6] ASoC: codecs: wcd938x: Keep device in reset till bind Krzysztof Kozlowski
2023-04-20 10:16 ` [PATCH 3/6] ASoC: codecs: wcd938x: Check for enumeration before using TX device Krzysztof Kozlowski
2023-04-20 14:18 ` Pierre-Louis Bossart
2023-04-20 17:19 ` Mark Brown
2023-04-20 17:19 ` Mark Brown
2023-04-20 17:57 ` Krzysztof Kozlowski
2023-04-20 18:22 ` Mark Brown
2023-04-20 18:22 ` Mark Brown
2023-04-20 10:16 ` [PATCH 4/6] soundwire: qcom: drop unused struct qcom_swrm_ctrl members Krzysztof Kozlowski
2023-04-20 10:16 ` [PATCH 5/6] soudnwire: master: protect concurrecnt check for bus->md Krzysztof Kozlowski
2023-04-20 16:42 ` Pierre-Louis Bossart [this message]
2023-04-20 17:27 ` Krzysztof Kozlowski
2023-04-20 21:13 ` Pierre-Louis Bossart
2023-04-20 10:16 ` [PATCH 6/6] soundwire: qcom: do not probe devices before bus/link init Krzysztof Kozlowski
2023-04-20 21:37 ` Pierre-Louis Bossart
2023-05-01 12:24 ` Krzysztof Kozlowski
2023-05-01 13:43 ` Pierre-Louis Bossart
2023-05-03 8:00 ` Krzysztof Kozlowski
2023-05-03 14:11 ` 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=7ee41bcb-8656-49ec-40b6-15072c080d08@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=agross@kernel.org \
--cc=alsa-devel@alsa-project.org \
--cc=andersson@kernel.org \
--cc=broonie@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=lgirdwood@gmail.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=perex@perex.cz \
--cc=quic_plai@quicinc.com \
--cc=sanyog.r.kale@intel.com \
--cc=tiwai@suse.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 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.