Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp423490lqp; Tue, 11 Jun 2024 08:19:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWw/bv279I9NOG9a/VWkL5wVBXvFN6VDAbCq6QrfX4TJaSdQZd00mBBGrNUlg0nkuu9xS2cdEEmzPdHQCZy1TlKnyMmsAyG1CFZUEjSLA== X-Google-Smtp-Source: AGHT+IE5l7mw3pQU5ZIX9Kkltv2h+g+TgT48mLLEsQ+TipdHV7lP6syOtKuT/FKb+qD/P1laUxQn X-Received: by 2002:a50:8704:0:b0:579:cf9d:d6a with SMTP id 4fb4d7f45d1cf-57c508eae17mr7601856a12.20.1718119139956; Tue, 11 Jun 2024 08:18:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718119139; cv=pass; d=google.com; s=arc-20160816; b=jCGDIqmOF1zg9cCjlx9dfZMqzL3F+3LADAAeT+1NW7bpHr0nWwwp/8rr4m1LSrIaGi nly02otz9RYRS5PcmZ4DYVJASv/jp70v7hjF3EfRVCVP7o8U1+py3IeBBothpzEz9WYp 8/acEogldNn9gMu3dQIvjrvNCDA/rAYTxbcfWzIme3JQucBVixEfX8LRaTUnixBi784B j8it4EVzuSpkUF4We8Ma3SLEft5ebA96oUGgpBvO/xM61pty/I2lNswz3UXHyw9NNklT 6n7rAth0hCarqW5tQ0Zv/MkxHewCqoo8Bb6182+3ss8m7mKTGG6G1Cxhleu1kdIZxT+L Uf8g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=s4BYFzX/+X9ca054SpVdmOqNg7k/NngZVUqS7vudtYE=; fh=gLs0KKxOeI77QmPJ+MtsP6Hfuot6mnwl/E8OyMotb40=; b=0bCu5ozh5ar5Q1fWXBxERqu+qXsB3ru2PPrLims9iiE94+ocswaw/hKkCspelhrQud Itf6FGyb/v5gQOQ1yYqRxmIcT5Q4cskfVjHCjQTm3qj1fCR9cerz7kJs8J+xQfw0I+RG 0uIFBGzrtPqKNIp72xzffG1TgLBjKCwVSZcNMgSb0acZHDfFuxxvZrT0QYbpOJ25pF1g xaZMgm3lqX3ObYYSgU6hyuZ5Q2k+NBgFpXnmGfBXzdOREhQknAqP+yRfWhMjjnqfmsbC Ac1v4GcmtAfL6ToD7WnebqnoYJEk2ScoCtXewNR9DbaQ5DeUyZGhx+EwGDAN0hVppSfu GDFQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=amiGg5pX; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=n9yimVyw; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-210133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c67b4d655si4057220a12.339.2024.06.11.08.18.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 08:18:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=amiGg5pX; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=n9yimVyw; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-210133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 59AD31F26542 for ; Tue, 11 Jun 2024 15:09:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5860F1BF53; Tue, 11 Jun 2024 15:08:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="amiGg5pX"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="RM8TGgBP"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="n9yimVyw"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="60FqZ/E0" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40EBB18E1E for ; Tue, 11 Jun 2024 15:08:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718118536; cv=none; b=L6k77Deg9hfcvLtkaW2eWjAF9xbcGWSUZ7Iw/zCqJ/LigEhOO0+sj05zw6o3cpuYb8lRPJxTagZColoiDjIzsMALm0Cz8qGPYWkkQwZvlLV/SYWklrPShEptaol/LXAGhgkVpoRZ9DIPH4cvehFu7qq9a5UF7EcbrqZu+QxYBQA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718118536; c=relaxed/simple; bh=Dv6mW4SpJSIZgCdXcBj1UMQiEcYIQxloJc4cdnFnR8Q=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Et78UDfZHD2L3nvYY3YlqBSoFt1UI3tljGefqkK7TGcEeoMqyfdaGc1c9h8HbkM5NauvBq1eYAKg6rJtuA/4T+fcI+rvA7kboWYZ/BVXr6MzIxg7eMUGqdUzl05yjg8dK+3apNeabodSgGdoup/d7hOsI0OfamRge88oaPceVcM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=amiGg5pX; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=RM8TGgBP; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=n9yimVyw; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=60FqZ/E0; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3D50420812; Tue, 11 Jun 2024 15:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718118532; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=s4BYFzX/+X9ca054SpVdmOqNg7k/NngZVUqS7vudtYE=; b=amiGg5pXx+ZWkXQuJ0pvVDX+REW1GEP+EiPrTGnzbbEbGSubmQSi7EqhGl6loZKuNuTo41 AAgA6gHVAyg4pw29IKVF6w5+7lxtSoCJ0U9eraO1ZprDFRB7+j+h3VZ95z/iF0t/vb39eq f2XkdBjIHOiQ3KqH2uDK5u0SFRTqrrI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718118532; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=s4BYFzX/+X9ca054SpVdmOqNg7k/NngZVUqS7vudtYE=; b=RM8TGgBPhfBP5SdPI5FXfUgPrJgths3IZankUWWEWWS9eXX03ez+GkFV+wNHIYNpR6zUUd 4Xvxl+ePj3Ob1LCw== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718118531; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=s4BYFzX/+X9ca054SpVdmOqNg7k/NngZVUqS7vudtYE=; b=n9yimVywfNO7ayn002mzdzBkcdRTSue3Ns/qWgRhIKCqXZXWzSLGf5lz5VXD85d9ChsVNu k2aRUvD5CcMrC/VPhHe5yYbpLpo9E7ayP2VzTETp1pnp8AM5HFaj0VLXpNKkRnMEn/vk1F Z5Vo52WN1+sglJOAQV7SV2vzdRQEUtw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718118531; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=s4BYFzX/+X9ca054SpVdmOqNg7k/NngZVUqS7vudtYE=; b=60FqZ/E0iS7JJlNd2pLs1pnwC306tkeiXBIehBMTrto/DvKrdaf4YFoh/otgH6iy0n6EIJ PY25FEjsBAlR0IBQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id B8AF7137DF; Tue, 11 Jun 2024 15:08:50 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id LH+fKoJoaGaTXAAAD6G6ig (envelope-from ); Tue, 11 Jun 2024 15:08:50 +0000 Date: Tue, 11 Jun 2024 17:08:45 +0200 From: Oscar Salvador To: Peter Xu Cc: Christophe Leroy , Andrew Morton , Jason Gunthorpe , Michael Ellerman , Nicholas Piggin , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH v5 02/18] mm: Define __pte_leaf_size() to also take a PMD entry Message-ID: References: <172b11c93e0de7a84937af2da9f80bd17c56b8c9.1717955558.git.christophe.leroy@csgroup.eu> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Score: -8.30 X-Spam-Level: X-Spam-Flag: NO X-Spamd-Result: default: False [-8.30 / 50.00]; REPLY(-4.00)[]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[9]; MISSING_XM_UA(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[csgroup.eu,linux-foundation.org,nvidia.com,ellerman.id.au,gmail.com,vger.kernel.org,kvack.org,lists.ozlabs.org]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo] On Tue, Jun 11, 2024 at 10:17:30AM -0400, Peter Xu wrote: > Oscar, > > On Tue, Jun 11, 2024 at 11:34:23AM +0200, Oscar Salvador wrote: > > Which means that they would be caught in the following code: > > > > ptl = pmd_huge_lock(pmd, vma); > > if (ptl) { > > - 8MB hugepages will be handled here > > smaps_pmd_entry(pmd, addr, walk); > > spin_unlock(ptl); > > } > > /* pte stuff */ > > ... > > Just one quick comment: I think there's one challenge though as this is > also not a generic "pmd leaf", but a pgtable page underneath. I think it > means smaps_pmd_entry() won't trivially work here, e.g., it will start to > do this: > > if (pmd_present(*pmd)) { > page = vm_normal_page_pmd(vma, addr, *pmd); > > Here vm_normal_page_pmd() will only work if pmd_leaf() satisfies its > definition as: > > * - It should contain a huge PFN, which points to a huge page larger than > * PAGE_SIZE of the platform. The PFN format isn't important here. > > But now it's a pgtable page, containing cont-ptes. Similarly, I think most > pmd_*() helpers will stop working there if we report it as a leaf. Heh, I think I managed to confuse myself. I do not why but I thought that static inline pte_t huge_ptep_get(struct mm_struct *mm, unsigned long addr, pte_t *ptep) { if (ptep_is_8m_pmdp(mm, addr, ptep)) ptep = pte_offset_kernel((pmd_t *)ptep, 0); return ptep_get(ptep); } would return the address of the pmd for 8MB hugepages, but it will return the address of the first pte? Then yeah, this will not work as I thought. The problem is that we do not have spare bits for 8xx to mark these ptes as cont-ptes or mark them pte as 8MB, so I do not see a clear path on how we could remove huge_ptep_get for 8xx. I am really curious though how we handle that for THP? Or THP on 8xx does not support that size? -- Oscar Salvador SUSE Labs