Re: [PATCH v3 2/2] x86/sgx: Resolve EREMOVE page vs EAUG page data race

2024-05-28 Thread Dave Hansen
On 5/17/24 04:06, Dmitrii Kuvaiskii wrote: ... First, why is SGX so special here? How is the SGX problem different than what the core mm code does? > --- a/arch/x86/kernel/cpu/sgx/encl.h > +++ b/arch/x86/kernel/cpu/sgx/encl.h > @@ -25,6 +25,9 @@ > /* 'desc' bit marking that the page is being

Re: [PATCH v3 0/2] x86/sgx: Fix two data races in EAUG/EREMOVE flows

2024-05-28 Thread Dave Hansen
On 5/17/24 04:06, Dmitrii Kuvaiskii wrote: > We wrote a trivial stress test to reproduce the hangs observed in > real-world applications. The test stresses #PF-based page allocation and > SGX_IOC_ENCLAVE_REMOVE_PAGES flows in the SGX driver: This seems like something we'd want in the kernel SGX

Re: [RFC PATCH 00/20] Introduce the famfs shared-memory file system

2024-05-25 Thread Dave Chinner
em). I think you need to do some ndctl magic to get the memory to be namespaced correctly for the correct devices to appear. https://docs.pmem.io/ndctl-user-guide/managing-namespaces IIRC, need to set the type to pmem and the mode to fsdax, devdax or raw to get the relevant device nodes to be created for the range.. Cheers, Dave. -- Dave Chinner da...@fromorbit.com

Re: [PATCH] x86/paravirt: Disable virt spinlock when CONFIG_PARAVIRT_SPINLOCKS disabled

2024-05-23 Thread Dave Hansen
On 5/23/24 11:39, Jürgen Groß wrote: >> >> Let's just keep it simple.  How about the attached patch? > > Simple indeed. The attachment is empty.  Let's try this again.diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c index 5358d43886ad..c193c9e60a1b 100644 ---

Re: [PATCH] x86/paravirt: Disable virt spinlock when CONFIG_PARAVIRT_SPINLOCKS disabled

2024-05-23 Thread Dave Hansen
On 5/16/24 06:02, Chen Yu wrote: > Performance drop is reported when running encode/decode workload and > BenchSEE cache sub-workload. > Bisect points to commit ce0a1b608bfc ("x86/paravirt: Silence unused > native_pv_lock_init() function warning"). When CONFIG_PARAVIRT_SPINLOCKS > is disabled the

Re: [PATCH v2 1/2] x86/sgx: Resolve EAUG race where losing thread returns SIGBUS

2024-05-15 Thread Dave Hansen
On 5/15/24 06:54, Jarkko Sakkinen wrote: > I'd cut out 90% of the description out and just make the argument of > the wrong error code, and done. The sequence is great for showing > how this could happen. The prose makes my head hurt tbh. The changelog is too long, but not fatally so. I'd much

Re: [PATCH 1/1] x86/vector: Fix vector leak during CPU offline

2024-05-10 Thread Dave Hansen
On 5/10/24 12:06, Dongli Zhang wrote: > } else { > + /* > + * This call borrows from the comments and implementation > + * of apic_update_vector(): "If the target CPU is offline > + * then the regular release mechanism via the cleanup > +

Re: [RFC PATCH v2 1/1] x86/sgx: Explicitly give up the CPU in EDMM's ioctl() to avoid softlockup

2024-04-26 Thread Dave Hansen
On 4/26/24 07:18, Bojun Zhu wrote: > for (c = 0 ; c < modp->length; c += PAGE_SIZE) { > + if (sgx_check_signal_and_resched()) { > + if (!c) > + ret = -ERESTARTSYS; > + > + goto out; > + } This

Re: [PATCH v12 14/14] selftests/sgx: Add scripts for EPC cgroup testing

2024-04-26 Thread Dave Hansen
On 4/16/24 07:15, Jarkko Sakkinen wrote: > On Tue Apr 16, 2024 at 8:42 AM EEST, Huang, Kai wrote: > Yes, exactly. I'd take one week break and cycle the kselftest part > internally a bit as I said my previous response. I'm sure that there > is experise inside Intel how to implement it properly.

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 797e1ebff299..

Re: [PATCH v9 15/15] selftests/sgx: Add scripts for EPC cgroup testing

2024-04-02 Thread Dave Hansen
On 3/30/24 04:23, Jarkko Sakkinen wrote: >>> I also wonder is cgroup-tools dependency absolutely required or could >>> you just have a function that would interact with sysfs? >> I should have checked email before hit the send button for v10 . >> >> It'd be more complicated and less readable to

[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

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 v9 10/15] x86/sgx: Add EPC reclamation in cgroup try_charge()

2024-02-26 Thread Dave Hansen
On 2/26/24 14:34, Huang, Kai wrote: > So I am trying to get the actual downside of doing per-cgroup reclaim or > the full reason that we choose global reclaim. Take the most extreme example: while (hit_global_sgx_limit()) reclaim_from_this(cgroup); You eventually end up

Re: [PATCH v9 10/15] x86/sgx: Add EPC reclamation in cgroup try_charge()

2024-02-26 Thread Dave Hansen
On 2/26/24 14:24, Huang, Kai wrote: > What is the downside of doing per-group reclaim when try_charge() > succeeds for the enclave but failed to allocate EPC page? > > Could you give an complete answer why you choose to use global reclaim > for the above case? There are literally two different

Re: [PATCH v9 10/15] x86/sgx: Add EPC reclamation in cgroup try_charge()

2024-02-26 Thread Dave Hansen
On 2/26/24 13:48, Haitao Huang wrote: > In case of overcomitting, i.e., sum of limits greater than the EPC > capacity, if one group has a fault, and its usage is not above its own > limit (try_charge() passes), yet total usage of the system has exceeded > the capacity, whether we do global reclaim

Re: [PATCH v9 10/15] x86/sgx: Add EPC reclamation in cgroup try_charge()

2024-02-26 Thread Dave Hansen
On 2/26/24 03:36, Huang, Kai wrote: >> In case of overcomitting, even if we always reclaim from the same cgroup >> for each fault, one group may still interfere the other: e.g., consider an >> extreme case in that group A used up almost all EPC at the time group B >> has a fault, B has to

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: [RFC PATCH] x86/sgx: Remove 'reclaim' boolean parameters

2024-02-19 Thread Dave Hansen
On 2/19/24 07:39, Haitao Huang wrote: > Remove all boolean parameters for 'reclaim' from the function > sgx_alloc_epc_page() and its callers by making two versions of each > function. > > Also opportunistically remove non-static declaration of > __sgx_alloc_epc_page() and a typo > >

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-16 Thread Dave Hansen
On 2/16/24 13:38, Haitao Huang wrote: > On Fri, 16 Feb 2024 09:15:59 -0600, Dave Hansen > wrote: ... >> Does this 'indirect' change any behavior other than whether it does a >> search for an mm to find a place to charge the backing storage? > > No. > >> Inst

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-16 Thread Dave Hansen
On 2/5/24 13:06, Haitao Huang wrote: > @@ -414,7 +416,7 @@ static void sgx_reclaim_pages_global(void) > void sgx_reclaim_direct(void) > { > if (sgx_should_reclaim(SGX_NR_LOW_PAGES)) > - sgx_reclaim_pages_global(); > + sgx_reclaim_pages_global(false); > } > >

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-15 Thread Dave Hansen
On 2/5/24 13:06, Haitao Huang wrote: > static struct mem_cgroup *sgx_encl_get_mem_cgroup(struct sgx_encl *encl) > { > @@ -1003,14 +1001,6 @@ static struct mem_cgroup > *sgx_encl_get_mem_cgroup(struct sgx_encl *encl) > struct sgx_encl_mm *encl_mm; > int idx; > > - /* > - *

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 >

Re: [RFC PATCH v2 7/8] Introduce dcache_is_aliasing() across all architectures

2024-01-31 Thread Dave Chinner
On Wed, Jan 31, 2024 at 09:58:21AM -0500, Mathieu Desnoyers wrote: > On 2024-01-30 21:48, Dave Chinner wrote: > > On Tue, Jan 30, 2024 at 11:52:54AM -0500, Mathieu Desnoyers wrote: > > > Introduce a generic way to query whether the dcache is virtually aliased > > >

Re: [RFC PATCH v2 8/8] dax: Fix incorrect list of dcache aliasing architectures

2024-01-30 Thread Dave Chinner
) > Signed-off-by: Mathieu Desnoyers > Cc: Andrew Morton > Cc: Linus Torvalds > Cc: linux...@kvack.org > Cc: linux-a...@vger.kernel.org > Cc: Dan Williams > Cc: Vishal Verma > Cc: Dave Jiang > Cc: Matthew Wilcox > Cc: Arnd Bergmann > Cc: Russell King > C

Re: [RFC PATCH v2 7/8] Introduce dcache_is_aliasing() across all architectures

2024-01-30 Thread Dave Chinner
tions with the VFS dentry cache aliasing when we read this code? Something like cpu_dcache_is_aliased(), perhaps? -Dave. -- Dave Chinner da...@fromorbit.com

Re: [RFC PATCH v2 1/8] dax: Introduce dax_is_supported()

2024-01-30 Thread Dave Chinner
detect > dcache aliasing at runtime. > > Fixes: d92576f1167c ("dax: does not work correctly with virtual aliasing > caches") > Signed-off-by: Mathieu Desnoyers > Cc: Andrew Morton > Cc: Linus Torvalds > Cc: linux...@kvack.org > Cc: linux-a...@vger.kernel.org >

Re: [RFC PATCH 7/7] xfs: Use dax_is_supported()

2024-01-29 Thread Dave Chinner
bu R > Cc: Darrick J. Wong > Cc: linux-...@vger.kernel.org > Cc: Andrew Morton > Cc: Linus Torvalds > Cc: linux...@kvack.org > Cc: linux-a...@vger.kernel.org > Cc: Dan Williams > Cc: Vishal Verma > Cc: Dave Jiang > Cc: Matthew Wilcox > Cc: nvd...@lists.l

Re: [PATCH v6 00/12] Add Cgroup support for SGX EPC memory

2024-01-05 Thread Dave Hansen
There's very little about how the LRU design came to be in this cover letter. Let's add some details. How's this? Writing this up, I'm a lot more convinced that this series is, in general, taking the right approach. I honestly don't see any other alternatives. As much as I'd love to do

Re: [PATCH v6 07/12] x86/sgx: Introduce EPC page states

2024-01-05 Thread Dave Hansen
On 10/30/23 11:20, Haitao Huang wrote: > @@ -527,16 +530,13 @@ void sgx_mark_page_reclaimable(struct sgx_epc_page > *page) > int sgx_unmark_page_reclaimable(struct sgx_epc_page *page) > { > spin_lock(_global_lru.lock); > - if (page->flags & SGX_EPC_PAGE_RECLAIMER_TRACKED) { > -

Re: [PATCH v6 09/12] x86/sgx: Restructure top-level EPC reclaim function

2024-01-04 Thread Dave Hansen
On 1/4/24 11:11, Haitao Huang wrote: > If those are OK with users and also make it acceptable for merge > quickly, I'm happy to do that  How about we put some actual numbers behind this? How much complexity are we talking about here? What's the diffstat for the utterly bare-bones

Re: [PATCH v6 09/12] x86/sgx: Restructure top-level EPC reclaim function

2024-01-03 Thread Dave Hansen
On 12/18/23 13:24, Haitao Huang wrote:> @Dave and @Michal, Your thoughts? Or could you confirm we should not > do reclaim per cgroup at all? What's the benefit of doing reclaim per cgroup? Is that worth the extra complexity? The key question here is whether we want the SGX VM to be c

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 > --- > >

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

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

Re: [PATCH v7 00/13] selftests/sgx: Fix compilation errors

2023-11-08 Thread Dave Hansen
On 11/8/23 12:31, Jo Van Bulck wrote: > Just a kind follow-up: from what I can see, this series has not been > merged into the x86/sgx branch of tip yet (assuming that's where it > should go next)? > > Apologies if I've overlooked anything, and please let me know if there's > something on my end

Re: [PATCH v5 12/18] x86/sgx: Add EPC OOM path to forcefully reclaim EPC

2023-10-18 Thread Dave Hansen
On 10/18/23 08:26, Haitao Huang wrote: > Maybe not in sense of killing something. My understanding memory.reclaim > does not necessarily invoke the OOM killer. But what I really intend to > say is we can have a separate knob for user to express the need for > reducing the current usage explicitly

Re: [PATCH v5 12/18] x86/sgx: Add EPC OOM path to forcefully reclaim EPC

2023-10-18 Thread Dave Hansen
On 10/17/23 21:37, Haitao Huang wrote: > Yes we can introduce misc.reclaim to give user a knob to forcefully > reducing usage if that is really needed in real usage. The semantics > would make force-kill VMs explicit to user. Do any other controllers do something like this? It seems odd.

[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

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 v6] x86/sgx: Resolves SECS reclaim vs. page fault for EAUG race

2023-09-28 Thread Dave Hansen
On 9/28/23 16:08, Reinette Chatre wrote: > I'd like to check in on the status of this patch. This two month old > patch looks to be a needed fix and has Jarkko and Kai's review tags, > but I am not able to find it queued or merged in tip or upstream. > Apologies if I did not look in the right

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

2023-09-26 Thread Dave Jiang
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 Wilczynski Reviewed

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 v4 03/18] x86/sgx: Add sgx_epc_lru_lists to encapsulate LRU lists

2023-09-14 Thread Dave Hansen
On 9/14/23 03:31, Huang, Kai wrote: >> Signed-off-by: Haitao Huang >> Cc: Sean Christopherson > You don't need 'Cc:' Sean if the patch has Sean's SoB. It is a SoB for Sean's @intel address and cc's his @google address. It is fine.

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] x86/tdx: refactor deprecated strncpy

2023-09-11 Thread Dave Hansen
On 9/11/23 11:27, Justin Stitt wrote: > `strncpy` is deprecated and we should prefer more robust string apis. I dunno. It actually seems like a pretty good fit here. > In this case, `message.str` is not expected to be NUL-terminated as it > is simply a buffer of characters residing in a union

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

[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

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

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' memory pointed by the fie

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

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

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

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/dimm_devs.c

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 Reviewed-by:

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

2023-05-22 Thread Dave Jiang
' [-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/nvdimm/test/nfit_test.h | 29

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: Dave Jiang

Re: [PATCH v9 3/3] mm, pmem, xfs: Introduce MF_MEM_REMOVE for unbind

2023-02-05 Thread Dave Chinner
irtying the journal/metadata. Both sync_filesystem() and super_drop_pagecache() operate on current state - they don't prevent future dax mapping instantiation or dirtying from happening on the device, so they don't prevent this... Cheers, Dave. -- Dave Chinner da...@fromorbit.com

Re: [PATCH v4] memregion: Add cpu_cache_invalidate_memregion() interface

2022-10-27 Thread Dave Hansen
s or negative error code on a failure to perform > + * the cache maintenance. > + */ WBINVD is a scary beast. But, there's also no better alternative in the architecture. I don't think any of my comments above are deal breakers, so from the x86 side: Acked-by: Dave Hansen

Re: [RFC PATCH] xfs: drop experimental warning for fsdax

2022-09-27 Thread Dave Chinner
On Tue, Sep 27, 2022 at 09:02:48AM -0700, Darrick J. Wong wrote: > On Tue, Sep 27, 2022 at 02:53:14PM +0800, Shiyang Ruan wrote: > > > > > > 在 2022/9/20 5:15, Dave Chinner 写道: > > > On Mon, Sep 19, 2022 at 02:50:03PM +1000, Dave Chinner wrote: > > > >

Re: [PATCH 3/3] mm, pmem, xfs: Introduce MF_MEM_REMOVE for unbind

2022-09-19 Thread Dave Chinner
al finally triggers, and the act of unmounting the filesystem post device removal will clean up the page cache and all the other caches. IOWs, I don't understand why the page cache is considered special here (as opposed to, say, the inode or dentry caches), nor why we aren't shutting down the filesystem directly after syncing it to disk to ensure that we don't end up with applications losing data as a result of racing with the removal Cheers, Dave. -- Dave Chinner da...@fromorbit.com

Re: [RFC PATCH] xfs: drop experimental warning for fsdax

2022-09-19 Thread Dave Chinner
On Tue, Sep 20, 2022 at 09:17:07AM +0800, Shiyang Ruan wrote: > Hi Dave, > > 在 2022/9/20 5:15, Dave Chinner 写道: > > On Mon, Sep 19, 2022 at 02:50:03PM +1000, Dave Chinner wrote: > > > On Thu, Sep 15, 2022 at 09:26:42AM +, Shiyang Ruan wrote: > > > >

Re: [RFC PATCH] xfs: drop experimental warning for fsdax

2022-09-19 Thread Dave Chinner
On Mon, Sep 19, 2022 at 02:50:03PM +1000, Dave Chinner wrote: > On Thu, Sep 15, 2022 at 09:26:42AM +, Shiyang Ruan wrote: > > Since reflink can work together now, the last obstacle has been > > resolved. It's time to remove restrictions and drop this warning. > > >

Re: [RFC PATCH] xfs: drop experimental warning for fsdax

2022-09-18 Thread Dave Chinner
tag, so if you've got any ideas what is causing the stack traces and data corruptions below, I'm all ears... -Dave. Example 1: [22204.239656] run fstests xfs/013 at 2022-09-19 14:11:02 [22205.282787] XFS (pmem1): DAX enabled. Warning: EXPERIMENTAL, use at your own risk [22205.284976] XFS

Re: [PATCH] xfs: on memory failure, only shut down fs after scanning all mappings

2022-08-21 Thread Dave Chinner
While we're at it, add the usual "xfs_" prefix to struct failure_info, > and actually initialize mf_flags. > > Signed-off-by: Darrick J. Wong Looks fine. Reviewed-by: Dave Chinner -- Dave Chinner da...@fromorbit.com

Re: [PATCHSETS] v14 fsdax-rmap + v11 fsdax-reflink

2022-05-11 Thread Dave Chinner
OTSUPP on buffered writes. Documented in the man page. FICLONERANGE on an filesystem that doesn't support reflink will return -EOPNOTSUPP. Documented in the man page. mmap(MAP_SYNC) returns -EOPNOTSUPP if the underlying filesystem and/or storage doesn't support DAX. Documented in the man page. I could go on, but I think I've made the point already... Cheers, Dave. -- Dave Chinner da...@fromorbit.com

Re: [PATCHSETS] v14 fsdax-rmap + v11 fsdax-reflink

2022-05-10 Thread Dave Chinner
On Tue, May 10, 2022 at 06:55:50PM -0700, Dan Williams wrote: > [ add Andrew ] > > > On Tue, May 10, 2022 at 6:49 PM Dave Chinner wrote: > > > > On Tue, May 10, 2022 at 05:03:52PM -0700, Darrick J. Wong wrote: > > > On Sun, May 08, 2022 at 10:

Re: [PATCHSETS] v14 fsdax-rmap + v11 fsdax-reflink

2022-05-10 Thread Dave Chinner
e in the next cycle... > I could just add the entire series to iomap-5.20-merge and base the > xfs-5.20-merge off of that? But I'm not sure what else might be landing > in the other subsystems, so I'm open to input. It'll need to be a stable branch somewhere, but I don't think it really matters where al long as it's merged into the xfs for-next tree so it gets filesystem test coverage... Cheers, Dave. -- Dave Chinner da...@fromorbit.com

Re: [PATCH v13 0/7] fsdax: introduce fs query to support reflink

2022-04-22 Thread Dave Chinner
On Fri, Apr 22, 2022 at 02:27:32PM -0700, Dan Williams wrote: > On Thu, Apr 21, 2022 at 12:47 AM Dave Chinner wrote: > > > > On Wed, Apr 20, 2022 at 10:54:59PM -0700, Christoph Hellwig wrote: > > > On Thu, Apr 21, 2022 at 02:35:02PM +1000, Dave Chinner wrote: > >

Re: [PATCH v13 0/7] fsdax: introduce fs query to support reflink

2022-04-21 Thread Dave Chinner
On Wed, Apr 20, 2022 at 10:54:59PM -0700, Christoph Hellwig wrote: > On Thu, Apr 21, 2022 at 02:35:02PM +1000, Dave Chinner wrote: > > Sure, I'm not a maintainer and just the stand-in patch shepherd for > > a single release. However, being unable to cleanly merge code we >

Re: [PATCH v13 0/7] fsdax: introduce fs query to support reflink

2022-04-20 Thread Dave Chinner
On Wed, Apr 20, 2022 at 07:20:07PM -0700, Dan Williams wrote: > [ add Andrew and Naoya ] > > On Wed, Apr 20, 2022 at 6:48 PM Shiyang Ruan wrote: > > > > Hi Dave, > > > > 在 2022/4/21 9:20, Dave Chinner 写道: > > > Hi Ruan, > > > > > >

Re: [PATCH v13 0/7] fsdax: introduce fs query to support reflink

2022-04-20 Thread Dave Chinner
level DAX+reflink testing. That will mean we need this in a stable shared topic branch and tighter co-ordination between the trees. So before we go any further we need to know if the dax+reflink enablement patchset is near being ready to merge Cheers, Dave. -- Dave Chinner da...@fromorbit.com

Re: [PATCH v12 6/7] xfs: Implement ->notify_failure() for XFS

2022-04-13 Thread Dave Chinner
On Tue, Apr 12, 2022 at 07:06:40PM -0700, Dan Williams wrote: > On Tue, Apr 12, 2022 at 5:04 PM Dave Chinner wrote: > > On Mon, Apr 11, 2022 at 12:09:03AM +0800, Shiyang Ruan wrote: > > > Introduce xfs_notify_failure.c to handle failure related works, such as > > >

Re: [PATCH v12 6/7] xfs: Implement ->notify_failure() for XFS

2022-04-12 Thread Dave Chinner
structures) have been initialised yet so there's null pointer dereferences going to happen here. Perhaps even worse is that the rmapbt is not guaranteed to be in consistent state until after log recovery has completed, so this walk could get stuck forever in a stale on-disk cycle that recovery would have corrected Hence these notifications need to be delayed until after the filesystem is mounted, all the internal structures have been set up and log recovery has completed. Cheers, Dave. -- Dave Chinner da...@fromorbit.com

Re: [PATCH v2 1/1] x86/tdx: Add __tdcall() and __tdvmcall() helper functions

2021-04-20 Thread Dave Hansen
On 4/20/21 4:12 PM, Kuppuswamy, Sathyanarayanan wrote: > On 4/20/21 12:59 PM, Dave Hansen wrote: >> On 4/20/21 12:20 PM, Kuppuswamy, Sathyanarayanan wrote: >>>>> approach is, it adds a few extra instructions for every >>>>> TDCALL use case when compared to

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

Re: [PATCH v2 1/1] x86/tdx: Add __tdcall() and __tdvmcall() helper functions

2021-04-20 Thread Dave Hansen
On 4/20/21 12:20 PM, Kuppuswamy, Sathyanarayanan wrote: >>> approach is, it adds a few extra instructions for every >>> TDCALL use case when compared to distributed checks. Although >>> it's a bit less efficient, it's worth it to make the code more >>> readable. >> >> What's a "distributed check"?

Re: [PATCH v2 1/1] x86/tdx: Add __tdcall() and __tdvmcall() helper functions

2021-04-20 Thread Dave Hansen
On 3/26/21 4:38 PM, Kuppuswamy Sathyanarayanan wrote: > Implement common helper functions to communicate with > the TDX Module and VMM (using TDCALL instruction). This is missing any kind of background. I'd say: Guests communicate with VMMs with hypercalls. Historically, these are implemented

Re: [RFC Part2 PATCH 04/30] x86/mm: split the physmap when adding the page in RMP table

2021-04-19 Thread Dave Hansen
On 4/19/21 11:10 AM, Andy Lutomirski wrote: > I’m confused by this scenario. This should only affect physical pages > that are in the 2M area that contains guest memory. But, if we have a > 2M direct map PMD entry that contains kernel data and guest private > memory, we’re already in a situation

Re: [RFC Part2 PATCH 04/30] x86/mm: split the physmap when adding the page in RMP table

2021-04-19 Thread Dave Hansen
On 4/19/21 10:46 AM, Brijesh Singh wrote: > - guest wants to make gpa 0x1000 as a shared page. To support this, we > need to psmash the large RMP entry into 512 4K entries. The psmash > instruction breaks the large RMP entry into 512 4K entries without > affecting the previous validation. Now the

Re: [RFCv2 06/13] x86/realmode: Share trampoline area if KVM memory protection enabled

2021-04-19 Thread Dave Hansen
On 4/16/21 8:40 AM, Kirill A. Shutemov wrote: > /* > - * If SME is active, the trampoline area will need to be in > - * decrypted memory in order to bring up other processors > + * If SME or KVM memory protection is active, the trampoline area will > + * need to be in

Re: High kmalloc-32 slab cache consumption with 10k containers

2021-04-18 Thread Dave Chinner
On Fri, Apr 16, 2021 at 10:14:39AM +0530, Bharata B Rao wrote: > On Wed, Apr 07, 2021 at 08:28:07AM +1000, Dave Chinner wrote: > > On Mon, Apr 05, 2021 at 11:18:48AM +0530, Bharata B Rao wrote: > > > > > As an alternative approach, I have this below hack that does lazy

[git pull] drm/vmwgfx fixes for 5.12-rc8

2021-04-17 Thread Dave Airlie
the core when destroying pinned buffers. Dave. drm-fixes-2021-04-18: drm/vmwgfx fixes for 5.12-rc7 vmwgfx: - fixed unpinning before destruction - lockdep init reordering The following changes since commit 4d2e1288372ccc5ac60290bc10cace49c9bfa6d0: Merge tag 'drm-intel-fixes-2021-04-15' of git

Re: [RFCv2 04/13] x86/kvm: Use bounce buffers for KVM memory protection

2021-04-16 Thread Dave Hansen
On 4/16/21 8:40 AM, Kirill A. Shutemov wrote: > Mirror SEV, use SWIOTLB always if KVM memory protection is enabled. ... > arch/x86/mm/mem_encrypt.c | 44 --- > arch/x86/mm/mem_encrypt_common.c | 48 ++ The changelog need to at least

Re: [PATCH 00/10] [v7][RESEND] Migrate Pages in lieu of discard

2021-04-16 Thread Dave Hansen
On 4/16/21 5:35 AM, Michal Hocko wrote: > I have to confess that I haven't grasped the initialization > completely. There is a nice comment explaining a 2 socket system with > 3 different NUMA nodes attached to it with one node being terminal. > This is OK if the terminal node is PMEM but

Re: x86/crash: fix crash_setup_memmap_entries() out-of-bounds access

2021-04-16 Thread Dave Young
On 04/16/21 at 01:28pm, Mike Galbraith wrote: > On Fri, 2021-04-16 at 19:07 +0800, Dave Young wrote: > > > > > We're excluding two ranges, allocate the scratch space we need to do that. > > > > I think 1 range should be fine, have you tested 1? > > Have now,

Re: x86/crash: fix crash_setup_memmap_entries() out-of-bounds access

2021-04-16 Thread Dave Young
crash_setup_memmap_entries(struct ki > struct crash_memmap_data cmd; > struct crash_mem *cmem; > > - cmem = vzalloc(sizeof(struct crash_mem)); > + cmem = vzalloc(sizeof(struct crash_mem)+(2*sizeof(struct > crash_mem_range))); Thanks for the patch, can you try below? vzalloc(struct_size(cmem, ranges, 2)); > if (!cmem) > return -ENOMEM; > > Thanks Dave

Re: Candidate Linux ABI for Intel AMX and hypothetical new related features

2021-04-15 Thread Dave Hansen
On 4/15/21 9:24 AM, Andy Lutomirski wrote: > In the patches, *as submitted*, if you trip the XFD #NM *once* and you > are the only thread on the system to do so, you will eat the cost of a > WRMSR on every subsequent context switch. I think you're saying: If a thread trips XFD #NM *once*, every

Re: [PATCH 02/10] mm/numa: automatically generate node migration order

2021-04-15 Thread Dave Hansen
On 4/14/21 9:07 PM, Wei Xu wrote: > On Wed, Apr 14, 2021 at 1:08 AM Oscar Salvador wrote: >> Fast class/memory are pictured as those nodes with CPUs, while Slow >> class/memory >> are PMEM, right? >> Then, what stands for medium class/memory? > > That is Dave's example. I think David's guess

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 00/16] Multigenerational LRU Framework

2021-04-14 Thread Dave Chinner
On Wed, Apr 14, 2021 at 01:16:52AM -0600, Yu Zhao wrote: > On Tue, Apr 13, 2021 at 10:50 PM Dave Chinner wrote: > > On Tue, Apr 13, 2021 at 09:40:12PM -0600, Yu Zhao wrote: > > > On Tue, Apr 13, 2021 at 5:14 PM Dave Chinner wrote: > > > > Profiles would be intere

Re: [PATCH v2 00/16] Multigenerational LRU Framework

2021-04-14 Thread Dave Chinner
On Wed, Apr 14, 2021 at 08:43:36AM -0600, Jens Axboe wrote: > On 4/13/21 5:14 PM, Dave Chinner wrote: > > On Tue, Apr 13, 2021 at 10:13:24AM -0600, Jens Axboe wrote: > >> On 4/13/21 1:51 AM, SeongJae Park wrote: > >>> From: SeongJae Park > >>> > >&

Re: [PATCH v8] x86/sgx: Maintain encl->refcount for each encl->mm_list entry

2021-04-14 Thread Dave Hansen
On 4/14/21 8:51 AM, Sean Christopherson wrote: >> Could this access to and kfree of encl_mm possibly be after the >> kfree(encl_mm) noted above? > No, the mmu_notifier_unregister() ensures that all in-progress notifiers > complete > before it returns, i.e. SGX's notifier call back is not

  1   2   3   4   5   6   7   8   9   10   >