Re: [PATCH V3 18/20] cxl/pmem_region: Prep patch to accommodate pmem_region attributes

2025-10-06 Thread Dave Jiang
On 9/29/25 6:57 AM, Neeraj Kumar wrote: > On 24/09/25 11:53AM, Dave Jiang wrote: >> >> >> On 9/17/25 6:41 AM, Neeraj Kumar wrote: >>> Created a separate file core/pmem_region.c along with CONFIG_PMEM_REGION >>> Moved pmem_region related code from core

Re: [PATCH V3 13/20] cxl/mem: Refactor cxl pmem region auto-assembling

2025-10-06 Thread Dave Jiang
On 9/29/25 6:30 AM, Neeraj Kumar wrote: > On 23/09/25 03:37PM, Dave Jiang wrote: >> >> >> On 9/17/25 6:41 AM, Neeraj Kumar wrote: >>> In 84ec985944ef3, devm_cxl_add_nvdimm() sequence was changed and called >>> before devm_cxl_add_endpoint(). It's be

Re: [PATCH v2] nvdimm: ndtest: Return -ENOMEM if devm_kcalloc() fails in ndtest_probe()

2025-09-25 Thread Dave Jiang
On 9/23/25 5:59 AM, Guangshuo Li wrote: > devm_kcalloc() may fail. ndtest_probe() allocates three DMA address > arrays (dcr_dma, label_dma, dimm_dma) and later unconditionally uses > them in ndtest_nvdimm_init(), which can lead to a NULL pointer > dereference under low-memory conditions. > > Ch

Re: [PATCH V3 19/20] cxl/pmem_region: Add sysfs attribute cxl region label updation/deletion

2025-09-24 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > Using these attributes region label is added/deleted into LSA. These > attributes are called from userspace (ndctl) after region creation. > > Signed-off-by: Neeraj Kumar > --- > Documentation/ABI/testing/sysfs-bus-cxl | 22 ++ > drivers/cxl/core/

Re: [PATCH V3 16/20] cxl/mem: Preserve cxl root decoder during mem probe

2025-09-24 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > Saved root decoder info is required for cxl region persistency Should squash this patch into the previous patch. It's small enough that the usage and the implementation can be in the same patch. > > Signed-off-by: Neeraj Kumar > --- > drivers/cxl/c

Re: [PATCH V3 15/20] cxl: Add a routine to find cxl root decoder on cxl bus using cxl port

2025-09-24 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > Add cxl_find_root_decoder_by_port() to find root decoder on cxl bus. > It is used to find root decoder using cxl port. > > Signed-off-by: Neeraj Kumar > --- > drivers/cxl/core/port.c | 27 +++ > drivers/cxl/cxl.h | 1 + >

Re: [PATCH v2] nvdimm: ndtest: Return -ENOMEM if devm_kcalloc() fails in ndtest_probe()

2025-09-24 Thread Dave Jiang
On 9/24/25 12:42 AM, Guangshuo Li wrote: > Hi Alison, Dave, and all, > > Thanks for the feedback. I’ve adopted your suggestions. Below is what I plan > to take in v3. > > -       p->dcr_dma = devm_kcalloc(&p->pdev.dev , NUM_DCR, > -                                 sizeof(dma_

Re: [PATCH V3 14/20] cxl/region: Add devm_cxl_pmem_add_region() for pmem region creation

2025-09-23 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > devm_cxl_pmem_add_region() is used to create cxl region based on region > information scanned from LSA. > > devm_cxl_add_region() is used to just allocate cxlr and its fields are > filled later by userspace tool using device attributes (*_store()). > >

Re: [PATCH V3 13/20] cxl/mem: Refactor cxl pmem region auto-assembling

2025-09-23 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > In 84ec985944ef3, devm_cxl_add_nvdimm() sequence was changed and called > before devm_cxl_add_endpoint(). It's because cxl pmem region auto-assembly > used to get called at last in cxl_endpoint_port_probe(), which requires > cxl_nvd presence. > > For cx

Re: [PATCH V3 12/20] nvdimm/region_label: Export routine to fetch region information

2025-09-23 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > CXL region information preserved from the LSA needs to be exported for > use by the CXL driver for CXL region re-creation. > > Signed-off-by: Neeraj Kumar > --- > drivers/nvdimm/dimm_devs.c | 18 ++ > include/linux/libnvdimm.h | 2 ++

Re: [PATCH V3 06/20] nvdimm/region_label: Add region label update support

2025-09-22 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > Modified __pmem_label_update() to update region labels into LSA > > Signed-off-by: Neeraj Kumar > --- > drivers/nvdimm/label.c | 269 ++-- > drivers/nvdimm/label.h | 15 ++ > drivers/nvdimm/namespace_devs

Re: [PATCH V3 07/20] nvdimm/region_label: Add region label delete support

2025-09-22 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > Added LSA v2.1 format region label deletion routine. This function is > used to delete region label from LSA > > Signed-off-by: Neeraj Kumar > --- > drivers/nvdimm/label.c | 79 ++--- > drivers/nvdimm/label.h

Re: [PATCH V3 04/20] nvdimm/label: Update mutex_lock() with guard(mutex)()

2025-09-19 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > Updated mutex_lock() with guard(mutex)() Need a bit more in the commit log on why the change so whomever reads the commit later on has an idea what is happening. > > Signed-off-by: Neeraj Kumar > --- > drivers/nvdimm/label.c | 36 +-

Re: [PATCH V3 02/20] nvdimm/label: CXL labels skip the need for 'interleave-set cookie'

2025-09-19 Thread Dave Jiang
sage for CXL LSA 2.1 format > > Signed-off-by: Neeraj Kumar > Reviewed-by: Jonathan Cameron > Acked-by: Ira Weiny Reviewed-by: Dave Jiang > --- > drivers/nvdimm/namespace_devs.c | 8 +++- > drivers/nvdimm/region_devs.c| 10 ++ > 2 files changed, 17 in

Re: [PATCH V3 05/20] nvdimm/namespace_label: Add namespace label changes as per CXL LSA v2.1

2025-09-19 Thread Dave Jiang
On 9/17/25 6:41 AM, Neeraj Kumar wrote: > CXL 3.2 Spec mentions CXL LSA 2.1 Namespace Labels at section 9.13.2.5 > Modified __pmem_label_update function using setter functions to update > namespace label as per CXL LSA 2.1 > > Signed-off-by: Neeraj Kumar > --- > drivers/nvdimm/label.c | 3 ++

Re: [PATCH V3 03/20] nvdimm/label: Modify nd_label_base() signature

2025-09-19 Thread Dave Jiang
On 9/17/25 6:40 AM, Neeraj Kumar wrote: > nd_label_base() was being used after typecasting with 'unsigned long'. Thus > modified nd_label_base() to return 'unsigned long' instead of 'struct > nd_namespace_label *' > > Signed-off-by: Neeraj Kuma

Re: [PATCH V3 01/20] nvdimm/label: Introduce NDD_REGION_LABELING flag to set region label

2025-09-19 Thread Dave Jiang
f-by: Neeraj Kumar With the change noted below, Reviewed-by: Dave Jiang > --- > drivers/nvdimm/dimm.c | 1 + > drivers/nvdimm/dimm_devs.c | 7 +++ > drivers/nvdimm/label.c | 21 + > drivers/nvdimm/nd.h| 1 + > include/linux/libnvdimm.h

Re: [PATCH V3 00/20] Add CXL LSA 2.1 format support in nvdimm and cxl pmem

2025-09-17 Thread Dave Jiang
On 9/17/25 7:50 AM, Jonathan Cameron wrote: > On Wed, 17 Sep 2025 19:10:56 +0530 > Neeraj Kumar wrote: > > > Hi, > Not sure what difference between the two versions I'm seeing is. > Patch 02 is missing in both of them. > > Jonathan > Neeraj, If you resend the series again with patch 2 incl

Re: [PATCH -next] ndtest: Fix incorrect handling for return value of device_create_with_groups.

2025-09-08 Thread Dave Jiang
gt; Signed-off-by: Lin Yujun Reviewed-by: Dave Jiang > --- > tools/testing/nvdimm/test/ndtest.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/testing/nvdimm/test/ndtest.c > b/tools/testing/nvdimm/test/ndtest.c > index 68a064ce598c..7d722f2f7d62

Re: [PATCH 5/6] dax/hmem: Reintroduce Soft Reserved ranges back into the iomem tree

2025-09-04 Thread Dave Jiang
n Schofield > Signed-off-by: Alison Schofield > Signed-off-by: Smita Koralahalli Reviewed-by: Dave Jiang > --- > drivers/dax/hmem/hmem.c | 38 ++ > 1 file changed, 38 insertions(+) > > diff --git a/drivers/dax/hmem/hmem.c b/drivers/dax/hmem

Re: [PATCH 2/6] dax/hmem: Request cxl_acpi and cxl_pci before walking Soft Reserved ranges

2025-09-04 Thread Dave Jiang
a deferred > context before dax_hmem makes ownership decisions for Soft Reserved > ranges. > > Signed-off-by: Smita Koralahalli > Signed-off-by: Dan Williams Reviewed-by: Dave Jiang > --- > drivers/dax/hmem/hmem.c | 17 ++--- > 1 file changed, 10 insertions(

Re: [PATCH] nvdimm: Use str_plural() to simplify the code

2025-08-27 Thread Dave Jiang
On 8/26/25 7:13 PM, Xichao Zhao wrote: > Use the string choice helper function str_plural() to simplify the code. > > Signed-off-by: Xichao Zhao Reviewed-by: Dave Jiang > --- > drivers/nvdimm/namespace_devs.c | 2 +- > drivers/nvdimm/region.c | 2 +- > 2 files

Re: [PATCH V2 13/20] cxl/mem: Refactor cxl pmem region auto-assembling

2025-08-20 Thread Dave Jiang
On 7/30/25 5:12 AM, Neeraj Kumar wrote: > In 84ec985944ef3, devm_cxl_add_nvdimm() sequence was changed and called > before devm_cxl_add_endpoint(). It's because cxl pmem region auto-assembly > used to get called at last in cxl_endpoint_port_probe(), which requires > cxl_nvd presence. > > For cx

Re: [PATCH V2 14/20] cxl/region: Add devm_cxl_pmem_add_region() for pmem region creation

2025-08-19 Thread Dave Jiang
On 7/30/25 5:12 AM, Neeraj Kumar wrote: > devm_cxl_pmem_add_region() is used to create cxl region based on region > information scanned from LSA. > > devm_cxl_add_region() is used to just allocate cxlr and its fields are > filled later by userspace tool using device attributes (*_store()). > >

Re: [PATCH V2 02/20] nvdimm/label: Prep patch to accommodate cxl lsa 2.1 support

2025-08-18 Thread Dave Jiang
On 7/30/25 5:11 AM, Neeraj Kumar wrote: > LSA 2.1 format introduces region label, which can also reside > into LSA along with only namespace label as per v1.1 and v1.2 > > As both namespace and region labels are of same size of 256 bytes. > Thus renamed "struct nd_namespace_label" to "struct nd

Re: [PATCH V2 05/20] nvdimm/region_label: Add region label updation routine

2025-08-15 Thread Dave Jiang
On 7/30/25 5:11 AM, Neeraj Kumar wrote: > diff --git a/drivers/nvdimm/nd.h b/drivers/nvdimm/nd.h > index 651847f1bbf9..15d94e3937f0 100644 > --- a/drivers/nvdimm/nd.h > +++ b/drivers/nvdimm/nd.h > @@ -322,6 +322,26 @@ static inline void nsl_set_region_uuid(struct > nvdimm_drvdata *ndd, >

Re: [PATCH V2 06/20] nvdimm/region_label: Add region label deletion routine

2025-08-15 Thread Dave Jiang
On 7/30/25 5:11 AM, Neeraj Kumar wrote: > Added cxl v2.1 format region label deletion routine. This function is > used to delete region label from LSA > > Signed-off-by: Neeraj Kumar > --- > drivers/nvdimm/label.c | 77 ++--- > drivers/nvdimm/label.h

Re: [PATCH V2 02/20] nvdimm/label: Prep patch to accommodate cxl lsa 2.1 support

2025-08-15 Thread Dave Jiang
On 7/30/25 5:11 AM, Neeraj Kumar wrote: > LSA 2.1 format introduces region label, which can also reside > into LSA along with only namespace label as per v1.1 and v1.2 > > As both namespace and region labels are of same size of 256 bytes. > Thus renamed "struct nd_namespace_label" to "struct nd

Re: [PATCH V2 05/20] nvdimm/region_label: Add region label updation routine

2025-08-15 Thread Dave Jiang
On 7/30/25 5:11 AM, Neeraj Kumar wrote: > Added __pmem_region_label_update region label update routine to update > region label. > > Also used guard(mutex)(&nd_mapping->lock) in place of mutex_lock() and > mutex_unlock() > > Signed-off-by: Neeraj Kumar Subject, s/updation/update/ ? > --- >

Re: [PATCH V2 04/20] nvdimm/label: CXL labels skip the need for 'interleave-set cookie'

2025-08-15 Thread Dave Jiang
On 7/30/25 5:11 AM, Neeraj Kumar wrote: > CXL LSA v2.1 utilizes the region labels stored in the LSA for interleave > set configuration instead of interleave-set cookie used in previous LSA > versions. As interleave-set cookie is not required for CXL LSA v2.1 format > so skip its usage for CXL LS

Re: [PATCH V2 01/20] nvdimm/label: Introduce NDD_CXL_LABEL flag to set cxl label format

2025-08-15 Thread Dave Jiang
On 8/13/25 6:12 AM, Jonathan Cameron wrote: > On Wed, 30 Jul 2025 17:41:50 +0530 > Neeraj Kumar wrote: > >> Prior to LSA 2.1 version, LSA contain only namespace labels. LSA 2.1 >> introduced in CXL 2.0 Spec, which contain region label along with >> namespace label. >> >> NDD_LABELING flag is u

Re: [PATCH V2 00/20] Add CXL LSA 2.1 format support in nvdimm and cxl pmem

2025-08-12 Thread Dave Jiang
On 8/7/25 2:02 AM, Neeraj Kumar wrote: > On 30/07/25 05:41PM, Neeraj Kumar wrote: >> Introduction: >> = >> CXL Persistent Memory (Pmem) devices region, namespace and content must be >> persistent across system reboot. In order to achieve this persistency, it >> uses Label Storage Are

Re: [RFC PATCH 13/20] cxl/mem: Refactor cxl pmem region auto-assembling

2025-07-21 Thread Dave Jiang
On 7/18/25 5:30 AM, Neeraj Kumar wrote: > On 09/07/25 05:38PM, Dave Jiang wrote: >> >> >> On 6/17/25 5:39 AM, Neeraj Kumar wrote: >>> In 84ec985944ef3, For cxl pmem region auto-assembly after endpoint port >>> probing, cxl_nvd presence was required. And

Re: [RFC PATCH 18/20] cxl/pmem: Add support of cxl lsa 2.1 support in cxl pmem

2025-07-21 Thread Dave Jiang
On 7/18/25 5:51 AM, Neeraj Kumar wrote: > On 10/07/25 10:18AM, Dave Jiang wrote: >> >> >> On 6/17/25 5:39 AM, Neeraj Kumar wrote: >>> Add support of cxl lsa 2.1 using NDD_CXL_LABEL flag. It also creates cxl >>> region based on region information parsed

Re: [PATCH v5 0/7] Add managed SOFT RESERVE resource handling

2025-07-17 Thread Dave Jiang
On 7/17/25 4:20 PM, Koralahalli Channabasappa, Smita wrote: > On 7/17/2025 12:06 PM, Dave Jiang wrote: >> >> >> On 7/17/25 10:58 AM, Koralahalli Channabasappa, Smita wrote: >>> >>> >>> On 7/16/2025 4:48 PM, Alison Schofield wrote: >>&g

Re: [PATCH v5 0/7] Add managed SOFT RESERVE resource handling

2025-07-17 Thread Dave Jiang
On 7/17/25 10:58 AM, Koralahalli Channabasappa, Smita wrote: > > > On 7/16/2025 4:48 PM, Alison Schofield wrote: >> On Wed, Jul 16, 2025 at 02:29:52PM -0700, Koralahalli Channabasappa, Smita >> wrote: >>> On 7/16/2025 1:20 PM, Alison Schofield wrote: On Tue, Jul 15, 2025 at 11:01:23PM -0

Re: [PATCH v5 4/7] cxl/region: Introduce SOFT RESERVED resource removal on region teardown

2025-07-16 Thread Dave Jiang
On 7/15/25 11:04 AM, Smita Koralahalli wrote: > Reworked from a patch by Alison Schofield > > Previously, when CXL regions were created through autodiscovery and their > resources overlapped with SOFT RESERVED ranges, the soft reserved resource > remained in place after region teardown. This l

Re: [PATCH v5 3/7] cxl/acpi: Add background worker to coordinate with cxl_mem probe completion

2025-07-16 Thread Dave Jiang
On 7/15/25 11:04 AM, Smita Koralahalli wrote: > Introduce a background worker in cxl_acpi to delay SOFT RESERVE handling > until the cxl_mem driver has probed at least one device. This coordination > ensures that DAX registration or fallback handling for soft-reserved > regions is not triggered

Re: [RFC PATCH 18/20] cxl/pmem: Add support of cxl lsa 2.1 support in cxl pmem

2025-07-10 Thread Dave Jiang
On 6/17/25 5:39 AM, Neeraj Kumar wrote: > Add support of cxl lsa 2.1 using NDD_CXL_LABEL flag. It also creates cxl > region based on region information parsed from LSA. > > Signed-off-by: Neeraj Kumar > --- > drivers/cxl/pmem.c | 59 ++ > 1 file cha

Re: [RFC PATCH 15/20] cxl: Add a routine to find cxl root decoder on cxl bus

2025-07-10 Thread Dave Jiang
On 6/17/25 5:39 AM, Neeraj Kumar wrote: > Add cxl_find_root_decoder to find root decoder on cxl bus. It is used to > find root decoder during region creation > > Signed-off-by: Neeraj Kumar > --- > drivers/cxl/core/port.c | 26 ++ > drivers/cxl/cxl.h | 1 + > 2

Re: [RFC PATCH 14/20] cxl/region: Add cxl pmem region creation routine for region persistency

2025-07-10 Thread Dave Jiang
On 6/17/25 5:39 AM, Neeraj Kumar wrote: > Added exported cxl_create_pmem_region routine to create cxl pmem region > from LSA parsed cxl region information. > Inspirition for the function is taken from ndctl device attribute > (_store) call. It allocates cxlr and fills information parsed from LSA

Re: [RFC PATCH 13/20] cxl/mem: Refactor cxl pmem region auto-assembling

2025-07-09 Thread Dave Jiang
On 6/17/25 5:39 AM, Neeraj Kumar wrote: > In 84ec985944ef3, For cxl pmem region auto-assembly after endpoint port > probing, cxl_nvd presence was required. And for cxl region persistency, > region creation happens during nvdimm_probe which need the completion > of endpoint probe. > > It is ther

Re: [RFC PATCH 01/20] nvdimm/label: Introduce NDD_CXL_LABEL flag to set cxl label format

2025-07-09 Thread Dave Jiang
On 6/17/25 5:39 AM, Neeraj Kumar wrote: > NDD_CXL_LABEL is introduced to set cxl LSA 2.1 label format > Accordingly updated label index version Maybe add the spec reference that defines label 2.1 format > > Signed-off-by: Neeraj Kumar > --- > drivers/nvdimm/dimm.c | 1 + > drivers/nvdi

Re: [PATCH v2 1/1] libnvdimm: Don't use "proxy" headers

2025-06-30 Thread Dave Jiang
. > > Signed-off-by: Andy Shevchenko Reviewed-by: Dave Jiang > --- > > v2: reshuffled includes and forward declarations (Ira) > > include/linux/libnvdimm.h | 15 ++- > 1 file changed, 10 insertions(+), 5 deletions(-) > > diff --git a/inclu

Re: [PATCH v4 6/7] dax/hmem: Save the DAX HMEM platform device pointer

2025-06-05 Thread Dave Jiang
On 6/3/25 3:19 PM, Smita Koralahalli wrote: > From: Nathan Fontenot > > To enable registration of HMEM devices for SOFT RESERVED regions after > the DAX HMEM device is initialized, this patch saves a reference to the > DAX HMEM platform device. > > This saved pointer will be used in a follow-

Re: [PATCH v4 4/7] cxl/acpi: Add background worker to wait for cxl_pci and cxl_mem probe

2025-06-04 Thread Dave Jiang
On 6/4/25 2:40 AM, Zhijian Li (Fujitsu) wrote: > > > On 04/06/2025 06:19, Smita Koralahalli wrote: >> drivers/cxl/acpi.c | 23 +++ >> drivers/cxl/core/suspend.c | 21 + >> drivers/cxl/cxl.h | 2 ++ >> 3 files changed, 46 insertions

Re: [PATCH v4 1/7] cxl/region: Avoid null pointer dereference in is_cxl_region()

2025-06-03 Thread Dave Jiang
On 6/3/25 3:19 PM, Smita Koralahalli wrote: > Add a NULL check in is_cxl_region() to prevent potential null pointer > dereference if a caller passes a NULL device. This change ensures the > function safely returns false instead of triggering undefined behavior > when dev is NULL. Don't think th

Re: [PATCH v4 4/7] cxl/acpi: Add background worker to wait for cxl_pci and cxl_mem probe

2025-06-03 Thread Dave Jiang
On 6/3/25 3:19 PM, Smita Koralahalli wrote: > Introduce a waitqueue mechanism to coordinate initialization between the > cxl_pci and cxl_mem drivers. > > Launch a background worker from cxl_acpi_probe() that waits for both > drivers to complete initialization before invoking wait_for_device_pro

Re: [PATCH] acpi: nfit: fix narrowing conversion in acpi_nfit_ctl

2025-01-23 Thread Dave Jiang
On 1/23/25 9:39 AM, Murad Masimov wrote: > Syzkaller has reported a warning in to_nfit_bus_uuid(): "only secondary > bus families can be translated". This warning is emited if the argument > is equal to NVDIMM_BUS_FAMILY_NFIT == 0. Function acpi_nfit_ctl() first > verifies that a user-provided v

Re: [PATCH v6] acpi: nfit: vmalloc-out-of-bounds Read in acpi_nfit_ctl

2024-12-02 Thread Dave Jiang
ved2 array. > > Reported-by: syzbot+7534f060ebda6b8b5...@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=7534f060ebda6b8b51b3 > Tested-by: syzbot+7534f060ebda6b8b5...@syzkaller.appspotmail.com > Fixes: ebe9f6f19d80 ("acpi/nfit: Fix bus command validation") &

Re: [PATCH v4] acpi: nfit: vmalloc-out-of-bounds Read in acpi_nfit_ctl

2024-11-15 Thread Dave Jiang
ved2 array. > > Reported-by: syzbot+7534f060ebda6b8b5...@syzkaller.appspotmail.com > Closes: https://syzkaller.appspot.com/bug?extid=7534f060ebda6b8b51b3 > Tested-by: syzbot+7534f060ebda6b8b5...@syzkaller.appspotmail.com > Fixes: ebe9f6f19d80 ("acpi/nfit: Fix bus command validation") &

Re: [PATCH v3] acpi: nfit: vmalloc-out-of-bounds Read in acpi_nfit_ctl

2024-11-14 Thread Dave Jiang
On 11/14/24 2:19 AM, Suraj Sonawane wrote: > On 13/11/24 22:32, Dave Jiang wrote: >> >> >> On 11/13/24 5:51 AM, Suraj Sonawane wrote: >>> Fix an issue detected by syzbot with KASAN: >>> >>> BUG: KASAN: vmalloc-out-of-bounds in cmd_to_func dr

Re: [PATCH v3] acpi: nfit: vmalloc-out-of-bounds Read in acpi_nfit_ctl

2024-11-13 Thread Dave Jiang
On 11/13/24 5:51 AM, Suraj Sonawane wrote: > Fix an issue detected by syzbot with KASAN: > > BUG: KASAN: vmalloc-out-of-bounds in cmd_to_func drivers/acpi/nfit/ > core.c:416 [inline] > BUG: KASAN: vmalloc-out-of-bounds in acpi_nfit_ctl+0x20e8/0x24a0 > drivers/acpi/nfit/core.c:459 > > The issue

Re: [PATCH v1] nvdimm: Correct some typos in comments

2024-09-26 Thread Dave Jiang
amepace ==> namespace > drivers/nvdimm/pmem.c:319: reenable ==> re-enable > > Signed-off-by: Shen Lichuan Reviewed-by: Dave Jiang > --- > drivers/nvdimm/nd_virtio.c | 2 +- > drivers/nvdimm/pfn_devs.c | 2 +- > drivers/nvdimm/pmem.c | 2 +- > 3 files changed, 3 inse

Re: [PATCH v2] virtio_pmem: Check device status before requesting flush

2024-08-20 Thread Dave Jiang
On 8/20/24 10:22 AM, Philip Chen wrote: > If a pmem device is in a bad status, the driver side could wait for > host ack forever in virtio_pmem_flush(), causing the system to hang. > > So add a status check in the beginning of virtio_pmem_flush() to return > early if the device is not activated

Re: [PATCH] nvdimm/pmem: Set dax flag for all 'PFN_MAP' cases

2024-08-07 Thread Dave Jiang
e the dax flag to queue_limits") > Signed-off-by: Zhihao Cheng Reviewed-by: Dave Jiang > --- > drivers/nvdimm/pmem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/nvdimm/pmem.c b/drivers/nvdimm/pmem.c > index 1ae8b2351654..210fb77f5

Re: [PATCH] nvdimm: Use of_property_present() and of_property_read_bool()

2024-08-07 Thread Dave Jiang
ar functions. > of_(find|get)_property() leak the DT struct property and data pointers > which is a problem for dynamically allocated nodes which may be freed. > > Signed-off-by: Rob Herring (Arm) Reviewed-by: Dave Jiang > --- > drivers/nvdimm/of_pmem.c | 2 +- > drivers/n

Re: [PATCH] nvdimm: Fix devs leaks in scan_labels()

2024-06-06 Thread Dave Jiang
On 6/3/24 8:16 PM, Li Zhijian wrote: > Don't allocate devs again when it's valid pointer which has pionted to > the memory allocated above with size (count + 2 * sizeof(dev)). > > A kmemleak reports: > unreferenced object 0x88800dda1980 (size 16): > comm "kworker/u10:5", pid 69, jiffies 4

Re: [PATCH RESEND] nvdimm: add missing MODULE_DESCRIPTION() macros

2024-06-06 Thread Dave Jiang
ON() in drivers/nvdimm/nd_btt.o > WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/nvdimm/nd_e820.o > WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/nvdimm/of_pmem.o > WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/nvdimm/nd_virtio.o > > Signed-off-by:

Re: [PATCH] ACPI: NFIT: add missing MODULE_DESCRIPTION() macro

2024-06-06 Thread Dave Jiang
On 6/3/24 6:30 AM, Jeff Johnson wrote: > make allmodconfig && make W=1 C=1 reports: > WARNING: modpost: missing MODULE_DESCRIPTION() in drivers/acpi/nfit/nfit.o > > Add the missing invocation of the MODULE_DESCRIPTION() macro. > > Signed-off-by: Jeff Johnson

Re: [PATCH][next] dax: remove redundant assignment to variable rc

2024-04-15 Thread Dave Jiang
ning: Value stored to 'rc' is never > read [deadcode.DeadStores] > > Signed-off-by: Colin Ian King Reviewed-by: Dave Jiang > --- > drivers/dax/bus.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c > index 797e

[GIT PULL] NVDIMM//DAX changes for 6.9

2024-03-14 Thread Dave Jiang
Hi Linus, please pull from: git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git tags/libnvdimm-for-6.9 ... to get updates to the nvdimm tree. They are a number of updates to interfaces used by nvdimm/dax and a documentation fix. Doc fixes: ACPI_NFIT Kconfig documetation f

Re: [PATCH] dax: remove SLAB_MEM_SPREAD flag usage

2024-02-27 Thread Dave Jiang
On 2/24/24 6:47 AM, chengming.z...@linux.dev wrote: > From: Chengming Zhou > > The SLAB_MEM_SPREAD flag is already a no-op as of 6.8-rc1, remove > its usage so we can delete it from slab. No functional change. Can you please provide a Link tag to the lore post that indicates SLAB_MEM_SPREAD

Re: [PATCH] dax: constify the struct device_type usage

2024-02-23 Thread Dave Jiang
read-only memory which can not be modified at runtime. > > Cc: Greg Kroah-Hartman > Signed-off-by: Ricardo B. Marliere Reviewed-by: Dave Jiang > --- > drivers/dax/bus.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dax/bus.c b/driver

Re: [PATCH] device-dax: make dax_bus_type const

2024-02-05 Thread Dave Jiang
g Kroah-Hartman > Suggested-by: Greg Kroah-Hartman > Signed-off-by: Ricardo B. Marliere Reviewed-by: Dave Jiang > --- > drivers/dax/bus.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c > index 1659b787b65f..

Re: [PATCH] nvdimm: make nvdimm_bus_type const

2024-02-05 Thread Dave Jiang
g Kroah-Hartman > Suggested-by: Greg Kroah-Hartman > Signed-off-by: Ricardo B. Marliere Reviewed-by: Dave Jiang > --- > drivers/nvdimm/bus.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c > index ef

Re: [PATCH] driver core: Add a guard() definition for the device_lock()

2023-12-14 Thread Dave Jiang
Cc: Ira Weiny > Cc: Peter Zijlstra > Cc: Greg Kroah-Hartman > Cc: Andrew Morton > Signed-off-by: Dan Williams Reviewed-by: Dave Jiang > --- > Hi Greg, > > I wonder if you might include this change in v6.7-rc to ease some patch > sets alternately going through my tree and

Re: [PATCH] [v2] nvdimm-btt: simplify code with the scope based resource management

2023-12-14 Thread Dave Jiang
On 12/14/23 01:39, Dinghao Liu wrote: > Use the scope based resource management (defined in > linux/cleanup.h) to automate resource lifetime > control on struct btt_sb *super in discover_arenas(). > > Signed-off-by: Dinghao Liu Reviewed-by: Dave Jiang > --- > > Cha

Re: [PATCH] nvdimm-btt: simplify code with the scope based resource management

2023-12-13 Thread Dave Jiang
On 12/12/23 20:12, dinghao@zju.edu.cn wrote: >> >> On 12/10/23 03:27, Dinghao Liu wrote: >>> Use the scope based resource management (defined in >>> linux/cleanup.h) to automate resource lifetime >>> control on struct btt_sb *super in discover_arenas(). >>> >>> Signed-off-by: Dinghao Liu >>

Re: [PATCH] nvdimm: Remove usage of the deprecated ida_simple_xx() API

2023-12-11 Thread Dave Jiang
On 12/10/23 10:13, Christophe JAILLET wrote: > ida_alloc() and ida_free() should be preferred to the deprecated > ida_simple_get() and ida_simple_remove(). > > This is less verbose. > > Signed-off-by: Christophe JAILLET Reviewed-by: Dave Jiang > --- > drivers/nvd

Re: [PATCH] nvdimm-btt: simplify code with the scope based resource management

2023-12-11 Thread Dave Jiang
On 12/10/23 03:27, Dinghao Liu wrote: > Use the scope based resource management (defined in > linux/cleanup.h) to automate resource lifetime > control on struct btt_sb *super in discover_arenas(). > > Signed-off-by: Dinghao Liu > --- > drivers/nvdimm/btt.c | 12 > 1 file changed,

Re: [PATCH] nvdimm-btt: fix a potential memleak in btt_freelist_init

2023-12-07 Thread Dave Jiang
On 12/6/23 20:43, Dinghao Liu wrote: > When an error happens in btt_freelist_init(), its caller > discover_arenas() will directly free arena, which makes > arena->freelist allocated in btt_freelist_init() a leaked > memory. Fix this by freeing arena->freelist in all error > handling paths of btt

[GIT PULL] NVDIMM Fixes for 6.6-rc5

2023-10-02 Thread Dave Jiang
Hi Linus, please pull from: git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git tags/libnvdimm-fixes-6.6-rc5 ...to receive a small fix for libnvdimm correcting the calculation of idt size in the NFIT code. It has appeared in -next for a few days with no reported issues. --- The f

Re: [PATCH v1 1/1] ACPI: NFIT: Switch to use acpi_evaluate_dsm_typed()

2023-10-02 Thread Dave Jiang
On 10/2/23 06:54, Andy Shevchenko wrote: > The acpi_evaluate_dsm_typed() provides a way to check the type of the > object evaluated by _DSM call. Use it instead of open coded variant. > > Signed-off-by: Andy Shevchenko Reviewed-by: Dave Jiang > --- > drivers/acpi/nfit/cor

Re: [PATCH v1 1/2] ACPI: NFIT: Fix memory leak, and local use of devm_*()

2023-09-26 Thread Dave Jiang
ak'. > > Fix this by switching from devm_kcalloc() to kcalloc(), and adding > proper rollback. > > Fixes: eaf961536e16 ("libnvdimm, nfit: add interleave-set state-tracking > infrastructure") > Reported-by: Andy Shevchenko > Signed-off-by: Michal W

Re: [PATCH v1 2/2] ACPI: NFIT: Use modern scope based rollback

2023-09-26 Thread Dave Jiang
On 9/26/23 11:45, Michal Wilczynski wrote: > Change rollback in acpi_nfit_init_interleave_set() to use modern scope > based attribute __free(). This is similar to C++ RAII and is a preferred > way for handling local memory allocations. > > Suggested-by: Dave Jiang >

Re: [PATCH v3] libnvdimm/of_pmem: Use devm_kstrdup instead of kstrdup and check its return value

2023-09-14 Thread Dave Jiang
On 9/14/23 00:03, Chen Ni wrote: > Use devm_kstrdup() instead of kstrdup() and check its return value to > avoid memory leak. > > Fixes: 49bddc73d15c ("libnvdimm/of_pmem: Provide a unique name for bus > provider") > Signed-off-by: Chen Ni Reviewed-by: Dave J

Re: [PATCH] dax: refactor deprecated strncpy

2023-09-13 Thread Dave Jiang
Cc: linux-harden...@vger.kernel.org > Signed-off-by: Justin Stitt Reviewed-by: Dave Jiang > --- > Note: build-tested only. > --- > drivers/dax/bus.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c > index 0ee9

Re: [PATCH] drivers: nvdimm: fix possible memory leak

2023-09-08 Thread Dave Jiang
On 9/5/23 02:15, Konstantin Meskhidze wrote: Memory pointed by 'nd_pmu->pmu.attr_groups[NVDIMM_PMU_CPUMASK_ATTR]->attrs[0]' is allocated in function 'nvdimm_pmu_cpu_hotplug_init' via 'create_cpumask_attr_group' call. But not released in function 'nvdimm_pmu_free_hotplug_memory' or anywhere els

[GIT PULL] NVDIMM and DAX for 6.6

2023-08-30 Thread Dave Jiang
Hi Linus, please pull from git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm.git tags/libnvdimm-for-6.6 ... to receive the libnvdimm and DAX updates for v6.6 This is mostly small cleanups, fixes, and with a change to prevent zero-sized namespace exposed to user for nvdimm. It ha

Re: [PATCH] nvdimm: of_pmem: Add kfree for kstrdup

2023-08-28 Thread Dave Jiang
On 8/27/23 23:23, Chen Ni wrote: Add kfree() for kstrdup() in order to avoid memory leak. Signed-off-by: Chen Ni Can you please add a fixes tag? Thanks! --- drivers/nvdimm/of_pmem.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/nvdimm/of_pmem.c b/drivers/nvdimm/of_

Re: [PATCH] drivers: nvdimm: fix dereference after free

2023-08-17 Thread Dave Jiang
On 8/17/23 08:45, Dave Jiang wrote: On 8/17/23 04:41, Konstantin Meskhidze wrote: 'nd_pmu->pmu.attr_groups' is dereferenced in function 'nvdimm_pmu_free_hotplug_memory' call after it has been freed. Because in function 'nvdimm_pmu_free_hotplug_memory'

Re: [PATCH] drivers: nvdimm: fix memleak

2023-08-17 Thread Dave Jiang
On 8/17/23 04:59, Konstantin Meskhidze wrote: Memory pointed by 'nd_pmu->pmu.attr_groups' is allocated in function 'register_nvdimm_pmu' and is lost after 'kfree(nd_pmu)' call in function 'unregister_nvdimm_pmu'. Co-developed-by: Ivanov Mikhail Signed-off-by: Konstantin Meskhidze Applied

Re: [PATCH] drivers: nvdimm: fix dereference after free

2023-08-17 Thread Dave Jiang
On 8/17/23 04:41, Konstantin Meskhidze wrote: 'nd_pmu->pmu.attr_groups' is dereferenced in function 'nvdimm_pmu_free_hotplug_memory' call after it has been freed. Because in function 'nvdimm_pmu_free_hotplug_memory' memory pointed by the fields of 'nd_pmu->pmu.attr_groups' is deallocated it is

Re: [PATCH v2] ACPI: NFIT: limit string attribute write

2023-07-11 Thread Dave Jiang
On 7/11/23 02:37, Ben Dooks wrote: If we're writing what could be an arbitrary sized string into an attribute we should probably use sysfs_emit() just to be safe. Most of the other attriubtes are some sort of integer so unlikely to be an issue so not altered at this time. Signed-off-by: Ben D

Re: [PATCH] ACPI: NFIT: add helper to_nfit_mem() to take device to nfit_mem

2023-07-05 Thread Dave Jiang
Dooks Reviewed-by: Dave Jiang --- drivers/acpi/nfit/core.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/acpi/nfit/core.c b/drivers/acpi/nfit/core.c index 0fcc247fdfac..9213b426b125 100644 --- a/drivers/acpi/nfit/core.c +++ b/drivers

Re: [PATCH] ACPI: NFIT: limit string attribute write

2023-07-05 Thread Dave Jiang
On 7/4/23 01:17, Ben Dooks wrote: If we're writing what could be an arbitrary sized string into an attribute we should probably use snprintf() just to be safe. Most of the other attriubtes are some sort of integer so unlikely to be an issue so not altered at this time. Signed-off-by: Ben Dook

Re: [PATCH] nvdimm: make security_show static

2023-06-16 Thread Dave Jiang
/dimm_devs.c:352:9: warning: symbol 'security_show' was not declared. Should it be static? Signed-off-by: Ben Dooks Reviewed-by: Dave Jiang --- drivers/nvdimm/dimm_devs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/d

Re: [PATCH 3/3] libnvdimm: mark 'security_show' static again

2023-05-22 Thread Dave Jiang
:352:9: error: no previous prototype for 'security_show' This is also not an appropriate name for a global symbol in the kernel, so just make it static again. Fixes: 15a8348707ff ("libnvdimm: Introduce CONFIG_NVDIMM_SECURITY_TEST flag") Signed-off-by: Arnd Bergmann Rev

Re: [PATCH 2/3] testing: nvdimm: add missing prototypes for wrapped functions

2023-05-22 Thread Dave Jiang
__wrap_devm_memremap' [-Werror=missing-prototypes] 86 | void *__wrap_devm_memremap(struct device *dev, resource_size_t offset, | ^~~~ ... Add prototypes to avoid the warning. Signed-off-by: Arnd Bergmann Reviewed-by: Dave Jiang --- tools/testing/nvd

Re: [PATCH 1/3] acpi: nfit: add declaration in a local header

2023-05-22 Thread Dave Jiang
/core.c:1717:13: error: no previous prototype for 'nfit_intel_shutdown_status' [-Werror=missing-prototypes] Add a declaration in a header that gets included from both sides to shut up the warning and ensure that the prototypes actually match. Signed-off-by: Arnd Bergmann Reviewed-by:

Re: [PATCH 5.11 007/122] dmaengine: idxd: Fix clobbering of SWERR overflow bit on writeback

2021-04-20 Thread Dave Jiang
On 4/20/2021 1:13 PM, Pavel Machek wrote: Hi! Current code blindly writes over the SWERR and the OVERFLOW bits. Write back the bits actually read instead so the driver avoids clobbering the OVERFLOW bit that comes after the register is read. I believe this is incorrect. Changelog explains th

Re: [PATCH] dmaengine: idxd: Fix potential null dereference on pointer status

2021-04-15 Thread Dave Jiang
ed-off-by: Colin Ian King Acked-by: Dave Jiang Thanks! --- drivers/dma/idxd/device.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c index 31c819544a22..78d2dc5e9bd8 100644 --- a/drivers/dma/idxd/device.c ++

Re: [PATCH v2] dma: Fix a double free in dma_async_device_register

2021-03-30 Thread Dave Jiang
chan->local was freed in __dma_async_device_channel_register(). My patch sets chan->local to NULL when the callee failed to avoid double free. Fixes: d2fb0a0438384 ("dmaengine: break out channel registration") Signed-off-by: Lv Yunlong Reviewed-by: Dave Jiang --- drivers

Re: [PATCH] dma: Fix a double free in dma_async_device_register

2021-03-30 Thread Dave Jiang
On 3/30/2021 2:01 AM, Lv Yunlong wrote: In the first list_for_each_entry() macro of dma_async_device_register, it gets the chan from list and calls __dma_async_device_channel_register (..,chan). We can see that chan->local is allocated by alloc_percpu() and it is freed chan->local by free_percp

Re: [PATCH v5 05/14] vfio/mdev: idxd: add basic mdev registration and helper functions

2021-03-01 Thread Dave Jiang
On 3/1/2021 5:29 PM, Jason Gunthorpe wrote: On Mon, Mar 01, 2021 at 05:23:47PM -0700, Dave Jiang wrote: So after looking at the code in vfio_pci_intrs.c, I agree that the set_irqs code between VFIO_PCI and this driver can be made in common. Given that Alex doesn't want a vfio_pci d

Re: [PATCH v5 05/14] vfio/mdev: idxd: add basic mdev registration and helper functions

2021-03-01 Thread Dave Jiang
On 2/10/2021 4:59 PM, Jason Gunthorpe wrote: On Fri, Feb 05, 2021 at 01:53:24PM -0700, Dave Jiang wrote: <-- cut for brevity --> +static int vdcm_idxd_set_msix_trigger(struct vdcm_idxd *vidxd, + unsigned int index, unsigned int

Re: [PATCH v5 05/14] vfio/mdev: idxd: add basic mdev registration and helper functions

2021-02-16 Thread Dave Jiang
On 2/10/2021 4:59 PM, Jason Gunthorpe wrote: On Fri, Feb 05, 2021 at 01:53:24PM -0700, Dave Jiang wrote: +static int check_vma(struct idxd_wq *wq, struct vm_area_struct *vma) { - /* FIXME: Fill in later */ + if (vma->vm_end < vma->vm_start) + retur

Re: [PATCH v5 04/14] vfio/mdev: idxd: Add auxialary device plumbing for idxd mdev support

2021-02-12 Thread Dave Jiang
On 2/10/2021 4:46 PM, Jason Gunthorpe wrote: On Fri, Feb 05, 2021 at 01:53:18PM -0700, Dave Jiang wrote: diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h index a2438b3166db..f02c96164515 100644 +++ b/drivers/dma/idxd/idxd.h @@ -8,6 +8,7 @@ #include #include #include

[PATCH] driver core: auxiliary bus: Remove unneeded module bits

2021-02-11 Thread Dave Jiang
Remove module bits in the auxiliary bus code since the auxiliary bus cannot be built as a module and the relevant code is not needed. Cc: Dave Ertman Suggested-by: Greg Kroah-Hartman Signed-off-by: Dave Jiang --- drivers/base/auxiliary.c |5 - 1 file changed, 5 deletions(-) diff

  1   2   3   4   5   >