From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Daniel Latypov <dlatypov@google.com>
Cc: bleung@chromium.org, brendan.higgins@linux.dev,
davidgow@google.com, rmoar@google.com, rostedt@goodmis.org,
mhiramat@kernel.org, naveen@kernel.org,
anil.s.keshavamurthy@intel.com, davem@davemloft.net,
chrome-platform@lists.linux.dev, linux-kselftest@vger.kernel.org,
kunit-dev@googlegroups.com, linux-trace-kernel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH 0/7] platform/chrome: Add Kunit tests for protocol device drivers
Date: Mon, 30 Jun 2025 06:32:46 +0000 [thread overview]
Message-ID: <aGIvjrrSRPJQpNy7@google.com> (raw)
In-Reply-To: <CAGS_qxrcH0+mJTO4nJqXnk2Bh7oO_PEur=ytcxL8wxJNCu20Tw@mail.gmail.com>
On Tue, May 20, 2025 at 09:04:53AM -0700, Daniel Latypov wrote:
> On Tue, May 20, 2025 at 1:25 AM 'Tzung-Bi Shih' via KUnit Development
> <kunit-dev@googlegroups.com> wrote:
> > [...]
> > Questions:
> > - Are we going to support ftrace stub so that tests can use it?
> >
> > - If ftrace stub isn't on the plate (e.g. due to too many dependencies), how
> > about the kprobes stub? Is it something we could pursue?
>
> Quick comment,
> If I recall, the thought process was that we could consider it in the
> future if there was enough demand for it.
Sorry for the late reply. I was doing some more experiments and stuck by
some else.
> We have these drawbacks with the current ftrace stubs:
> * doesn't compile on all arches
> * silently doesn't work on inlined functions <== scariest one to me
I see. I did some experiments and realized that kprobe stubs also share
the same concern. Thus I'm wondering if there is a way that kprobe stub
detects the redirection may fail, at least it can skip the test case
(e.g. register_kprobe() returns -ENOENT when it can't find the symbol
via kprobe_lookup_name()). But it seems no way if the target function
is partially inlined.
> You mention you don't like how static stubs requires modifying the
> code-under-test.
> Since it gets eliminated by the preprocessor unless you're compiling
> for KUnit, is the concern more so about how it conceptually feels
> wrong to do so?
> For the Android GKI kernel, they have (or had) KUnit enabled so there
> is potentially concern about real runtime cost there, not sure if you
> have something similar in mind.
Not exactly. Ideally, I think we shouldn't modify the CUT. I'm wondering
if there is a way to not change the CUT but also break the external
dependencies.
> But stepping back, ftrace_stubs technically require modifying the code
> to make sure funcs are marked as `noinline`, which this patch series
> does not do.
> I've not looked at cros_ec_{un,}register() to check if they're at risk
> of inlining, but wanted to call that out, that ftrace stubs
> technically don't handle your usage pattern 100% properly.
True. They could be partially inlined even though they are exported symbols.
next prev parent reply other threads:[~2025-06-30 6:32 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-20 8:24 [RFC PATCH 0/7] platform/chrome: Add Kunit tests for protocol device drivers Tzung-Bi Shih
2025-05-20 8:24 ` [RFC PATCH 1/7] kunit: expose ftrace-based API for stubbing out functions during tests Tzung-Bi Shih
2025-05-20 8:24 ` [RFC PATCH 2/7] platform/chrome: kunit: cros_ec_i2c: Add tests with ftrace stub Tzung-Bi Shih
2025-05-20 8:24 ` [RFC PATCH 3/7] platform/chrome: kunit: cros_ec_i2c: Use static stub instead Tzung-Bi Shih
2025-05-20 8:24 ` [RFC PATCH 4/7] platform/chrome: kunit: cros_ec_spi: Add tests with ftrace stub Tzung-Bi Shih
2025-05-20 8:24 ` [RFC PATCH 5/7] platform/chrome: kunit: cros_ec_spi: Call .probe() directly Tzung-Bi Shih
2025-05-20 8:24 ` [RFC PATCH 6/7] kunit: Expose 'kprobes stub' API to redirect functions Tzung-Bi Shih
2025-05-20 8:24 ` [RFC PATCH 7/7] platform/chrome: kunit: cros_ec_spi: Use kprobes stub instead Tzung-Bi Shih
2025-05-20 16:04 ` [RFC PATCH 0/7] platform/chrome: Add Kunit tests for protocol device drivers Daniel Latypov
2025-06-30 6:32 ` Tzung-Bi Shih [this message]
2025-07-01 5:22 ` Daniel Latypov
2025-07-01 12:20 ` Tzung-Bi Shih
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=aGIvjrrSRPJQpNy7@google.com \
--to=tzungbi@kernel.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=bleung@chromium.org \
--cc=brendan.higgins@linux.dev \
--cc=chrome-platform@lists.linux.dev \
--cc=davem@davemloft.net \
--cc=davidgow@google.com \
--cc=dlatypov@google.com \
--cc=kunit-dev@googlegroups.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=mhiramat@kernel.org \
--cc=naveen@kernel.org \
--cc=rmoar@google.com \
--cc=rostedt@goodmis.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