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] x86/sgx: Replace kmalloc() + copy_from_user() with memdup_user()

2025-09-25 Thread Dave Hansen
On 9/22/25 06:18, Thorsten Blum wrote: >> The kernel config and materials to reproduce are available at: >> https://download.01.org/0day-ci/archive/20250921/202509211747.1edb60f- >> l...@intel.com > Can someone explain why this test is failing? > > After some digging into SGX, I think it's the dif

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 <http://pdev.dev>, NUM_DCR, > -  

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 v15 0/5] Enable automatic SVN updates for SGX enclaves

2025-09-05 Thread Dave Hansen
On 8/18/25 00:11, Elena Reshetova wrote: > Testing > --- > > Tested on EMR machine using kernel 6.17.0_rc1 & sgx selftests. > Also tested on a Kaby Lake machine without EUPDATESVN support. > If Google folks in CC can test on their side, it would be greatly > appreciated. Yeah, lots of @google

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] x86/sgx: Use guard() instead of mutex_lock() to simplify code

2025-09-02 Thread Dave Hansen
On 9/1/25 06:22, Liao Yuanhong wrote: > Using guard(mutex) instead of mutex_lock/mutex_unlock pair. Simplifies the > error handling to just return in case of error. No need for the 'err_out' > label anymore so remove it. I don't plan on applying patches like this. Yes, they marginally simplify the

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: [syzbot] [x86?] BUG: soft lockup in xfrm_timer_handler

2025-08-19 Thread Dave Hansen
On 8/18/25 00:59, syzbot wrote: > Call Trace: > ... > spin_lock include/linux/spinlock.h:351 [inline] > __xfrm_state_delete+0xba/0xca0 net/xfrm/xfrm_state.c:818 > xfrm_timer_handler+0x18f/0xa00 net/xfrm/xfrm_state.c:716 > __run_hrtimer kernel/time/hrtimer.c:1761 [inline] > __hrtimer_run_queu

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 v14 5/5] x86/sgx: Enable automatic SVN updates for SGX enclaves

2025-08-14 Thread Dave Hansen
On 8/14/25 00:34, Elena Reshetova wrote: > +/* Mutex to ensure no concurrent EPC accesses during EUPDATESVN */ > +static DEFINE_MUTEX(sgx_svn_lock); > + > int sgx_inc_usage_count(void) > { > + int ret; > + > + guard(mutex)(&sgx_svn_lock); > + > + if (!sgx_usage_count) { > +

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

2025-08-12 Thread Dave Jiang
mailbox >> commands to access the LSA area. nvdimm driver is using same commands to >> get/set LSA data. >> > > Hi Jonathan, Dave and Ira > > I have addressed the review comments of V1 patch-set and sent out this > V2 Patch-set. > 0-Day Kernel Test bot has rep

Re: [PATCH v11 4/5] x86/sgx: Implement ENCLS[EUPDATESVN]

2025-08-08 Thread Dave Hansen
On 8/8/25 03:59, Reshetova, Elena wrote: >> I am not sure whether this is needed. Wouldn't the ENCLS_WARN() at the >> end catch this case and the user is able to figure out what went wrong >> from the error code? > Dave has made a suggestion to include this check, so

Re: [PATCH v10 4/6] x86/sgx: Define error codes for use by ENCLS[EUPDATESVN]

2025-08-04 Thread Dave Hansen
On 8/4/25 00:21, Reshetova, Elena wrote: ... >>> + EUPDATESVN = 0x18, >>> }; >> >> This update is not consistent with the changelog nor the patch subject. > > I can remove the alignment fix. It's not the alignment. It's the definition of EUPDATESVN that goes completely unmentioned. ..

Re: [PATCH v10 5/6] x86/sgx: Implement ENCLS[EUPDATESVN]

2025-08-01 Thread Dave Hansen
The changelog is missing a tidbit about the fact that this is still dead code until sgx_inc_usage_count() gets a real implementation. On 8/1/25 04:25, Elena Reshetova wrote: ... > +/** > + * sgx_update_svn() - Attempt to call ENCLS[EUPDATESVN]. > + * This instruction attempts to update CPUSVN to t

Re: [PATCH v10 4/6] x86/sgx: Define error codes for use by ENCLS[EUPDATESVN]

2025-08-01 Thread Dave Hansen
On 8/1/25 04:25, Elena Reshetova wrote: > Add error codes for ENCLS[EUPDATESVN], then SGX CPUSVN update > process can know the execution state of EUPDATESVN and notify > userspace. > > Signed-off-by: Elena Reshetova > --- > arch/x86/include/asm/sgx.h | 37 ++--- >

Re: [PATCH v10 3/6] x86/cpufeatures: Add X86_FEATURE_SGX_EUPDATESVN feature flag

2025-08-01 Thread Dave Hansen
On 8/1/25 04:25, Elena Reshetova wrote: > Add a flag indicating whenever ENCLS[EUPDATESVN] SGX instruction > is supported. This will be used by SGX driver to perform CPU > SVN updates. > > Signed-off-by: Elena Reshetova Reviewed-by: Dave Hansen

Re: [PATCH v10 2/6] x86/sgx: Introduce functions to count the sgx_(vepc_)open()

2025-08-01 Thread Dave Hansen
On 8/1/25 04:25, Elena Reshetova wrote: > Note: the sgx_inc_usage_count prototype is defined to return > int for the cleanliness of the follow-up patches. When the > EUPDATESVN SGX instruction will be enabled in the follow-up patch, > the sgx_inc_usage_count will start to return int. Please use pa

Re: [PATCH v10 1/6] x86/sgx: Convert sgx_(vepc_)open to __sgx_(vepc_)open

2025-08-01 Thread Dave Hansen
On 8/1/25 04:25, Elena Reshetova wrote: > In order to introduce the counting of active sgx users on top > of clean functions that allocate vepc structures, covert existing > sgx_(vepc_)open to __sgx_(vepc_)open. Later patch will introduce the > top level wrappers that manage the usage count. > > N

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 v8 1/5] x86/sgx: Introduce a counter to count the sgx_(vepc_)open()

2025-07-21 Thread Dave Hansen
On 7/15/25 05:40, Elena Reshetova wrote: > +int sgx_inc_usage_count(void) > +{ > + sgx_usage_count++; > + return 0; > +} > + > +void sgx_dec_usage_count(void) > +{ > + sgx_usage_count--; > +} Gah. I know this gets fixed up later in the series with the mutex, but this code is broken an

Re: [PATCH v8 5/5] x86/sgx: Enable automatic SVN updates for SGX enclaves

2025-07-21 Thread Dave Hansen
On 7/19/25 04:22, Jarkko Sakkinen wrote: > On Tue, Jul 15, 2025 at 03:40:22PM +0300, Elena Reshetova wrote: >> -static int __maybe_unused sgx_update_svn(void) >> +static int sgx_update_svn(void) > I'd combine 4/5 and 5/5 because of this. Makes them so much easier to > backtrack changes later on if

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: [PATCH v7 5/5] x86/sgx: Enable automatic SVN updates for SGX enclaves

2025-07-14 Thread Dave Hansen
On 7/14/25 06:54, Dave Hansen wrote: > On 7/14/25 00:35, Reshetova, Elena wrote: >> I think you put it: this would require a spinlock in the fast path and >> *in theory* if we are running many many concurrent enclaves can create >> contention > FWIW, my mental model is

Re: [PATCH v7 5/5] x86/sgx: Enable automatic SVN updates for SGX enclaves

2025-07-14 Thread Dave Hansen
On 7/14/25 00:35, Reshetova, Elena wrote: > I think you put it: this would require a spinlock in the fast path and > *in theory* if we are running many many concurrent enclaves can create > contention FWIW, my mental model is that spinlocks that are held for short periods of time are pretty much

Re: [PATCH v7 5/5] x86/sgx: Enable automatic SVN updates for SGX enclaves

2025-07-11 Thread Dave Hansen
On 7/11/25 09:50, Elena Reshetova wrote: > == Background == > > ENCLS[EUPDATESVN] is a new SGX instruction [1] which allows enclave > attestation to include information about updated microcode SVN without a > reboot. Before an EUPDATESVN operation can be successful, all SGX memory > (aka. EPC) mus

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

[PATCH 13/23] openrisc: ptrace: Use USER_REGSET_NOTE_TYPE() to specify regset note names

2025-07-01 Thread Dave Martin
Instead of having the core code guess the note name for each regset, use USER_REGSET_NOTE_TYPE() to pick the correct name from elf.h. Signed-off-by: Dave Martin Cc: Jonas Bonn Cc: Stefan Kristiansson Cc: Stafford Horne Cc: Oleg Nesterov Cc: Kees Cook Cc: Akihiko Odaki Cc: linux-openr

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] x86/sgx: Use ENCLS mnemonic in

2025-06-17 Thread Dave Hansen
On 6/17/25 07:44, Jarkko Sakkinen wrote: > I don't really see how this is that useful. That said, f a bug fix or > feature used encls mnemonic, I'd had no problems with acking it. It's not _that_ useful. But old assemblers that we still want to use *NEVER* have support for newfanlged instructions

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 v6 1/5] x86/sgx: Introduce a counter to count the sgx_(vepc_)open()

2025-05-23 Thread Dave Hansen
On 5/23/25 08:54, Jarkko Sakkinen wrote: >> +void sgx_dec_usage_count(void) >> +{ >> +atomic64_dec(&sgx_usage_count); >> +} > I think these both should be static inlines in arch/x86/kernel/cpu/sgx.h. > Global symbols is over the top. Even if I think disassembly (when doing > debugging, bug hunt

Re: [PATCH v5 4/5] x86/sgx: Implement ENCLS[EUPDATESVN]

2025-05-20 Thread Dave Hansen
On 5/20/25 12:57, Jarkko Sakkinen wrote: > unlikely() is both (minor) optimization and documents that it is not expected > branch so it obviously makes sense here. I'm not a big fan of unlikely() being thrown in without specific reasons. I don't think we need an annotation to tell us that the path

Re: [PATCH v5 4/5] x86/sgx: Implement ENCLS[EUPDATESVN]

2025-05-19 Thread Dave Hansen
On 5/19/25 00:24, Elena Reshetova wrote: > The SGX attestation architecture assumes a compromise > of all running enclaves and cryptographic assets > (like internal SGX encryption keys) whenever a microcode > update affects SGX. To mitigate the impact of this presumed > compromise, a new supervisor

Re: [PATCH v2] x86/sgx: Prevent attempts to reclaim poisoned pages

2025-05-15 Thread Dave Hansen
that it _knows_ are poisoned. Avoid even trying to reclaim poisoned pages. But otherwise it looks great: Acked-by: Dave Hansen

Re: [PATCH v4 1/1] x86/sgx: Enable automatic SVN updates for SGX enclaves

2025-05-15 Thread Dave Hansen
On 5/14/25 00:32, Reshetova, Elena wrote: >> This was the recent discussion I am aware we had on this matter: >> https://lkml.org/lkml/2024/2/5/1595 >> The measurements were done for older platform (skylake), but I am not >> aware of any architectural changes since that time to improve this. > And

Re: [PATCH v4 1/1] x86/sgx: Enable automatic SVN updates for SGX enclaves

2025-05-08 Thread Dave Hansen
On 5/8/25 07:07, Reshetova, Elena wrote: ... >> Actually, I think I wrote changelogs for this once upon a time. Could >> you please go dig those up and use them? > > Could you please suggest where can I find them? Was it for the previous > submission done by Cathy? Yes. There were also some long

Re: [PATCH v4 1/1] x86/sgx: Enable automatic SVN updates for SGX enclaves

2025-05-07 Thread Dave Hansen
On 5/7/25 04:14, Elena Reshetova wrote: > In case an SGX vulnerability is discovered and TCB recovery > for SGX is triggered, Intel specifies a process that must be > followed for a given vulnerability. Steps to mitigate can vary > based on vulnerability type, affected components, etc. > In some ca

Re: [PATCH v3 2/2] x86/sgx: Implement EUPDATESVN and opportunistically call it during first EPC page alloc

2025-04-29 Thread Dave Hansen
On 4/29/25 04:44, Reshetova, Elena wrote: >> On 4/25/25 14:58, Sean Christopherson wrote: >>> On Fri, Apr 25, 2025, Dave Hansen wrote: >>>> On 4/25/25 14:04, Sean Christopherson wrote: >>>>> Userspace is going to be waiting on ->release() no matter wh

Re: [PATCH v3 2/2] x86/sgx: Implement EUPDATESVN and opportunistically call it during first EPC page alloc

2025-04-25 Thread Dave Hansen
On 4/25/25 14:58, Sean Christopherson wrote: > On Fri, Apr 25, 2025, Dave Hansen wrote: >> On 4/25/25 14:04, Sean Christopherson wrote: >>> Userspace is going to be waiting on ->release() no matter what. >> Unless it isn't even involved and it happens automatica

Re: [PATCH v3 2/2] x86/sgx: Implement EUPDATESVN and opportunistically call it during first EPC page alloc

2025-04-25 Thread Dave Hansen
On 4/25/25 14:04, Sean Christopherson wrote: > Userspace is going to be waiting on ->release() no matter what. Unless it isn't even involved and it happens automatically.

Re: [PATCH v3 2/2] x86/sgx: Implement EUPDATESVN and opportunistically call it during first EPC page alloc

2025-04-25 Thread Dave Hansen
On 4/25/25 12:29, Sean Christopherson wrote: > --- a/arch/x86/kernel/cpu/sgx/virt.c > +++ b/arch/x86/kernel/cpu/sgx/virt.c > @@ -255,6 +255,7 @@ static int sgx_vepc_release(struct inode *inode, struct > file *file) > xa_destroy(&vepc->page_array); > kfree(vepc); > > + sgx_dec_usa

Re: [PATCH v3 2/2] x86/sgx: Implement EUPDATESVN and opportunistically call it during first EPC page alloc

2025-04-25 Thread Dave Hansen
On 4/25/25 10:40, Sean Christopherson wrote: > So then why on earth is the kernel implementing automatic updates? Because it's literally the least amount of code and doesn't create any new ABI. > I read back through most of the cover letters, and IIUC, we went > straight from "destroy all enclave

Re: [PATCH] selftests/sgx: Fix an enclave built with extended instructions

2025-04-09 Thread Dave Hansen
On 4/9/25 09:55, Vladis Dronov wrote: ... > Fix this by adding "-mno-avx" to ENCL_CFLAGS in Makefile. Add some comments > about this to code locations where enclave's xfrm field is set. > > Suggested-by: Dave Hansen > Signed-off-by: Vladis Dronov First of all, th

Re: [PATCH] arch/x86: Fix size overflows in sgx_encl_create()

2025-03-04 Thread Dave Hansen
On 3/4/25 14:56, Jarkko Sakkinen wrote: > The total size calculated for EPC can overflow u64 given the added up page > for SECS. Further, the total size calculated for shmem can overflow even > when the EPC size stays within limits of u64, given that it adds the extra > space for 128 byte PCMD str

Re: [PATCH V5 2/4] x86/tdx: Route safe halt execution via tdx_safe_halt()

2025-02-20 Thread Dave Hansen
On 2/20/25 13:16, Vishal Annapurve wrote: > Direct HLT instruction execution causes #VEs for TDX VMs which is routed > to hypervisor via TDCALL. safe_halt() routines execute HLT in STI-shadow > so IRQs need to remain disabled until the TDCALL to ensure that pending > IRQs are correctly treated as w

Re: [PATCH V5 1/4] x86/paravirt: Move halt paravirt calls under CONFIG_PARAVIRT

2025-02-20 Thread Dave Hansen
On 2/20/25 13:16, Vishal Annapurve wrote: > Since enabling CONFIG_PARAVIRT_XXL is too bloated for TDX guest > like platforms, move HLT and SAFE_HLT paravirt calls under > CONFIG_PARAVIRT. I guess it's just one patch, but doesn't this expose CONFIG_PARAVIRT=y users to what _was_ specific to CONFIG_

Re: [PATCH v2 6/6] selftests/mm: remove local __NR_* definitions

2025-02-13 Thread Dave Hansen
On 2/13/25 00:04, John Hubbard wrote: > > 2) I'm unable to reproduce what you saw, because in ALL cases (before > or after the commit, and with or without a revert), I get the same > results on my Intel test machine: > >     $ ./protection_keys_64 >     has pkeys: 0 >     running PKEY tests for u

Re: [PATCH v2 6/6] selftests/mm: remove local __NR_* definitions

2025-02-12 Thread Dave Hansen
Hi John, On 6/13/24 19:30, John Hubbard wrote: > --- a/tools/testing/selftests/mm/protection_keys.c > +++ b/tools/testing/selftests/mm/protection_keys.c > @@ -42,7 +42,7 @@ > #include > #include > #include > -#include > +#include > #include > #include I'm not quite sure how but this b

Re: [PATCH] x86: sgx: Don't track poisoned pages for reclaiming

2025-02-11 Thread Dave Hansen
On 2/11/25 16:32, andrzej zaborowski wrote: >> Actually, now that I think about it even more, why would ETRACK or >> EBLOCK access the page itself? They seem superficially like they'd be >> metadata-only too. > I haven't seen a crash in either of these (always in EWB), I didn't > want to imply that

Re: [PATCH] x86: sgx: Don't track poisoned pages for reclaiming

2025-02-11 Thread Dave Hansen
On 2/11/25 13:18, Huang, Kai wrote: >>> This requires low-level SGX implementation knowledge to fully >>> understand. Both what "ETRACK, EBLOCK and EWB" are in the first place, >>> how they are involved in reclaim and also why EREMOVE doesn't lead to >>> the same fate. >> >> Does it? [I'll dig up I

Re: [PATCH] x86: sgx: Don't track poisoned pages for reclaiming

2025-02-11 Thread Dave Hansen
I don't expect everyone to know the rules of every little part of the kernel. But, it's really easy to see a pattern with: git log arch/x86/kernel/cpu/sgx/ That usually works for every little nook and cranny of the kernel and will show you what the subject rules are. Could you do that fo

Re: [PATCH v5 1/3] selftests/lam: Move cpu_has_la57() to use cpuinfo flag

2025-01-24 Thread Dave Hansen
On 1/24/25 12:17, Maciej Wieczor-Retman wrote: >> Could you poke around and see if there is any existing ABI that we can >> use to query LA57 support? Maybe one of the things KVM exports, or some >> TASK_SIZE_MAX comparisons? > Sure, I'll try to find some other way. > > My previous tactic was to m

Re: [PATCH v5 3/3] selftests/lam: Test get_user() LAM pointer handling

2025-01-24 Thread Dave Hansen
On 11/27/24 09:35, Maciej Wieczor-Retman wrote: ... > + switch (test->later) { > + case GET_USER_USER: > + /* Control group - properly tagger user pointer */ > + ptr = (void *)set_metadata((uint64_t)ptr, test->lam); > + break; s/tagger/tagged/ ? > +

Re: [PATCH v5 2/3] selftests/lam: Skip test if LAM is disabled

2025-01-24 Thread Dave Hansen
On 11/27/24 09:35, Maciej Wieczor-Retman wrote: > +static inline int kernel_has_lam(void) > +{ > + unsigned long bits; > + > + syscall(SYS_arch_prctl, ARCH_GET_MAX_TAG_BITS, &bits); > + return !!bits; > +} Generally, I'm less picky about selftest/ code than in-kernel code. But people r

Re: [PATCH v5 1/3] selftests/lam: Move cpu_has_la57() to use cpuinfo flag

2025-01-24 Thread Dave Hansen
On 11/27/24 09:35, Maciej Wieczor-Retman wrote: > -/* Check 5-level page table feature in CPUID.(EAX=07H, ECX=00H):ECX.[bit 16] > */ > static inline int cpu_has_la57(void) > { > - unsigned int cpuinfo[4]; > - > - __cpuid_count(0x7, 0, cpuinfo[0], cpuinfo[1], cpuinfo[2], cpuinfo[3]); > -

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] dax: Allow block size > PAGE_SIZE

2024-11-04 Thread Dave Chinner
VMM will satisfy by mmapping 128 16K pages from its page cache (at > arbitrary physical memory addresses) into guest "physical" memory as one > contiguous block. Then the guest will see the whole 2MiB mapping as > contiguous, even though it isn't in physical RAM, a

Re: [PATCH 08/13] media: i2c: imx214: Add vblank and hblank controls

2024-10-14 Thread Dave Stevenson
Hi André On Sat, 12 Oct 2024 at 22:46, André Apitzsch wrote: > > Hi Dave, > > Am Montag, dem 07.10.2024 um 18:29 +0100 schrieb Dave Stevenson: > > Hi Andre > > > > On Sun, 6 Oct 2024 at 22:41, André wrote: > > > > > > Hi Dave, > > > >

Re: [PATCH 08/13] media: i2c: imx214: Add vblank and hblank controls

2024-10-07 Thread Dave Stevenson
Hi Andre On Sun, 6 Oct 2024 at 22:41, André wrote: > > Hi Dave, > > Am Freitag, dem 13.09.2024 um 18:40 +0100 schrieb Dave Stevenson: > > On Thu, 12 Sept 2024 at 15:51, Dave Stevenson > > wrote: > > > > > > Hi André & Ricardo > > > >

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 08/13] media: i2c: imx214: Add vblank and hblank controls

2024-09-13 Thread Dave Stevenson
On Thu, 12 Sept 2024 at 15:51, Dave Stevenson wrote: > > Hi André & Ricardo > > On Thu, 12 Sept 2024 at 14:41, Ricardo Ribalda Delgado > wrote: > > > > Hi > > > > Arent you missing some chage in enum_frame_interval? > > Raw sensors shouldn't

  1   2   3   4   5   6   7   8   9   10   >