Re: [PATCH] x86/sgx: Use vmalloc_array() instead of vmalloc()

2024-10-07 Thread Jarkko Sakkinen
>pages) { >   memunmap(section->virt_addr); >   return false; Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH v6 3/3] x86/sgx: Resolve EREMOVE page vs EAUG page data race

2024-09-24 Thread Jarkko Sakkinen
ate a bug in a user space application), but it gives a consistent > rule: if an enclave page is under certain operation by the kernel with > the mapping removed, then other threads trying to access that page are > temporarily blocked and should retry. > > Fixes: 9849bb27152c1 ("x86/sgx

Re: [PATCH v2 2/2] x86/sgx: Log information when a node lacks an EPC section

2024-09-05 Thread Jarkko Sakkinen
at would need to be done automatically if this happens? With a tracepoint you could react to such even but I'm totally fine with this. > + } > + > return true; > } > Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH v2 1/2] x86/sgx: Fix deadlock in SGX NUMA node search

2024-09-05 Thread Jarkko Sakkinen
> if (page) > return page; > - } > + > + nid = next_node_in(nid, sgx_numa_mask); > + } while (nid != nid_start); > > return ERR_PTR(-ENOMEM); > } Looks good to me: Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH] x86/sgx: Fix deadloop in __sgx_alloc_epc_page()

2024-09-04 Thread Jarkko Sakkinen
On Wed Sep 4, 2024 at 4:39 AM EEST, Aaron Lu wrote: > On Tue, Sep 03, 2024 at 07:05:40PM +0300, Jarkko Sakkinen wrote: > > On Fri Aug 30, 2024 at 9:14 AM EEST, Aaron Lu wrote: > > > On Thu, Aug 29, 2024 at 07:44:13PM +0300, Jarkko Sakkinen wrote: > > > > On Thu Aug 2

Re: [PATCH] x86/sgx: Fix deadloop in __sgx_alloc_epc_page()

2024-09-03 Thread Jarkko Sakkinen
On Fri Aug 30, 2024 at 9:14 AM EEST, Aaron Lu wrote: > On Thu, Aug 29, 2024 at 07:44:13PM +0300, Jarkko Sakkinen wrote: > > On Thu Aug 29, 2024 at 5:38 AM EEST, Aaron Lu wrote: > > > When current node doesn't have a EPC section configured by firmware and > > > a

Re: [PATCH] x86/sgx: Fix deadloop in __sgx_alloc_epc_page()

2024-08-29 Thread Jarkko Sakkinen
On Thu Aug 29, 2024 at 5:38 AM EEST, Aaron Lu wrote: > When current node doesn't have a EPC section configured by firmware and > all other EPC sections memory are used up, CPU can stuck inside the > while loop in __sgx_alloc_epc_page() forever and soft lockup will happen. > Note how nid_of_current

Re: [PATCH] x86/sgx: Fix a W=1 build warning in function comment

2024-08-27 Thread Jarkko Sakkinen
etric is concatenated in a way that @low bits 12-31 define the > * bits 12-31 of the metric and @high bits 0-19 define the bits 32-51 of the > * metric. > > base-commit: e77f8f275278886d05ce6dfe9e3bc854e7bf0713 Agreed, that has went there probably by plain mistake. Do not think it has been intentional... Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH v5 3/3] x86/sgx: Resolve EREMOVE page vs EAUG page data race

2024-08-27 Thread Jarkko Sakkinen
sgx_mark_page_reclaimable(entry->epc_page); > } > @@ -1141,7 +1151,14 @@ static long sgx_encl_remove_pages(struct sgx_encl > *encl, > /* >* Do not keep encl->lock because of dependency on >* mmap_lock acquired in sgx_zap_enclave_ptes(). > + * > + * Releasing encl->lock leads to a data race: while CPU1 > + * performs sgx_zap_enclave_ptes() and removes the PTE entry > + * for the enclave page, CPU2 may attempt to load this page > + * (because the page is still in enclave's xarray). To prevent > + * CPU2 from loading the page, mark the page as busy. >*/ > + entry->desc |= SGX_ENCL_PAGE_BUSY; > mutex_unlock(&encl->lock); > > sgx_zap_enclave_ptes(encl, addr); Reviewed-by: Jarkko Sakkinen BR, Jarkko

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

2024-08-27 Thread Jarkko Sakkinen
_out_eaug; > > encl_page->encl = encl; > encl_page->epc_page = epc_page; > @@ -408,20 +414,20 @@ static vm_fault_t sgx_encl_eaug_page(struct > vm_area_struct *vma, > mutex_unlock(&encl->lock); > return VM_FAULT_SIGBUS; > } > +done: > mutex_unlock(&encl->lock); > return VM_FAULT_NOPAGE; > > -err_out: > +err_out_eaug: > xa_erase(&encl->page_array, PFN_DOWN(encl_page->desc)); > - > err_out_shrink: > sgx_encl_shrink(encl, va_page); > err_out_epc: > sgx_encl_free_epc_page(epc_page); > +err_out_encl: > + kfree(encl_page); > err_out_unlock: > mutex_unlock(&encl->lock); > - kfree(encl_page); > - > return vmret; > } > Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH v5 1/3] x86/sgx: Split SGX_ENCL_PAGE_BEING_RECLAIMED into two flags

2024-08-27 Thread Jarkko Sakkinen
> > - encl_page->desc &= ~SGX_ENCL_PAGE_BEING_RECLAIMED; > + encl_page->desc &= ~(SGX_ENCL_PAGE_BUSY | SGX_ENCL_PAGE_PCMD_BUSY); > > va_page = list_first_entry(&encl->va_pages, struct sgx_va_page, > list); > @@ -340,7 +340,7 @@ static void sgx_reclaim_pages(void) > goto skip; > } > > - encl_page->desc |= SGX_ENCL_PAGE_BEING_RECLAIMED; > + encl_page->desc |= SGX_ENCL_PAGE_BUSY | SGX_ENCL_PAGE_PCMD_BUSY; > mutex_unlock(&encl_page->encl->lock); > continue; > Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH v16 00/16] Add Cgroup support for SGX EPC memory

2024-08-27 Thread Jarkko Sakkinen
On Wed Aug 21, 2024 at 4:53 AM EEST, Haitao Huang wrote: > SGX Enclave Page Cache (EPC) memory allocations are separate from normal > RAM allocations, and are managed solely by the SGX subsystem. The existing > cgroup memory controller cannot be used to limit or account for SGX EPC > memory, which

Re: [PATCH v16 13/16] x86/sgx: implement direct reclamation for cgroups

2024-08-27 Thread Jarkko Sakkinen
{ > + /* Reduce chance of per-cgroup reclamation for later allocation */ > + sgx_cgroup_reclaim_direct(); > + > + /* Reduce chance of the global reclamation for later allocation */ > if (sgx_should_reclaim_global(SGX_NR_LOW_PAGES)) > sgx_reclaim_pages_global(current->mm); > } Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH v16 12/16] x86/sgx: Revise global reclamation for EPC cgroups

2024-08-27 Thread Jarkko Sakkinen
escendants, and then do the > actual reclaim in one batch. But this is unnecessarily complicated at > this stage to address such rare cases. > > Signed-off-by: Haitao Huang Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH v16 10/16] x86/sgx: Implement async reclamation for cgroup

2024-08-27 Thread Jarkko Sakkinen
rson > Signed-off-by: Sean Christopherson > Signed-off-by: Kristen Carlson Accardi > Co-developed-by: Haitao Huang > Signed-off-by: Haitao Huang > Tested-by: Jarkko Sakkinen Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH v16 09/16] x86/sgx: Add basic EPC reclamation flow for cgroup

2024-08-27 Thread Jarkko Sakkinen
us and preemptive reclamation. > > Note all reclaimable EPC pages are still tracked in the global LRU thus > no per-cgroup reclamation is actually active at the moment: -ENOMEM is > returned by __sgx_cgroup_try_charge() when LRUs are empty. Per-cgroup > tracking and reclamation wi

Re: [PATCH v16 08/16] x86/sgx: Encapsulate uses of the global LRU

2024-08-27 Thread Jarkko Sakkinen
d-by: Kristen Carlson Accardi > Signed-off-by: Kristen Carlson Accardi > Signed-off-by: Haitao Huang Reviewed-by: Jarkko Sakkinen BR, Jarkko

Re: [PATCH v4 3/3] x86/sgx: Resolve EREMOVE page vs EAUG page data race

2024-08-15 Thread Jarkko Sakkinen
On Thu Aug 15, 2024 at 9:34 PM EEST, Jarkko Sakkinen wrote: > On Mon Aug 12, 2024 at 11:25 AM EEST, Dmitrii Kuvaiskii wrote: > > On Wed, Jul 17, 2024 at 01:38:59PM +0300, Jarkko Sakkinen wrote: > > > > > Ditto. > > > > Just to be sure: I assume this means

Re: [PATCH v4 3/3] x86/sgx: Resolve EREMOVE page vs EAUG page data race

2024-08-15 Thread Jarkko Sakkinen
On Mon Aug 12, 2024 at 11:25 AM EEST, Dmitrii Kuvaiskii wrote: > On Wed, Jul 17, 2024 at 01:38:59PM +0300, Jarkko Sakkinen wrote: > > > Ditto. > > Just to be sure: I assume this means "Fixes should be in the head of the > series so please reorder"? If yes, please

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

2024-08-15 Thread Jarkko Sakkinen
On Mon Aug 12, 2024 at 11:21 AM EEST, Dmitrii Kuvaiskii wrote: > On Wed, Jul 17, 2024 at 01:38:37PM +0300, Jarkko Sakkinen wrote: > > > Fixes should be in the head of the series so please reorder. > > Do you mean that the preparation patch [1] should be applied after the two

Re: [PATCH v4 1/3] x86/sgx: Split SGX_ENCL_PAGE_BEING_RECLAIMED into two flags

2024-08-15 Thread Jarkko Sakkinen
On Mon Aug 12, 2024 at 11:16 AM EEST, Dmitrii Kuvaiskii wrote: > On Wed, Jul 17, 2024 at 01:37:39PM +0300, Jarkko Sakkinen wrote: > > On Fri Jul 5, 2024 at 10:45 AM EEST, Dmitrii Kuvaiskii wrote: > > > +/* > > > + * 'desc' bit indicating that PCMD page assoc

Re: [PATCH v4 1/3] x86/sgx: Split SGX_ENCL_PAGE_BEING_RECLAIMED into two flags

2024-08-15 Thread Jarkko Sakkinen
On Mon Aug 12, 2024 at 11:12 AM EEST, Dmitrii Kuvaiskii wrote: > On Wed, Jul 17, 2024 at 01:36:08PM +0300, Jarkko Sakkinen wrote: > > On Fri Jul 5, 2024 at 10:45 AM EEST, Dmitrii Kuvaiskii wrote: > > > SGX_ENCL_PAGE_BEING_RECLAIMED flag is set when the enclave page is being >

Re: [PATCH v4 3/3] x86/sgx: Resolve EREMOVE page vs EAUG page data race

2024-07-17 Thread Jarkko Sakkinen
On Fri Jul 5, 2024 at 10:45 AM EEST, Dmitrii Kuvaiskii wrote: > Two enclave threads may try to add and remove the same enclave page > simultaneously (e.g., if the SGX runtime supports both lazy allocation > and MADV_DONTNEED semantics). Consider some enclave page added to the > enclave. User space

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

2024-07-17 Thread Jarkko Sakkinen
ock); > /* > * *BUG*: SIGBUS is returned > * for a valid enclave page > */ > return VM_FAULT_SIGBUS; > } > } > > Fixes: 5a90d2c3f5ef ("x86/sgx: Support adding of pages to an initialized > enclave") > Cc: sta...@vger.kernel.org >

Re: [PATCH v4 1/3] x86/sgx: Split SGX_ENCL_PAGE_BEING_RECLAIMED into two flags

2024-07-17 Thread Jarkko Sakkinen
On Fri Jul 5, 2024 at 10:45 AM EEST, Dmitrii Kuvaiskii wrote: > +/* > + * 'desc' bit indicating that PCMD page associated with the enclave page is > + * busy (e.g. because the enclave page is being reclaimed). > + */ > +#define SGX_ENCL_PAGE_PCMD_BUSY BIT(3) What are other situations when thi

Re: [PATCH v4 1/3] x86/sgx: Split SGX_ENCL_PAGE_BEING_RECLAIMED into two flags

2024-07-17 Thread Jarkko Sakkinen
On Fri Jul 5, 2024 at 10:45 AM EEST, Dmitrii Kuvaiskii wrote: > SGX_ENCL_PAGE_BEING_RECLAIMED flag is set when the enclave page is being > reclaimed (moved to the backing store). This flag however has two > logical meanings: side-effects Missing the actor. "The page r

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

2024-07-05 Thread Jarkko Sakkinen
On Fri Jul 5, 2024 at 10:45 AM EEST, Dmitrii Kuvaiskii wrote: > SGX runtimes such as Gramine may implement EDMM-based lazy allocation of > enclave pages and may support MADV_DONTNEED semantics [1]. The former > implies #PF-based page allocation, and the latter implies the usage of > SGX_IOC_ENCLAVE

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

2024-06-05 Thread Jarkko Sakkinen
On Thu Jun 6, 2024 at 9:20 AM EEST, Jarkko Sakkinen wrote: > > There are existing code where BUG_ON() is used during the kernel early > > boot code when memory allocation fails (e.g., see cgroup_init_subsys()), > > so it might be acceptable to use BUG_ON() here, but it's

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

2024-06-05 Thread Jarkko Sakkinen
On Thu Jun 6, 2024 at 1:30 AM EEST, Huang, Kai wrote: > > >> Reorg: > >> > >> void sgx_cgroup_init(void) > >> { > >> struct workqueue_struct *wq; > >> > >> /* eagerly allocate the workqueue: */ > >> wq = alloc_workqueue("sgx_cg_wq", wq_unbound | wq_freezable, > >> wq_unbound_max_active

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

2024-06-05 Thread Jarkko Sakkinen
On Wed Jun 5, 2024 at 6:33 PM EEST, Haitao Huang wrote: > sgx_cgroup_try_charge() expects sgx_cg_wq, so it would break unless we > check and return 0 which was the initially implemented in v12. But then > Kai had some concern on that we expose all the interface files to allow > user to set l

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

2024-06-04 Thread Jarkko Sakkinen
ludes a test with low mem_cg limit and large sgx_epc > limit to verify that the RAM used for per-cgroup reclamation is charged > to a proper mem_cg. For this test, it turns off swapping before start, > and turns swapping back on afterwards. > > Add README to document how to run the te

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

2024-05-16 Thread Jarkko Sakkinen
On Thu May 16, 2024 at 1:29 AM EEST, Haitao Huang wrote: > On Wed, 15 May 2024 16:55:59 -0500, Haitao Huang > wrote: > > > On Wed, 15 May 2024 01:55:21 -0500, Bojun Zhu > > wrote: > > > >> EDMM's ioctl()s support batch operations, which may be > >> time-consuming. Try to explicitly give up th

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

2024-05-16 Thread Jarkko Sakkinen
On Thu May 16, 2024 at 12:55 AM EEST, Haitao Huang wrote: > On Wed, 15 May 2024 01:55:21 -0500, Bojun Zhu > wrote: > > > EDMM's ioctl()s support batch operations, which may be > > time-consuming. Try to explicitly give up the CPU as the prefix > > operation at the every begin of "for loop" in >

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

2024-05-15 Thread Jarkko Sakkinen
> Thank you very much. I understand the changelog is still being discussed > and those changes look good to me, to which you can add: > > Reviewed-by: Reinette Chatre also for this (with changelog tweak Dave suggested) so that we don't need a new round: Reviewed-by: Jarkko Sakkinen BR, Jarkko

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

2024-05-15 Thread Jarkko Sakkinen
/cpu/sgx/ioctl.c > index b65ab214bdf5..c542d4dd3e64 100644 > --- a/arch/x86/kernel/cpu/sgx/ioctl.c > +++ b/arch/x86/kernel/cpu/sgx/ioctl.c > @@ -1142,6 +1142,7 @@ static long sgx_encl_remove_pages(struct sgx_encl *encl, >* Do not keep encl->lock because of dependency on >* mmap_lock acquired in sgx_zap_enclave_ptes(). >*/ > + entry->desc |= SGX_ENCL_PAGE_BEING_REMOVED; > mutex_unlock(&encl->lock); > > sgx_zap_enclave_ptes(encl, addr); Makes perfect sense: Reviewed-by: Jarkko Sakkinen BR, Jarkko

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

2024-05-15 Thread Jarkko Sakkinen
On Wed May 15, 2024 at 5:15 PM EEST, Dave Hansen wrote: > 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. Th

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

2024-05-15 Thread Jarkko Sakkinen
On Wed May 15, 2024 at 4:54 PM EEST, Jarkko Sakkinen wrote: > On Wed May 15, 2024 at 4:12 PM EEST, Dmitrii Kuvaiskii wrote: > > diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c > > index 279148e72459..41f14b1a3025 100644 > > --- a/arch/x86/

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

2024-05-15 Thread Jarkko Sakkinen
On Wed May 15, 2024 at 4:12 PM EEST, Dmitrii Kuvaiskii wrote: > diff --git a/arch/x86/kernel/cpu/sgx/encl.c b/arch/x86/kernel/cpu/sgx/encl.c > index 279148e72459..41f14b1a3025 100644 > --- a/arch/x86/kernel/cpu/sgx/encl.c > +++ b/arch/x86/kernel/cpu/sgx/encl.c > @@ -382,8 +382,11 @@ static vm_fault

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

2024-05-15 Thread Jarkko Sakkinen
2s! > ... > RIP: 0010:sgx_enclave_restrict_permissions+0xba/0x1f0 > ... > Call Trace: > sgx_ioctl > __x64_sys_ioctl > x64_sys_call > do_syscall_64 > entry_SYSCALL_64_after_hwframe > [ end trace ] >

Re: [PATCH] mm: Remove mm argument from mm_get_unmapped_area()

2024-05-07 Thread Jarkko Sakkinen
AGE)) > return addr; > @@ -2334,8 +2333,8 @@ unsigned long shmem_get_unmapped_area(struct file *file, > if (inflated_len < len) > return addr; > > - inflated_addr = mm_get_unmapped_area(current->mm, NULL, uaddr, > - inflated_len, 0, flags); > + inflated_addr = current_get_unmapped_area(NULL, uaddr, > + inflated_len, 0, flags); > if (IS_ERR_VALUE(inflated_addr)) > return addr; > if (inflated_addr & ~PAGE_MASK) > @@ -4799,7 +4798,7 @@ unsigned long shmem_get_unmapped_area(struct file *file, > unsigned long addr, unsigned long len, > unsigned long pgoff, unsigned long flags) > { > - return mm_get_unmapped_area(current->mm, file, addr, len, pgoff, flags); > + return current_get_unmapped_area(file, addr, len, pgoff, flags); > } > #endif > > > base-commit: 9221b2819b8a4196eecf5476d66201be60fbcf29 Reviewed-by: Jarkko Sakkinen BR, Jarkko

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

2024-05-02 Thread Jarkko Sakkinen
On Tue Apr 30, 2024 at 10:51 PM EEST, Haitao Huang wrote: > With different cgroups, the script starts one or multiple concurrent SGX > selftests (test_sgx), each to run the unclobbered_vdso_oversubscribed > test case, which loads an enclave of EPC size equal to the EPC capacity > available on the p

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

2024-04-29 Thread Jarkko Sakkinen
On Mon Apr 29, 2024 at 7:18 PM EEST, Haitao Huang wrote: > Hi Jarkko > > On Sun, 28 Apr 2024 17:03:17 -0500, Jarkko Sakkinen > wrote: > > > On Fri Apr 26, 2024 at 5:28 PM EEST, Dave Hansen wrote: > >> On 4/16/24 07:15, Jarkko Sakkinen wrote: > >> >

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

2024-04-29 Thread Jarkko Sakkinen
On Mon Apr 29, 2024 at 1:43 PM EEST, Dmitrii Kuvaiskii wrote: > Two enclave threads may try to add and remove the same enclave page > simultaneously (e.g., if the SGX runtime supports both lazy allocation > and `MADV_DONTNEED` semantics). Consider this race: > > 1. T1 performs page removal in sgx_e

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

2024-04-29 Thread Jarkko Sakkinen
On Mon Apr 29, 2024 at 4:22 PM EEST, Jarkko Sakkinen wrote: > On Mon Apr 29, 2024 at 4:04 PM EEST, Jarkko Sakkinen wrote: > > > Fix these two bugs (1) by returning VM_FAULT_NOPAGE to the generic Linux > > > fault handler so that no signal is sent to userspace, and (

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

2024-04-29 Thread Jarkko Sakkinen
On Mon Apr 29, 2024 at 4:04 PM EEST, Jarkko Sakkinen wrote: > > Fix these two bugs (1) by returning VM_FAULT_NOPAGE to the generic Linux > > fault handler so that no signal is sent to userspace, and (2) by > > replacing sgx_encl_free_epc_page() with sgx_free_epc_page() so that

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

2024-04-29 Thread Jarkko Sakkinen
On Mon Apr 29, 2024 at 1:43 PM EEST, Dmitrii Kuvaiskii wrote: > SGX runtimes such as Gramine may implement EDMM-based lazy allocation of > enclave pages and may support MADV_DONTNEED semantics [1]. The former > implies #PF-based page allocation, and the latter implies the usage of > SGX_IOC_ENCLAVE

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

2024-04-29 Thread Jarkko Sakkinen
On Mon Apr 29, 2024 at 1:43 PM EEST, Dmitrii Kuvaiskii wrote: > Two enclave threads may try to access the same non-present enclave page > simultaneously (e.g., if the SGX runtime supports lazy allocation). The > threads will end up in sgx_encl_eaug_page(), racing to acquire the > enclave lock. The

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

2024-04-28 Thread Jarkko Sakkinen
On Fri Apr 26, 2024 at 5:18 PM EEST, Bojun Zhu wrote: > EDMM's ioctl()s support batch operations, which may be > time-consuming. Try to explicitly give up the CPU as the prefix > operation at the every begin of "for loop" in > sgx_enclave_{ modify_types | restrict_permissions | remove_pages} > to g

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

2024-04-28 Thread Jarkko Sakkinen
On Fri Apr 26, 2024 at 5:28 PM EEST, Dave Hansen wrote: > 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 previo

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

2024-04-24 Thread Jarkko Sakkinen
On Wed Apr 24, 2024 at 10:42 PM EEST, Haitao Huang wrote: > Hi Jarkko > On Tue, 16 Apr 2024 11:08:11 -0500, Jarkko Sakkinen > wrote: > > > On Tue Apr 16, 2024 at 5:54 PM EEST, Haitao Huang wrote: > >> I did declare the configs in the config file but I missed it

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

2024-04-24 Thread Jarkko Sakkinen
On Wed Apr 24, 2024 at 8:44 PM EEST, Jarkko Sakkinen wrote: > On Wed Apr 24, 2024 at 2:50 PM EEST, Bojun Zhu wrote: > > I still have some questions: > > > > It seems that the variable "ret" is set to 0 if there is **some** EPC pages > > have been > >

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

2024-04-24 Thread Jarkko Sakkinen
On Wed Apr 24, 2024 at 2:50 PM EEST, Bojun Zhu wrote: > I still have some questions: > > It seems that the variable "ret" is set to 0 if there is **some** EPC pages > have been > added when interrupted by signal(Supposed that sgx_encl_add_page() > always returns successfully). Ah, ok. Returnin

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

2024-04-24 Thread Jarkko Sakkinen
On Wed Apr 24, 2024 at 10:02 AM EEST, Jarkko Sakkinen wrote: > On Wed Apr 24, 2024 at 9:46 AM EEST, Bojun Zhu wrote: > > Based on the the discussion among you, Jarkko and Reinette, > > I will keep the need_resched() and wrap the logic in using sgx_resched(), > > as suggested

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

2024-04-24 Thread Jarkko Sakkinen
On Wed Apr 24, 2024 at 9:46 AM EEST, Bojun Zhu wrote: > Based on the the discussion among you, Jarkko and Reinette, > I will keep the need_resched() and wrap the logic in using sgx_resched(), > as suggested by Jarkko. Sounds like a plan :-) > Regards, > > Bojun BR, Jarkko

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

2024-04-23 Thread Jarkko Sakkinen
On Tue Apr 23, 2024 at 8:08 PM EEST, Reinette Chatre wrote: > Hi Kai, > > On 4/23/2024 4:50 AM, Huang, Kai wrote: > >> diff --git a/arch/x86/kernel/cpu/sgx/ioctl.c > >> b/arch/x86/kernel/cpu/sgx/ioctl.c > >> index b65ab214bdf5..2340a82fa796 100644 > >> --- a/arch/x86/kernel/cpu/sgx/ioctl.c > >> ++

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

2024-04-23 Thread Jarkko Sakkinen
On Tue Apr 23, 2024 at 2:50 PM EEST, Huang, Kai wrote: > On Tue, 2024-04-23 at 17:25 +0800, 朱伯君(杰铭) wrote: > > EDMM's ioctl()s support batch operations, which may be > > time-consuming. Try to explicitly give up the CPU at > > the every end of "for loop" in > > sgx_enclave_{ modify_types | restrict

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

2024-04-23 Thread Jarkko Sakkinen
On Wed Apr 24, 2024 at 12:10 AM EEST, Jarkko Sakkinen wrote: > On Tue Apr 23, 2024 at 12:25 PM EEST, =?UTF-8?B?5pyx5Lyv5ZCbKOadsOmTrSk=?= > wrote: > > EDMM's ioctl()s support batch operations, which may be > > time-consuming. Try to explicitly give up the CPU at > > t

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

2024-04-23 Thread Jarkko Sakkinen
On Tue Apr 23, 2024 at 12:25 PM EEST, =?UTF-8?B?5pyx5Lyv5ZCbKOadsOmTrSk=?= wrote: > EDMM's ioctl()s support batch operations, which may be > time-consuming. Try to explicitly give up the CPU at > the every end of "for loop" in > sgx_enclave_{ modify_types | restrict_permissions | remove_pages} > t

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

2024-04-17 Thread Jarkko Sakkinen
On Wed Apr 17, 2024 at 1:04 AM EEST, Haitao Huang wrote: > On Tue, 16 Apr 2024 11:08:11 -0500, Jarkko Sakkinen > wrote: > > > On Tue Apr 16, 2024 at 5:54 PM EEST, Haitao Huang wrote: > >> I did declare the configs in the config file but I missed it in my patch > >&

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

2024-04-16 Thread Jarkko Sakkinen
On Tue Apr 16, 2024 at 5:54 PM EEST, Haitao Huang wrote: > I did declare the configs in the config file but I missed it in my patch > as stated earlier. IIUC, that would not cause this error though. > > Maybe I should exit with the skip code if no CGROUP_MISC (no more > CGROUP_SGX_EPC) is confi

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

2024-04-16 Thread Jarkko Sakkinen
On Tue Apr 16, 2024 at 8:42 AM EEST, Huang, Kai wrote: > > > > I'll send a fixup for this patch or another version of the series if more > > changes are needed. > > Hi Haitao, > > I don't like to say but in general I think you are sending too frequently. > The > last version was sent April, 11

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

2024-04-16 Thread Jarkko Sakkinen
On Tue Apr 16, 2024 at 5:05 PM EEST, Jarkko Sakkinen wrote: > On Tue Apr 16, 2024 at 6:20 AM EEST, Haitao Huang wrote: > > With different cgroups, the script starts one or multiple concurrent SGX > > selftests (test_sgx), each to run the unclobbered_vdso_oversubscribed > > t

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

2024-04-16 Thread Jarkko Sakkinen
On Tue Apr 16, 2024 at 6:20 AM EEST, Haitao Huang wrote: > With different cgroups, the script starts one or multiple concurrent SGX > selftests (test_sgx), each to run the unclobbered_vdso_oversubscribed > test case, which loads an enclave of EPC size equal to the EPC capacity > available on the pl

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

2024-04-15 Thread Jarkko Sakkinen
On Mon Apr 15, 2024 at 8:32 PM EEST, Haitao Huang wrote: > On Sat, 13 Apr 2024 16:34:17 -0500, Jarkko Sakkinen > wrote: > > > On Wed Apr 10, 2024 at 9:25 PM EEST, Haitao Huang wrote: > >> To run selftests for EPC cgroup: > >> > >> sudo ./run_epc_cg_s

Re: [PATCH v11 01/14] x86/sgx: Replace boolean parameters with enums

2024-04-15 Thread Jarkko Sakkinen
ally remove non-static declaration of > > __sgx_alloc_epc_page() and a typo > > > > Signed-off-by: Haitao Huang > > Suggested-by: Jarkko Sakkinen > > Suggested-by: Dave Hansen > > > > Reviewed-by: Kai Huang Hmm... missing my reviewed-by so: Reviewed-by: Jarkko Sakkinen BR, Jarkko

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

2024-04-15 Thread Jarkko Sakkinen
On Mon Apr 15, 2024 at 6:13 AM EEST, Haitao Huang wrote: > On Sun, 14 Apr 2024 10:01:03 -0500, Jarkko Sakkinen > wrote: > > > On Wed Apr 10, 2024 at 9:25 PM EEST, Haitao Huang wrote: > >> To run selftests for EPC cgroup: > >> > >> sudo ./run_epc_cg_s

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

2024-04-14 Thread Jarkko Sakkinen
On Wed Apr 10, 2024 at 9:25 PM EEST, Haitao Huang wrote: > To run selftests for EPC cgroup: > > sudo ./run_epc_cg_selftests.sh > > To watch misc cgroup 'current' changes during testing, run this in a > separate terminal: > > ./watch_misc_for_tests.sh current > > With different cgroups, the script s

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

2024-04-13 Thread Jarkko Sakkinen
On Wed Apr 10, 2024 at 9:25 PM EEST, Haitao Huang wrote: > To run selftests for EPC cgroup: > > sudo ./run_epc_cg_selftests.sh > > To watch misc cgroup 'current' changes during testing, run this in a > separate terminal: > > ./watch_misc_for_tests.sh current > > With different cgroups, the script s

Re: [PATCH v10 08/14] x86/sgx: Add basic EPC reclamation flow for cgroup

2024-04-13 Thread Jarkko Sakkinen
On Fri Apr 5, 2024 at 6:07 AM EEST, Huang, Kai wrote: > On Thu, 2024-04-04 at 12:05 -0500, Haitao Huang wrote: > > > > -static inline int sgx_cgroup_try_charge(struct sgx_cgroup *sgx_cg) > > > > +static inline int sgx_cgroup_try_charge(struct sgx_cgroup *sgx_cg,  > > > > enum sgx_reclaim r) > > >

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

2024-04-03 Thread Jarkko Sakkinen
On Tue Apr 2, 2024 at 8:40 PM EEST, Michal Koutný wrote: > On Tue, Apr 02, 2024 at 11:20:21AM -0500, Haitao Huang > wrote: > > Do we really want to have it implemented in c? > > I only pointed to the available C boilerplate. > > > There are much fewer lines of > > code in shell scripts. Note we a

Re: [PATCH v2] selftests/sgx: Improve cgroup test scripts

2024-04-03 Thread Jarkko Sakkinen
On Tue Apr 2, 2024 at 8:31 PM EEST, Haitao Huang wrote: > On Tue, 02 Apr 2024 02:43:25 -0500, Jarkko Sakkinen > wrote: > > > On Tue Apr 2, 2024 at 4:42 AM EEST, Haitao Huang wrote: > >> Make cgroup test scripts ash compatible. > >> Remove cg-tools depen

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

2024-04-03 Thread Jarkko Sakkinen
On Tue Apr 2, 2024 at 7:20 PM EEST, Haitao Huang wrote: > On Tue, 02 Apr 2024 06:58:40 -0500, Jarkko Sakkinen > wrote: > > > On Tue Apr 2, 2024 at 2:23 PM EEST, Michal Koutný wrote: > >> Hello. > >> > >> On Sat, Mar 30, 2024 at 01:26:08PM +0200, Jarkko

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

2024-04-03 Thread Jarkko Sakkinen
On Tue Apr 2, 2024 at 6:42 PM EEST, Dave Hansen wrote: > 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 chec

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

2024-04-02 Thread Jarkko Sakkinen
On Tue Apr 2, 2024 at 2:23 PM EEST, Michal Koutný wrote: > Hello. > > On Sat, Mar 30, 2024 at 01:26:08PM +0200, Jarkko Sakkinen > wrote: > > > > It'd be more complicated and less readable to do all the stuff without > > > > the > > > > c

Re: [PATCH v2] selftests/sgx: Improve cgroup test scripts

2024-04-02 Thread Jarkko Sakkinen
On Tue Apr 2, 2024 at 4:42 AM EEST, Haitao Huang wrote: > Make cgroup test scripts ash compatible. > Remove cg-tools dependency. > Add documentation for functions. > > Tested with busybox on Ubuntu. > > Signed-off-by: Haitao Huang > --- > v2: > - Fixes for v2 cgroup > - Turn off swapping before me

Re: [PATCH] selftests/sgx: Improve cgroup test scripts

2024-04-02 Thread Jarkko Sakkinen
On Tue Apr 2, 2024 at 1:55 AM EEST, Haitao Huang wrote: > On Mon, 01 Apr 2024 09:22:21 -0500, Jarkko Sakkinen > wrote: > > > On Sun Mar 31, 2024 at 8:44 PM EEST, Haitao Huang wrote: > >> Make cgroup test scripts ash compatible. > >> Remove cg-tools depen

Re: [PATCH v10 05/14] x86/sgx: Implement basic EPC misc cgroup functionality

2024-04-01 Thread Jarkko Sakkinen
On Mon Apr 1, 2024 at 12:29 PM EEST, Huang, Kai wrote: > On Sat, 2024-03-30 at 13:17 +0200, Jarkko Sakkinen wrote: > > On Thu Mar 28, 2024 at 2:53 PM EET, Huang, Kai wrote: > > > > > > > --- /dev/null > > > > +++ b/arch/x86/kernel/cpu/sgx/epc_cgroup.c

Re: [PATCH] selftests/sgx: Improve cgroup test scripts

2024-04-01 Thread Jarkko Sakkinen
On Sun Mar 31, 2024 at 8:44 PM EEST, Haitao Huang wrote: > Make cgroup test scripts ash compatible. > Remove cg-tools dependency. > Add documentation for functions. > > Tested with busybox on Ubuntu. > > Signed-off-by: Haitao Huang I'll run this next week on good old NUC7. Thank you. I really wi

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

2024-04-01 Thread Jarkko Sakkinen
On Sun Mar 31, 2024 at 8:35 PM EEST, Haitao Huang wrote: > On Sun, 31 Mar 2024 11:19:04 -0500, Jarkko Sakkinen > wrote: > > > On Sat Mar 30, 2024 at 5:32 PM EET, Haitao Huang wrote: > >> On Sat, 30 Mar 2024 06:15:14 -0500, Jarkko Sakkinen > >> wrote: > >

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

2024-03-31 Thread Jarkko Sakkinen
On Sat Mar 30, 2024 at 5:32 PM EET, Haitao Huang wrote: > On Sat, 30 Mar 2024 06:15:14 -0500, Jarkko Sakkinen > wrote: > > > On Thu Mar 28, 2024 at 5:54 AM EET, Haitao Huang wrote: > >> On Wed, 27 Mar 2024 07:55:34 -0500, Jarkko Sakkinen > >> wrote: > &

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

2024-03-30 Thread Jarkko Sakkinen
On Thu Mar 28, 2024 at 2:22 AM EET, Haitao Huang wrote: > The scripts rely on cgroup-tools package from libcgroup [1]. > > To run selftests for epc cgroup: > > sudo ./run_epc_cg_selftests.sh > > To watch misc cgroup 'current' changes during testing, run this in a > separate terminal: > > ./watch_mi

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

2024-03-30 Thread Jarkko Sakkinen
On Sat Mar 30, 2024 at 1:23 PM EET, Jarkko Sakkinen wrote: > On Thu Mar 28, 2024 at 2:57 AM EET, Haitao Huang wrote: > > On Wed, 27 Mar 2024 11:56:35 -0500, Jarkko Sakkinen > > wrote: > > > > > On Wed Mar 27, 2024 at 2:55 PM EET, Jarkko Sakkinen wrote: > >

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

2024-03-30 Thread Jarkko Sakkinen
On Thu Mar 28, 2024 at 2:57 AM EET, Haitao Huang wrote: > On Wed, 27 Mar 2024 11:56:35 -0500, Jarkko Sakkinen > wrote: > > > On Wed Mar 27, 2024 at 2:55 PM EET, Jarkko Sakkinen wrote: > >> On Mon, 2024-02-05 at 13:06 -0800, Haitao Huang wrote: > >> > The

Re: [PATCH v10 05/14] x86/sgx: Implement basic EPC misc cgroup functionality

2024-03-30 Thread Jarkko Sakkinen
On Thu Mar 28, 2024 at 2:53 PM EET, Huang, Kai wrote: > > > --- /dev/null > > +++ b/arch/x86/kernel/cpu/sgx/epc_cgroup.c > > @@ -0,0 +1,74 @@ > > +// SPDX-License-Identifier: GPL-2.0 > > +// Copyright(c) 2022 Intel Corporation. > > It's 2024 now. > > And looks you need to use C style comment for /*

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

2024-03-30 Thread Jarkko Sakkinen
On Thu Mar 28, 2024 at 5:54 AM EET, Haitao Huang wrote: > On Wed, 27 Mar 2024 07:55:34 -0500, Jarkko Sakkinen > wrote: > > > On Mon, 2024-02-05 at 13:06 -0800, Haitao Huang wrote: > >> The scripts rely on cgroup-tools package from libcgroup [1]. > >> >

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

2024-03-27 Thread Jarkko Sakkinen
On Wed Mar 27, 2024 at 2:55 PM EET, Jarkko Sakkinen wrote: > On Mon, 2024-02-05 at 13:06 -0800, Haitao Huang wrote: > > The scripts rely on cgroup-tools package from libcgroup [1]. > > > > To run selftests for epc cgroup: > > > > sudo ./run_epc_cg_selftests

Re: [PATCH v7 2/2] arch/riscv: Enable kprobes when CONFIG_MODULES=n

2024-03-27 Thread Jarkko Sakkinen
On Tue Mar 26, 2024 at 8:42 PM EET, Conor Dooley wrote: > On Tue, Mar 26, 2024 at 03:46:16PM +0200, Jarkko Sakkinen wrote: > > Tacing with kprobes while running a monolithic kernel is currently > > impossible due the kernel module allocator dependency. > > > > Addres

Re: [PATCH v4 02/14] mm: Switch mm->get_unmapped_area() to a flag

2024-03-27 Thread Jarkko Sakkinen
On Wed, 2024-03-27 at 02:42 +, Edgecombe, Rick P wrote: > On Tue, 2024-03-26 at 13:57 +0200, Jarkko Sakkinen wrote: > > In which conditions which path is used during the initialization of > > mm > > and why is this the case? It is an open claim in the current f

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

2024-03-27 Thread Jarkko Sakkinen
On Mon, 2024-02-05 at 13:06 -0800, Haitao Huang wrote: > The scripts rely on cgroup-tools package from libcgroup [1]. > > To run selftests for epc cgroup: > > sudo ./run_epc_cg_selftests.sh > > To watch misc cgroup 'current' changes during testing, run this in a > separate terminal: > > ./watch

Re: [PATCH v2] arch/riscv: Enable kprobes when CONFIG_MODULES=n

2024-03-26 Thread Jarkko Sakkinen
On Tue Mar 26, 2024 at 6:38 PM EET, Mark Rutland wrote: > On Wed, Mar 27, 2024 at 12:24:03AM +0900, Masami Hiramatsu wrote: > > On Tue, 26 Mar 2024 14:46:10 + > > Mark Rutland wrote: > > > > > > On Mon, Mar 25, 2024 at 11:56:32AM +0900, Masami Hiramatsu wrote: > > > > I think, we'd better to

Re: [PATCH v2] arch/riscv: Enable kprobes when CONFIG_MODULES=n

2024-03-26 Thread Jarkko Sakkinen
6:32AM +0900, Masami Hiramatsu wrote: > > > > Hi Jarkko, > > > > > > > > On Sun, 24 Mar 2024 01:29:08 +0200 > > > > Jarkko Sakkinen wrote: > > > > > > > > > Tracing with kprobes while running a monolithic kernel is cu

Re: [PATCH v2] arch/riscv: Enable kprobes when CONFIG_MODULES=n

2024-03-26 Thread Jarkko Sakkinen
On Tue Mar 26, 2024 at 5:24 PM EET, Masami Hiramatsu (Google) wrote: > On Tue, 26 Mar 2024 14:46:10 + > Mark Rutland wrote: > > > Hi Masami, > > > > On Mon, Mar 25, 2024 at 11:56:32AM +0900, Masami Hiramatsu wrote: > > > Hi Jarkko, > > > > >

Re: [PATCH v5 1/2] kprobes: textmem API

2024-03-26 Thread Jarkko Sakkinen
On Tue Mar 26, 2024 at 5:05 PM EET, Masami Hiramatsu (Google) wrote: > > According to kconfig-language.txt: > > > > "select should be used with care. select will force a symbol to a value > > without visiting the dependencies." > > > > So the problem here lies in KPROBES config entry using select

Re: [PATCH v5 2/2] arch/riscv: Enable kprobes when CONFIG_MODULES=n

2024-03-26 Thread Jarkko Sakkinen
On Tue Mar 26, 2024 at 6:49 PM EET, Jarkko Sakkinen wrote: > On Tue Mar 26, 2024 at 3:57 PM EET, Alexandre Ghiti wrote: > > Hi Jarkko, > > > > On 25/03/2024 22:55, Jarkko Sakkinen wrote: > > > Tacing with kprobes while running a monolithic kernel is currently > >

Re: [PATCH v2] arch/riscv: Enable kprobes when CONFIG_MODULES=n

2024-03-26 Thread Jarkko Sakkinen
On Tue Mar 26, 2024 at 4:46 PM EET, Mark Rutland wrote: > Hi Masami, > > On Mon, Mar 25, 2024 at 11:56:32AM +0900, Masami Hiramatsu wrote: > > Hi Jarkko, > > > > On Sun, 24 Mar 2024 01:29:08 +0200 > > Jarkko Sakkinen wrote: > > > > > Tracing w

Re: [PATCH v5 2/2] arch/riscv: Enable kprobes when CONFIG_MODULES=n

2024-03-26 Thread Jarkko Sakkinen
On Tue Mar 26, 2024 at 3:57 PM EET, Alexandre Ghiti wrote: > Hi Jarkko, > > On 25/03/2024 22:55, Jarkko Sakkinen wrote: > > Tacing with kprobes while running a monolithic kernel is currently > > impossible due the kernel module allocator dependency. > > > >

[PATCH v7 2/2] arch/riscv: Enable kprobes when CONFIG_MODULES=n

2024-03-26 Thread Jarkko Sakkinen
g/all/2022060814.3054333-1-jar...@profian.com/ # continuation Signed-off-by: Jarkko Sakkinen --- v5-v7: - No changes. v4: - Include linux/execmem.h. v3: - Architecture independent parts have been split to separate patches. - Do not change arch/riscv/kernel/module.c as it is out of scope for

[PATCH v7 1/2] kprobes: Implement trampoline memory allocator for tracing

2024-03-26 Thread Jarkko Sakkinen
//Kconfig. Link: https://lore.kernel.org/all/20240325115632.04e37297491cadfbbf382...@kernel.org/ Suggested-by: Masami Hiramatsu Signed-off-by: Jarkko Sakkinen --- v7: - Use "depends on" for ALLOC_EXECMEM instead of "select" - Reduced and narrowed CONFIG_MODULES checks furt

Re: [PATCH v5 1/2] kprobes: textmem API

2024-03-26 Thread Jarkko Sakkinen
On Tue Mar 26, 2024 at 4:01 AM EET, Jarkko Sakkinen wrote: > On Tue Mar 26, 2024 at 3:31 AM EET, Jarkko Sakkinen wrote: > > > > +#endif /* _LINUX_EXECMEM_H */ > > > > diff --git a/kernel/kprobes.c b/kernel/kprobes.c > > > > index 9d9095e81792..87fd8c14a93

Re: [PATCH v4 02/14] mm: Switch mm->get_unmapped_area() to a flag

2024-03-26 Thread Jarkko Sakkinen
On Tue Mar 26, 2024 at 4:16 AM EET, Rick Edgecombe wrote: > The mm_struct contains a function pointer *get_unmapped_area(), which > is set to either arch_get_unmapped_area() or > arch_get_unmapped_area_topdown() during the initialization of the mm. In which conditions which path is used during the

  1   2   3   4   5   6   7   8   9   10   >