While trying newer tests, the non-initialization logic of SGL's became apparent. Also, newer tests invoke get_user_pages() without faulting in corresponding pages, so we need to automatically allocate the pages.
Clean up to do reference counting in get_user_pages() etc will come later. Signed-off-by: Kanoj Sarcar <[email protected]> --- kern/drivers/net/udrvr/compat.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/kern/drivers/net/udrvr/compat.c b/kern/drivers/net/udrvr/compat.c index 436240f..93890d6 100644 --- a/kern/drivers/net/udrvr/compat.c +++ b/kern/drivers/net/udrvr/compat.c @@ -77,9 +77,19 @@ int get_user_page(struct proc *p, unsigned long uvastart, int write, int force, goto err1; if (!pte_is_present(pte)) { + struct page *pp; + unsigned long prot = PTE_P | PTE_U | PTE_A | PTE_W | PTE_D; +#if 0 printk("[akaros]: get_user_page() uva=0x%llx pte absent\n", uvastart); - goto err1; +#endif + /* + * TODO: ok to allocate with pte_lock? "prot" needs to be + * based on VMR writability, refer to pgprot_noncached(). + */ + if (upage_alloc(p, &pp, 0)) + goto err1; + pte_write(pte, page2pa(pp), prot); } if (write && (!pte_has_perm_urw(pte))) { @@ -100,6 +110,7 @@ int sg_alloc_table(struct sg_table *ptr, unsigned int npages, gfp_t mask) { ptr->sgl = kmalloc((sizeof(struct scatterlist) * npages), mask); ptr->nents = ptr->orig_nents = npages; + sg_init_table(ptr->sgl, npages); return 0; } -- You received this message because you are subscribed to the Google Groups "Akaros" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/d/optout.
