Re: [PATCH v4 27/28] tools/testing/cxl: Make event logs dynamic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 07 Oct 2024 18:16:33 -0500
Ira Weiny <ira.weiny@xxxxxxxxx> wrote:

> The event logs test was created as static arrays as an easy way to mock
> events.  Dynamic Capacity Device (DCD) test support requires events be
> generated dynamically when extents are created or destroyed.
> 
> The current event log test has specific checks for the number of events
> seen including log overflow.
> 
> Modify mock event logs to be dynamically allocated.  Adjust array size
> and mock event entry data to match the output expected by the existing
> event test.
> 
> Use the static event data to create the dynamic events in the new logs
> without inventing complex event injection for the previous tests.
> 
> Simplify log processing by using the event log array index as the
> handle.  Add a lock to manage concurrency required when user space is
> allowed to control DCD extents
> 
> Signed-off-by: Ira Weiny <ira.weiny@xxxxxxxxx>
Might be worth breaking up into refactor (the static cases) and
then new stuff.

Otherwise one trivial comment inline.

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>

> 
> ---
> Changes:
> [iweiny: rebase to 6.12]
> ---
>  tools/testing/cxl/test/mem.c | 268 ++++++++++++++++++++++++++-----------------
>  1 file changed, 162 insertions(+), 106 deletions(-)
> 
> diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c
> index ccdd6a504222..5e453aa2819b 100644
> --- a/tools/testing/cxl/test/mem.c
> +++ b/tools/testing/cxl/test/mem.c
> @@ -126,18 +126,26 @@ static struct {

>  /* Handle can never be 0 use 1 based indexing for handle */
> -static u16 event_get_clear_handle(struct mock_event_log *log)
> +static u16 event_inc_handle(u16 handle)
>  {
> -	return log->clear_idx + 1;
> +	handle = (handle + 1) % CXL_TEST_EVENT_ARRAY_SIZE;
> +	if (!handle)
> +		handle = handle + 1;

That's a little confusing for me

	if (handle == 0)
		handle = 1;

> +	return handle;
>  }






[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux