From: Cristian Marussi <cristian.marussi@arm.com>
To: Peng Fan <peng.fan@oss.nxp.com>
Cc: Cristian Marussi <cristian.marussi@arm.com>,
Sudeep Holla <sudeep.holla@arm.com>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Viresh Kumar <viresh.kumar@linaro.org>,
arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
Peng Fan <peng.fan@nxp.com>
Subject: Re: [PATCH 0/3] firmware: arm_scmi: perf/cpufreq: Enable notification only if supported by platform
Date: Thu, 12 Jun 2025 11:31:01 +0100 [thread overview]
Message-ID: <aEqsZWSlq9wKv10a@pluto> (raw)
In-Reply-To: <20250612034351.GA7552@nxa18884-linux>
On Thu, Jun 12, 2025 at 11:43:52AM +0800, Peng Fan wrote:
> On Wed, Jun 11, 2025 at 02:33:37PM +0100, Cristian Marussi wrote:
> >On Wed, Jun 11, 2025 at 01:17:11PM +0100, Sudeep Holla wrote:
> >> On Wed, Jun 11, 2025 at 03:52:42PM +0800, Peng Fan (OSS) wrote:
> >> > PERFORMANCE_NOTIFY_LIMITS and PERFORMANCE_NOTIFY_LEVEL are optional
> >> > commands. If use these commands on platforms that not support the two,
> >> > there is error log:
> >> > SCMI Notifications - Failed to ENABLE events for key:13000008 !
> >> > scmi-cpufreq scmi_dev.4: failed to register for limits change notifier for domain 8
> >> >
> >>
> >
> >Hi,
> >
> >I had a quick look/refresh to this stuff from years ago...
> >
> >...wont be so short to explain :P
> >
> >In general when you register a notifier_block for some SCMI events,
> >the assumption was that a driver using proto_X_ops could want to register
> >NOT only for proto_X events BUT also for other protos...in such a case you
> >are NOT guaranteed that such other proto_Y was initialized when your
> >driver probes and tries to register the notifier...indeed it could be
> >that such proto_Y could be a module that has still to be loaded !
> >
> >...in this scenario you can end-up quickly in a hell of probe-dependency
> >if you write a driver asking for SCMI events that can or cannot be still
> >readily available when the driver probes...
> >
> >....so the decision was to simply place such notifier registration requests
> >on hold on a pending list...whenever the needed missing protocol is
> >loaded/inialized the notifier registration is completed...if the proto_Y
> >never arrives nothing happens...and your driver caller can probe
> >successfully anyway...
> >
> >This means in such a corner-case the notifier registration is sort of
> >asynchonous and eventual errors detected later, when the protocol is
> >finally initialized and notifiers finalized, cannot be easily reported
> >(BUT I think we could improve on this ... thinking about this...)
> >
> >...BUT....
> >
> >....this is NOT our case NOR the most common case...the usual scenario,
> >like cpufreq, is that a driver using proto_X_ops tries to register for
> >that same proto_X events and in such a case we can detect that such
> >domain is unsupported and fail while avoiding to send any message indeed....
> >
> >....so....:P...while I was going through this rabbit-hole....this issues
> >started to feel familiar...O_o....
> >
> >... indeed I realized that the function that you (Peng) now invoke to
> >set the per-domain perf_limit_notify flag was introduced just for these
> >reasons to check and avoid such situation for all protocols in the core:
> >
> >
> >commit 8733e86a80f5a7abb7b4b6ca3f417b32c3eb68e3
> >Author: Cristian Marussi <cristian.marussi@arm.com>
> >Date: Mon Feb 12 12:32:23 2024 +0000
> >
> > firmware: arm_scmi: Check for notification support
> >
> > When registering protocol events, use the optional .is_notify_supported
> > callback provided by the protocol to check if that specific notification
> > type is available for that particular resource on the running system,
> > marking it as unsupported otherwise.
> >
> > Then, when a notification enable request is received, return an error if
> > it was previously marked as unsuppported, so avoiding to send a needless
> > notification enable command and check the returned value for failure.
> >
> > Signed-off-by: Cristian Marussi <cristian.marussi@arm.com>
> > Link: https://lore.kernel.org/r/20240212123233.1230090-2-cristian.marussi@arm.com
> > Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
> >
> >
> >...so my suspect is that we are ALREADY avoiding to send unneeded
> >messages when a domain does NOT support notifications for ALL
> >protocols...it is just that we are a bit too noisy...
> >
> >@Peng do you observe the message being sent instead ? (so maybe the
> >above has a bug...) or it is just the message ?
>
> Just the message.
>
> arm-scmi arm-scmi.0.auto: SCMI Notifications - Notification NOT supported - proto_id:19 evt_id:0 src_id:8
> SCMI Notifications - Failed to ENABLE events for key:13000008 !
> scmi-cpufreq scmi_dev.4: failed to register for limits change notifier for domain 8
>
> It just make user has a feeling that there must be something wrong, especially
> those not know the internals.
Yes indeed it is too much noisy...
>
> And from the error message, "Failed to ENABLE events for key..", we not
> know which protocol, and whether notification supported.
>
> I was thinking to propogate the error value, but __scmi_enable_evt
> always use -EINVAL if not success.
>
I suppose, if you want also to save cycles that you could mark internally a
protocol, at init time, as NOT suporting notifs (if you can detect that no domain
is supported OR the related notfs commands are NOT available) and then
bailing out early with -ENOTOPSUPP when trying to register a new
notifier (amd muting all the errs to dbgs....) so that the caller can
warn if wanted or not...
> >
> >> I wonder if it makes sense to quiesce the warnings from the core if the
> >> platform doesn't support notifications.
>
> If not quiesce, we might need to make it clear from the error message,
> saying whether X events are supported for Y protocols or not, not just
> a "Failed to ENABLE events for key.."
>
Yes that was a very early and primitve errors message of mine...my bad :D
Thanks,
Cristian
next prev parent reply other threads:[~2025-06-12 13:19 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-11 7:52 [PATCH 0/3] firmware: arm_scmi: perf/cpufreq: Enable notification only if supported by platform Peng Fan (OSS)
2025-06-11 7:52 ` [PATCH 1/3] firmware: arm_scmi: Fix typo for scmi_perf_proto_ops Peng Fan (OSS)
2025-06-11 7:52 ` [PATCH 2/3] firmware: arm_scmi: perf: Add notify_supported " Peng Fan (OSS)
2025-06-11 7:52 ` [PATCH 3/3] cpufreq: scmi-cpufreq: Enable perf limits notification only supported Peng Fan (OSS)
2025-06-11 12:17 ` [PATCH 0/3] firmware: arm_scmi: perf/cpufreq: Enable notification only if supported by platform Sudeep Holla
2025-06-11 13:33 ` Cristian Marussi
2025-06-12 3:43 ` Peng Fan
2025-06-12 10:31 ` Cristian Marussi [this message]
2025-06-13 9:50 ` Peng Fan
2025-06-17 13:41 ` Cristian Marussi
2025-06-17 13:50 ` [PATCH] [NOT_FOR_MERGE] firmware: arm_scmi: Optimize notifiers registration Cristian Marussi
2025-06-17 13:59 ` Cristian Marussi
2025-06-20 7:38 ` Peng Fan
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=aEqsZWSlq9wKv10a@pluto \
--to=cristian.marussi@arm.com \
--cc=arm-scmi@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=peng.fan@nxp.com \
--cc=peng.fan@oss.nxp.com \
--cc=rafael@kernel.org \
--cc=sudeep.holla@arm.com \
--cc=viresh.kumar@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