linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Peter Xu <peterx@redhat.com>
Cc: Yan Zhao <yan.y.zhao@intel.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Alex Williamson <alex.williamson@redhat.com>,
	Jason Gunthorpe <jgg@nvidia.com>,
	Al Viro <viro@zeniv.linux.org.uk>,
	Dave Hansen <dave.hansen@linux.intel.com>,
	Andy Lutomirski <luto@kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
	"Kirill A . Shutemov" <kirill@shutemov.name>,
	"x86@kernel.org" <x86@kernel.org>,
	"Tian, Kevin" <kevin.tian@intel.com>,
	Pei Li <peili.dev@gmail.com>, David Wang <00107082@163.com>,
	Bert Karwatzki <spasswolf@web.de>,
	Sergey Senozhatsky <senozhatsky@chromium.org>
Subject: Re: [PATCH] mm/x86/pat: Only untrack the pfn range if unmap region
Date: Tue, 23 Jul 2024 23:36:51 +0200	[thread overview]
Message-ID: <f48c1a91-8ed1-447d-93ad-449f28753c5c@redhat.com> (raw)
In-Reply-To: <ZqASQCobvpB_VfCL@x1n>

On 23.07.24 22:27, Peter Xu wrote:
> On Mon, Jul 22, 2024 at 11:17:57AM +0200, David Hildenbrand wrote:
>> What we do have is a single VMA, whereby within that VMA we place various
>> different PFN ranges. (randomly looking at drivers/video/fbdev/smscufx.c)
>>
>> These wouldn't have triggered VM_PAT code.
> 
> Right, it looks like VM_PAT is only applying to a whole-vma mapping, even
> though I don't know how that was designed..
> 
> I wished vma->vm_pgoff was for storing the base PFN for VM_SHARED too: now
> it only works like that for CoW mappings in remap_pfn_range_notrack(), then
> it looks like VM_SHARED users of remap_pfn_range() can reuse vm_pgoff, and
> I think VFIO does reuse it at least..
> 
> I am a bit confused on why Linux made that different for VM_SHARED,
> probably since b3b9c2932c32 ("mm, x86, pat: rework linear pfn-mmap
> tracking").  I wished vm_pgoff was always used for internal maintenance
> (even for VM_SHARED) so this issue should be easier to solve.
> 
> Maybe we can still re-define vm_pgoff for VM_SHARED pfnmaps? The caller
> should always be able to encode information in vm_private_data anyway.
> But I think that might break OOT users..

Yeah, I played with this idea when trying to remove the page table walk 
and storing it in the VMA, avoiding consuming more memory. The vm_pgoff 
usage for VM_PFNMAP mappings that I could spot looked nasty enough for 
me to not dare trying.

I wonder if we could just let relevant users do the PAT handling 
manually: I'm also not sure how many remap_pfn_range users end up 
triggering VM_PAT code although they don't really have to (just because 
they happen to cover a full VMA)?

One nasty thing is fork(), I was wondering if relevant users really rely 
on that or if we could force these VMAs to simply not get copied during 
fork. During fork() we have to "duplicate" the reservation ...

No real solution yet :/ Getting id of the page table walk is possible (I 
can try digging up the patch I was able to come up with), but it feels 
like the wrong approach.

The owner of the VMA should have that information ...

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2024-07-23 21:37 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-12 14:42 Peter Xu
2024-07-13  1:18 ` David Hildenbrand
2024-07-13  3:36 ` David Wang
2024-07-14 10:59 ` David Wang
2024-07-14 18:27   ` [PATCH] " David Hildenbrand
2024-07-15 15:03     ` Peter Xu
2024-07-17 14:14       ` David Hildenbrand
2024-07-17 16:27         ` Peter Xu
2024-07-15  7:08 ` Yan Zhao
2024-07-15 14:29   ` Peter Xu
2024-07-16  9:13     ` Yan Zhao
2024-07-16 19:01       ` Peter Xu
2024-07-17  1:38         ` Yan Zhao
2024-07-17 14:15           ` Peter Xu
2024-07-18  1:50             ` Yan Zhao
2024-07-18 14:03               ` Peter Xu
2024-07-18 23:18                 ` Yan Zhao
2024-07-19  8:28                   ` David Hildenbrand
2024-07-19 14:13                     ` Peter Xu
2024-07-22  6:49                       ` Yan Zhao
2024-07-22 13:52                         ` Peter Xu
2024-07-22  6:43                     ` Yan Zhao
2024-07-22  9:17                       ` David Hildenbrand
2024-07-23 20:27                         ` Peter Xu
2024-07-23 21:36                           ` David Hildenbrand [this message]
2024-07-23 21:44                             ` Jason Gunthorpe
2024-07-24  8:53                               ` David Hildenbrand
2024-07-17 14:17         ` David Hildenbrand
2024-07-17 16:30           ` Peter Xu
2024-07-17 16:31             ` Jason Gunthorpe
2024-07-17 18:10               ` Peter Xu
2024-07-17 16:32             ` David Hildenbrand
2024-07-17 18:12               ` Peter Xu
2024-07-20  2:18 ` Liam R. Howlett
2024-07-22 15:15   ` Peter Xu
2024-07-22 20:22     ` Liam R. Howlett
2024-07-22 21:17       ` Peter Xu
2024-07-23 10:12         ` David Hildenbrand
2024-07-23 17:58           ` Liam R. Howlett

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f48c1a91-8ed1-447d-93ad-449f28753c5c@redhat.com \
    --to=david@redhat.com \
    --cc=00107082@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex.williamson@redhat.com \
    --cc=bp@alien8.de \
    --cc=dave.hansen@linux.intel.com \
    --cc=jgg@nvidia.com \
    --cc=kevin.tian@intel.com \
    --cc=kirill@shutemov.name \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peili.dev@gmail.com \
    --cc=peterx@redhat.com \
    --cc=peterz@infradead.org \
    --cc=senozhatsky@chromium.org \
    --cc=spasswolf@web.de \
    --cc=tglx@linutronix.de \
    --cc=viro@zeniv.linux.org.uk \
    --cc=x86@kernel.org \
    --cc=yan.y.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox