mbox series

[v4,kunit-next,0/2] kunit: extend kunit resources API

Message ID 1590788781-1895-1-git-send-email-alan.maguire@oracle.com (mailing list archive)
Headers show
Series kunit: extend kunit resources API | expand

Message

Alan Maguire May 29, 2020, 9:46 p.m. UTC
A recent RFC patch set [1] suggests some additional functionality
may be needed around kunit resources.  It seems to require

1. support for resources without allocation
2. support for lookup of such resources
3. support for access to resources across multiple kernel threads

The proposed changes here are designed to address these needs.
The idea is we first generalize the API to support adding
resources with static data; then from there we support named
resources.  The latter support is needed because if we are
in a different thread context and only have the "struct kunit *"
to work with, we need a way to identify a resource in lookup.

[1] https://lkml.org/lkml/2020/2/26/1286

Changes since v3:
- removed unused "init" field from "struct kunit_resources" (Brendan)

Changes since v2:
 - moved a few functions relating to resource retrieval in patches
   1 and 2 into include/kunit/test.h and defined as "static inline";
   this allows built-in consumers to use these functions when KUnit
   is built as a module

Changes since v1:
 - reformatted longer parameter lists to have one parameter per-line
   (Brendan, patch 1)
 - fixed phrasing in various comments to clarify allocation of memory
   and added comment to kunit resource tests to clarify why
   kunit_put_resource() is used there (Brendan, patch 1)
 - changed #define to static inline function (Brendan, patch 2)
 - simplified kunit_add_named_resource() to use more of existing
   code for non-named resource (Brendan, patch 2)

Alan Maguire (2):
  kunit: generalize kunit_resource API beyond allocated resources
  kunit: add support for named resources

Alan Maguire (2):
  kunit: generalize kunit_resource API beyond allocated resources
  kunit: add support for named resources

 include/kunit/test.h      | 210 +++++++++++++++++++++++++++++++++++++++-------
 lib/kunit/kunit-test.c    | 111 +++++++++++++++++++-----
 lib/kunit/string-stream.c |  14 ++--
 lib/kunit/test.c          | 171 ++++++++++++++++++++++---------------
 4 files changed, 380 insertions(+), 126 deletions(-)

Comments

Brendan Higgins June 5, 2020, 9:20 p.m. UTC | #1
On Fri, May 29, 2020 at 2:46 PM Alan Maguire <alan.maguire@oracle.com> wrote:
>
> A recent RFC patch set [1] suggests some additional functionality
> may be needed around kunit resources.  It seems to require
>
> 1. support for resources without allocation
> 2. support for lookup of such resources
> 3. support for access to resources across multiple kernel threads
>
> The proposed changes here are designed to address these needs.
> The idea is we first generalize the API to support adding
> resources with static data; then from there we support named
> resources.  The latter support is needed because if we are
> in a different thread context and only have the "struct kunit *"
> to work with, we need a way to identify a resource in lookup.
>
> [1] https://lkml.org/lkml/2020/2/26/1286
>
> Changes since v3:
> - removed unused "init" field from "struct kunit_resources" (Brendan)

Shuah, it looks like you haven't sent a PR to Linus yet. Would you
mind picking this up for 5.8?
Shuah Khan June 9, 2020, 8:25 p.m. UTC | #2
On 6/5/20 3:20 PM, Brendan Higgins wrote:
> On Fri, May 29, 2020 at 2:46 PM Alan Maguire <alan.maguire@oracle.com> wrote:
>>
>> A recent RFC patch set [1] suggests some additional functionality
>> may be needed around kunit resources.  It seems to require
>>
>> 1. support for resources without allocation
>> 2. support for lookup of such resources
>> 3. support for access to resources across multiple kernel threads
>>
>> The proposed changes here are designed to address these needs.
>> The idea is we first generalize the API to support adding
>> resources with static data; then from there we support named
>> resources.  The latter support is needed because if we are
>> in a different thread context and only have the "struct kunit *"
>> to work with, we need a way to identify a resource in lookup.
>>
>> [1] https://lkml.org/lkml/2020/2/26/1286
>>
>> Changes since v3:
>> - removed unused "init" field from "struct kunit_resources" (Brendan)
> 
> Shuah, it looks like you haven't sent a PR to Linus yet. Would you
> mind picking this up for 5.8?
> 

Applied to linux-kselftest kunit branch for second update for
Linux 5.8-rc1

thanks,
-- Shuah