From: Tadeusz Struk <tadeusz.struk@linaro.org>
To: Bryan O'Donoghue <bryan.odonoghue@linaro.org>,
Stanimir Varbanov <stanimir.varbanov@linaro.org>,
Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Lee Jones <lee.jones@linaro.org>,
Amit Pundir <amit.pundir@linaro.org>,
John Stultz <john.stultz@linaro.org>,
linux-media@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] media: venus: Synchronize probe() between venus_core and enc/dec
Date: Mon, 25 Oct 2021 09:57:43 -0700 [thread overview]
Message-ID: <25da5210-8e1f-7183-a8e7-8584f8dd2cef@linaro.org> (raw)
In-Reply-To: <00b817a4-f1ac-6a94-5f1e-836d8d313406@linaro.org>
[-- Attachment #1.1: Type: text/plain, Size: 1754 bytes --]
On 10/25/21 09:03, Bryan O'Donoghue wrote:
> I don't think there's any guarantee at all, that core probe() has completed at
> that point.
I think there is, thanks to the new sync_mutex. The enc/dec probe will keep
returning -EPROBE_DEFER; until the core driver calls
platform_set_drvdata(pdev, core); in line 338, but before it does that it
takes the syn_lock. Then both enc/dec drivers will block on the same sync_lock
until either the core has finished initialization fully and unlocks it in line
378 just before returning 0, or it fails in between and unlocks it on the err
path. Only then the other two can proceed and check if the core probe failed,
in which case the condition core->state != CORE_INIT will be true.
>
> of_platform_populate() doesn't guarantee ordering of the probe() completing
> before or after the probe() of the platform drivers that are associated with the
> devices in of_platform_populate().
agree, but I don't depend on of_platform_populate(). The ordering between the
three probe functions is enforced by the new sync mutex.
>
> When you think it about it can't do that and you wouldn't want it to do that
> since a device might have a legitimate reason to EPROBE_DEFER
>
> As an example core could call of_platform_populate() and then as a ridiculous
> example go to sleep for five seconds - in which case it is perfectly possible
and this is exactly what happens when the core probe() loads the firmware from
disk.
> the encoder and decoder probe() functions will bug out illegitimately waiting
> because of core->state != CORE_INIT
not really, because it will block on the mutex and only check the condition
after the sync_lock is unlocked.
--
Thanks,
Tadeusz
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]
next prev parent reply other threads:[~2021-10-25 16:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-25 14:43 Tadeusz Struk
2021-10-25 15:24 ` Bryan O'Donoghue
2021-10-25 15:30 ` Tadeusz Struk
2021-10-25 16:03 ` Bryan O'Donoghue
2021-10-25 16:17 ` Bryan O'Donoghue
2021-10-25 16:57 ` Tadeusz Struk [this message]
2021-10-25 17:17 ` Bryan O'Donoghue
2021-10-25 17:26 ` Tadeusz Struk
2021-10-28 0:01 ` John Stultz
2021-10-28 0:19 ` Tadeusz Struk
2021-10-28 2:36 ` John Stultz
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=25da5210-8e1f-7183-a8e7-8584f8dd2cef@linaro.org \
--to=tadeusz.struk@linaro.org \
--cc=agross@kernel.org \
--cc=amit.pundir@linaro.org \
--cc=bjorn.andersson@linaro.org \
--cc=bryan.odonoghue@linaro.org \
--cc=john.stultz@linaro.org \
--cc=lee.jones@linaro.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=stanimir.varbanov@linaro.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 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®