From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D52081E9B0B for ; Thu, 20 Feb 2025 12:44:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740055469; cv=none; b=Z3r2rVEWMKGznos+BdgKaLyQJiHyRw3lEUXKomR25js4fmrngUdqkGgQWApe2AHC6OuMQKk1fLh/8scOC1lj793BlOgbteybUWLja3nLb/kuMpRN5lA4SgFKP2Jf1ZPl72LoY1mcnEbxbeJ+jXLaSl9UCkCMc9qJHBDLmhK2DlY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740055469; c=relaxed/simple; bh=bPFiUomZF13Dz9mQWRWn2aK4Lk9XxmWw21ZdXhWu68M=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=RkiCjcrtdx1YjZktIj8Ko9GcuaA+4OfBAnuYUB9pBoIdsvOE/2L3uR5bMNog4NazPPmh7uUpl6S9afBvwxgPpNkJXOmqQC4HFCYpVfMkIFcPvQfzDHfpqiFpnFT/5w0Rpg6jKcRwrEjOc4xNECUX1GfpUGCdNKbghrkax1BMBJg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=V5rRcDv7; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="V5rRcDv7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1740055466; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=Aw2uty6j9x0fqEkPxv/nF0HlVK8X1BpwPiiIHwWFu90=; b=V5rRcDv7Rb/HXjvRU5rhyNkn/fvuR5f2nwzfP9PBCaMhGsOr2tD/0xkyXvnFAxvTC6Jyb/ xlWz3mEarLAsmADN3FBr8RCbAghSyZOX/ZqKAZVh4w/EzBWAYRjcXAU6z3AqrgpkcMbUFt ukOyNXF7Hz+9B/RRqqbsKtGNNTBHsUU= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-101-doruQ0GFNq6sLsqNve3uaA-1; Thu, 20 Feb 2025 07:44:25 -0500 X-MC-Unique: doruQ0GFNq6sLsqNve3uaA-1 X-Mimecast-MFC-AGG-ID: doruQ0GFNq6sLsqNve3uaA_1740055464 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-38f4e3e9c5bso393077f8f.1 for ; Thu, 20 Feb 2025 04:44:25 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740055464; x=1740660264; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=Aw2uty6j9x0fqEkPxv/nF0HlVK8X1BpwPiiIHwWFu90=; b=vW6ZTyNh061R9zv6eKdKyquLFNXbZEZGEuKpZDrVhGpX2vLJpxNQ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id ffacd0b85a97d-38f3406cd95mr18809405f8f.40.1740055464402; Thu, 20 Feb 2025 04:44:24 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWR1r+x5fxTVDkaeTb+DGmJUge83PhPNpWxQET+3WOp7mEtvkA8YLL3jY58yOBXvJyv+SzYA== X-Received: by 2002:a5d:58c3:0:b0:38d:e61a:bc7 with SMTP id ffacd0b85a97d-38f3406cd95mr18809375f8f.40.1740055463978; Thu, 20 Feb 2025 04:44:23 -0800 (PST) Received: from ?IPV6:2003:cb:c706:2000:e44c:bc46:d8d3:be5? (p200300cbc7062000e44cbc46d8d30be5.dip0.t-ipconnect.de. [2003:cb:c706:2000:e44c:bc46:d8d3:be5]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38f25915146sm20836738f8f.56.2025.02.20.04.44.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 20 Feb 2025 04:44:22 -0800 (PST) Message-ID: Date: Thu, 20 Feb 2025 13:44:20 +0100 Precedence: bulk X-Mailing-List: linux-api@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 0/4] mm: permit guard regions for file-backed/shmem mappings To: Lorenzo Stoakes Cc: Kalesh Singh , Andrew Morton , Suren Baghdasaryan , "Liam R . Howlett" , Matthew Wilcox , Vlastimil Babka , "Paul E . McKenney" , Jann Horn , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Shuah Khan , linux-kselftest@vger.kernel.org, linux-api@vger.kernel.org, John Hubbard , Juan Yescas References: <6e356431-5ac9-4363-b876-78a69ae7622a@lucifer.local> <4aa97b5c-3ddc-442b-8ec9-cc43ebe9e599@redhat.com> <387f3516-99f2-41e9-967e-4b051a8d21b8@redhat.com> <72e044ba-64af-49c0-8b87-ead508654fb7@lucifer.local> <4f5a9c19-9bdd-47eb-bb14-205e3dcced90@redhat.com> <1e959451-2534-44b7-bf62-bc75305048fe@lucifer.local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QWBXS lQCWmavOT9sttGQXdPCC5ynI+1ymZC1ORZKANLnRAb0NH/UCzcsstw2TAkFnMEbo9Zu9w7Kv AxBQXWeXhJI9XQssfrf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3 AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: <1e959451-2534-44b7-bf62-bc75305048fe@lucifer.local> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 20.02.25 11:15, Lorenzo Stoakes wrote: > On Thu, Feb 20, 2025 at 11:03:02AM +0100, David Hildenbrand wrote: >>>> Your conclusion is 'did not participate with upstream'; I don't agree with >>>> that. But maybe you and Kalesh have a history on that that let's you react >>>> on his questions IMHO more emotionally than it should have been. >>> >>> This is wholly unfair, I have been very reasonable in response to this >>> thread. I have offered to find solutions, I have tried to understand the >>> problem in spite of having gone to great lengths to try to discuss the >>> limitations of the proposed approach in every venue I possibly could. >>> >>> I go out of my way to deal professionally and objectively with what is >>> presented. Nothing here is emotional. So I'd ask that you please abstain >>> from making commentary like this which has no basis. >> >> I appreciate everything you write below. But this request is just >> impossible. I will keep raising my opinion and misunderstandings will >> happen. > > Well I wouldn't ask you not to express your opinion David, you know I respect > and like you, and by all means push back hard or call out what you think is bad > behaviour :) > > I just meant to say, in my view, that there was no basis, but I appreciate > miscommunications happen. > > So apologies if I came off as being difficult or rude, it actually wasn't > intended. And to re-emphasise - I have zero personal issue with anybody in this > thread whatsoever! It sounded to me like you were trying to defend your work (again, IMHO too emotionally, and I might have completely misinterpreted that) and slowly switching to "friendly fire" (towards me). Apologies from my side if I completely misunderstood/misinterpreted that. To recap: what we have upstream is great; you did a great job. Yes, the mechanism has its drawbacks, but that's just part of the design. Some people maybe have wrong expectations, maybe there were misunderstandings, or maybe there are requirements that only now pop up; it's sometimes unavoidable, and that's ok. We can try to document it better (and I was trying to find clues why people might be mislead), and see if/how we could sort out these requirements. But we can likely not make it perfect in any possible way (I'm sure there are plenty of use cases where what we currently have is more than sufficient). > > I just want to find the best way forward, technically and am willing to do > whatever work is required to make the guard region implementation as good as it > possibly can be. > >> >> Note that the whole "Honestly David you and the naming. .." thing could have >> been written as "I don't think it's a naming problem." > > I feel like I _always_ get in trouble when I try to write in a 'tongue-in-cheek' > style, which is what this was meant to be... so I think herein lies the basis of > the miscommunication :) > > I apologise, the household is ill, which maybe affects my judgment in how I > write these, but in general text is a very poor medium. It was meant to be said > in a jolly tone with a wink... > > I think maybe I should learn my lesson with these things, I thought the ':p' > would make this clear but yeah, text, poor medium. > > Anyway apologies if this seemed disrespectful. No worries, it's hard to really make me angry, and I appreciate your openness and your apology (well, and you and your work, obviously). I'll note, though, if my memory serves me right, that nobody so far ever criticized the way I communicate upstream, or even told me to abstain from certain communication. That probably hurt most, now that a couple of hours passed. Nothing that a couple of beers and a bit of self-reflection on my communication style can't fix ;) [...] >>>>> Yeah that's a good point, but honestly if you're reading smaps that reads >>>>> the page tables, then reading /proc/$pid/pagemaps and reading page tables >>>>> TWICE that seems inefficient vs. just reading /proc/$pid/maps, then reading >>>>> /proc/$pid/pagemaps and reading page tables once. >>>> >>>> Right; I recently wished that we would have an interface to obtain more VMA >>>> flags without having to go through smaps >>> >>> Well maybe that lends itself to the idea of adding a whole new interface in >>> general... >> >> An extended "maps" interface might be reasonable, that allows for exposing >> more things without walking the page tables. (e.g., flags) >> >> Maybe one could have an indicator that says "ever had guard regions in this >> mapping" without actually walking the page tables. > > Yeah this is something we've discussed before, but it's a little fraught. Let's > say it was a VMA flag, in this case we'd have to make this flag 'sticky' and not > impact merging (easy enough) to account for splits/merges. > > The problem comes in that we would then need to acquire the VMA write lock to do > it, something we don't currently require on application of guard regions. Right, and we shouldn't write-lock the mmap. We'd need some way to just atomically set such an indicator on a VMA. I'll also note that it might be helpful for smallish region, but especially for large ones (including when they are split and the indicator is wrong), it's less helpful. I don't have to tell you about the VMA merging implications, probably it would be like VM_SOFTDIRTY handling :) > > We'd also have to make sure nothing else makes any assumptions about VMA flags > implying differences in VMAs in this one instance (though we do already do this > for VM_SOFTDIRTY). > > I saw this as possibly something like VM_MAYBE_GUARD_REGIONS or something. Yes. -- Cheers, David / dhildenb