Re: [Nouveau] [PATCH] mm: Take a page reference when removing device exclusive entries

2023-03-29 Thread Alistair Popple
Alistair Popple writes: > John Hubbard writes: > >> On 3/28/23 20:16, Matthew Wilcox wrote: >> ... + if (!get_page_unless_zero(vmf->page)) + return 0; >>> From a folio point of view: what the hell are you doing here? Tail >>> pages don't have individual refcounts; all

Re: [Nouveau] [PATCH] mm: Take a page reference when removing device exclusive entries

2023-03-29 Thread Alistair Popple
John Hubbard writes: > On 3/28/23 20:16, Matthew Wilcox wrote: > ... >>> + if (!get_page_unless_zero(vmf->page)) >>> + return 0; >> From a folio point of view: what the hell are you doing here? Tail >> pages don't have individual refcounts; all the refcounts are actually I had

Re: [Nouveau] [PATCH] mm: Take a page reference when removing device exclusive entries

2023-03-28 Thread John Hubbard
On 3/28/23 20:16, Matthew Wilcox wrote: ... + if (!get_page_unless_zero(vmf->page)) + return 0; From a folio point of view: what the hell are you doing here? Tail pages don't have individual refcounts; all the refcounts are actually ohh, and I really should have caught

Re: [Nouveau] [PATCH] mm: Take a page reference when removing device exclusive entries

2023-03-28 Thread Matthew Wilcox
On Tue, Mar 28, 2023 at 01:14:34PM +1100, Alistair Popple wrote: > +++ b/mm/memory.c > @@ -3623,8 +3623,19 @@ static vm_fault_t remove_device_exclusive_entry(struct > vm_fault *vmf) > struct vm_area_struct *vma = vmf->vma; > struct mmu_notifier_range range; > > - if

Re: [Nouveau] [PATCH] mm: Take a page reference when removing device exclusive entries

2023-03-28 Thread Alistair Popple
John Hubbard writes: >> warnings such as PAGE_FLAGS_CHECK_AT_FREE due to the page being locked >> when the refcount drops to zero. Note that during removal of the >> device exclusive entry the PTE is currently re-checked under the PTL >> so no futher bad page accesses occur once it is locked.

Re: [Nouveau] [PATCH] mm: Take a page reference when removing device exclusive entries

2023-03-28 Thread Ralph Campbell
On 3/27/23 19:14, Alistair Popple wrote: Device exclusive page table entries are used to prevent CPU access to a page whilst it is being accessed from a device. Typically this is used to implement atomic operations when the underlying bus does not support atomic access. When a CPU thread

Re: [Nouveau] [PATCH] mm: Take a page reference when removing device exclusive entries

2023-03-28 Thread Andrew Morton
On Mon, 27 Mar 2023 23:25:49 -0700 John Hubbard wrote: > On the patch process, I see that this applies to linux-stable's 6.1.y > branch. I'd suggest two things: > > 1) Normally, what I've seen done is to post against either the current > top of tree linux.git, or else against one of the

Re: [Nouveau] [PATCH] mm: Take a page reference when removing device exclusive entries

2023-03-28 Thread John Hubbard
On 3/27/23 19:14, Alistair Popple wrote: > Device exclusive page table entries are used to prevent CPU access to > a page whilst it is being accessed from a device. Typically this is > used to implement atomic operations when the underlying bus does not > support atomic access. When a CPU thread

[Nouveau] [PATCH] mm: Take a page reference when removing device exclusive entries

2023-03-27 Thread Alistair Popple
Device exclusive page table entries are used to prevent CPU access to a page whilst it is being accessed from a device. Typically this is used to implement atomic operations when the underlying bus does not support atomic access. When a CPU thread encounters a device exclusive entry it locks the