lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240827153947.000077a8@Huawei.com>
Date: Tue, 27 Aug 2024 15:39:47 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Ira Weiny <ira.weiny@...el.com>
CC: Dave Jiang <dave.jiang@...el.com>, Fan Ni <fan.ni@...sung.com>, "Navneet
 Singh" <navneet.singh@...el.com>, Chris Mason <clm@...com>, Josef Bacik
	<josef@...icpanda.com>, David Sterba <dsterba@...e.com>, Petr Mladek
	<pmladek@...e.com>, Steven Rostedt <rostedt@...dmis.org>, Andy Shevchenko
	<andriy.shevchenko@...ux.intel.com>, Rasmus Villemoes
	<linux@...musvillemoes.dk>, Sergey Senozhatsky <senozhatsky@...omium.org>,
	Jonathan Corbet <corbet@....net>, Andrew Morton <akpm@...ux-foundation.org>,
	Dan Williams <dan.j.williams@...el.com>, Davidlohr Bueso <dave@...olabs.net>,
	Alison Schofield <alison.schofield@...el.com>, Vishal Verma
	<vishal.l.verma@...el.com>, <linux-btrfs@...r.kernel.org>,
	<linux-cxl@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
	<linux-doc@...r.kernel.org>, <nvdimm@...ts.linux.dev>
Subject: Re: [PATCH v3 25/25] tools/testing/cxl: Add DC Regions to mock mem
 data

On Fri, 16 Aug 2024 09:44:33 -0500
Ira Weiny <ira.weiny@...el.com> wrote:

> cxl_test provides a good way to ensure quick smoke and regression
> testing.  The complexity of Dynamic Capacity (DC) extent processing as
> well as the complexity of the new sparse DAX regions can mostly be
> tested through cxl_test.  This includes management of sparse regions and
> DAX devices on those regions; the management of extent device lifetimes;
> and the processing of DCD events.
> 
> The only missing functionality from this test is actual interrupt
> processing.
> 
> Mock memory devices can easily mock DC information and manage fake
> extent data.
> 
> Define mock_dc_region information within the mock memory data.  Add
> sysfs entries on the mock device to inject and delete extents.
> 
> The inject format is <start>:<length>:<tag>:<more_flag>
> The delete format is <start>:<length>
> 
> Directly call the event irq callback to simulate irqs to process the
> test extents.
> 
> Add DC mailbox commands to the CEL and implement those commands.
> 
> Signed-off-by: Ira Weiny <ira.weiny@...el.com>

Minor stuff inline.

Thanks,

Jonathan

> +static int mock_get_dc_config(struct device *dev,
> +			      struct cxl_mbox_cmd *cmd)
> +{
> +	struct cxl_mbox_get_dc_config_in *dc_config = cmd->payload_in;
> +	struct cxl_mockmem_data *mdata = dev_get_drvdata(dev);
> +	u8 region_requested, region_start_idx, region_ret_cnt;
> +	struct cxl_mbox_get_dc_config_out *resp;
> +	int i;
> +
> +	region_requested = dc_config->region_count;
> +	if (region_requested > NUM_MOCK_DC_REGIONS)
> +		region_requested = NUM_MOCK_DC_REGIONS;

	region_requested = min(...)

> +
> +	if (cmd->size_out < struct_size(resp, region, region_requested))
> +		return -EINVAL;
> +
> +	memset(cmd->payload_out, 0, cmd->size_out);
> +	resp = cmd->payload_out;
> +
> +	region_start_idx = dc_config->start_region_index;
> +	region_ret_cnt = 0;
> +	for (i = 0; i < NUM_MOCK_DC_REGIONS; i++) {
> +		if (i >= region_start_idx) {
> +			memcpy(&resp->region[region_ret_cnt],
> +				&mdata->dc_regions[i],
> +				sizeof(resp->region[region_ret_cnt]));
> +			region_ret_cnt++;
> +		}
> +	}
> +	resp->avail_region_count = NUM_MOCK_DC_REGIONS;
> +	resp->regions_returned = i;
> +
> +	dev_dbg(dev, "Returning %d dc regions\n", region_ret_cnt);
> +	return 0;
> +}



> +static void cxl_mock_mem_remove(struct platform_device *pdev)
> +{
> +	struct cxl_mockmem_data *mdata = dev_get_drvdata(&pdev->dev);
> +	struct cxl_memdev_state *mds = mdata->mds;
> +
> +	dev_dbg(mds->cxlds.dev, "Removing extents\n");

Clean this up as it doesn't do anything!

> +}
> +

> @@ -1689,14 +2142,261 @@ static ssize_t sanitize_timeout_store(struct device *dev,
>  
>  	return count;
>  }
> -
Grump ;)  No whitespace changes in a patch doing anything 'useful'.
>  static DEVICE_ATTR_RW(sanitize_timeout);
>  

> +static int log_dc_event(struct cxl_mockmem_data *mdata, enum dc_event type,
> +			u64 start, u64 length, const char *tag_str, bool more)
> +{
> +	struct device *dev = mdata->mds->cxlds.dev;
> +	struct cxl_test_dcd *dcd_event;
> +
> +	dev_dbg(dev, "mock device log event %d\n", type);
> +
> +	dcd_event = devm_kmemdup(dev, &dcd_event_rec_template,
> +				     sizeof(*dcd_event), GFP_KERNEL);
> +	if (!dcd_event)
> +		return -ENOMEM;
> +
> +	dcd_event->rec.flags = 0;
> +	if (more)
> +		dcd_event->rec.flags |= CXL_DCD_EVENT_MORE;
> +	dcd_event->rec.event_type = type;
> +	dcd_event->rec.extent.start_dpa = cpu_to_le64(start);
> +	dcd_event->rec.extent.length = cpu_to_le64(length);
> +	memcpy(dcd_event->rec.extent.tag, tag_str,
> +	       min(sizeof(dcd_event->rec.extent.tag),
> +		   strlen(tag_str)));
> +
> +	mes_add_event(mdata, CXL_EVENT_TYPE_DCD,
> +		      (struct cxl_event_record_raw *)dcd_event);
I guess this is where the missing event in previous patch come from.

Increment the number here, not back in that patch.

Jonathan


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ