Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp59174lqp; Tue, 11 Jun 2024 14:43:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXK7+rK5t296B2Rl+2AXv8fLt9XFG2IKAGjeRVbyQpJyL5D1OHD5IPQXU2t7zZL0pwECjbtOF+A9ydqUC23NdW7SLLipMAVaXvXC1D+/Q== X-Google-Smtp-Source: AGHT+IHr6Z64R30QRHPzkRtWOKMkLYHiVeto3b662ETnKgHqqxHRdMcp/bm545t6tPMGvQFjB8Fg X-Received: by 2002:ac8:5a0b:0:b0:440:51af:2986 with SMTP id d75a77b69052e-44051af2c27mr117846161cf.57.1718142237868; Tue, 11 Jun 2024 14:43:57 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718142237; cv=pass; d=google.com; s=arc-20160816; b=cRAmGd1y1b8xbFjtwkkAMHbffMgpX+d2LrwFCy3WO26NJpmzw/f222nMVJ30/ab0tN zT4nXspv91nnV0RrUcQAiuOeiRnWDnFnfQxPxGw3SB3gaD9p7CJXu4ybDzYNA8jQGfk3 hkuSN4AUYibAAQcLMYZJ6cQjEBtfRh/jojFjXhgSK6Fp2EYrPMaqTHpX8LuYurf+Ni8y RUf9qLncP96PUrVUY+qFkYNjPZi0wI00wvkbslPcdTykfSlK1i7sZ7RVu9Og7pKUoBJC IjhuOx0rBT6utAp3D28Ta9HU8QTyhHtLUWOLFyMyq2mXMvHysTmjwfYDP2xBtqU9rr5q 22jQ== 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; bh=hTou1qm81TgVNA2Djt+o16mxlwm2tQTw5dfTSjdkG/I=; fh=UQ623EtXcjR0JXgTxv7VDM/8oSUfv/ij0silSRl09Po=; b=qZVyOI0oTJ+1fECABYMVa/AdB2JD6Wm6BJm2tRWSyojjLFK5Lfnf+lCBjOJ+4SEgVQ 1mxTWeEKxBHLfpKMIkSFXEyIEeXHqDNuxw4uR/lx7YrSDuHFh1j/xokLCVJYZY9js5u+ RRlki5WGTfxKQ8IcKFg+bV+KXdmMyJ9Y4GSC66jsNh7QgUSG6bid6q24jPjRvyTFczRE FQ2Gga1Zur0JhVX0SwNQkQ1ezaCp9KHLL1zDzdI7Uk86deagQKR50x7rQ6FAl+U760ct UtvhfpdQM4JN2ySUqgTtrYgVm3j87vlI2hCRRc8vs72noEvLNr3U4h4uIO9RmR3cj4kn OkKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xy5AzKOw; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-210624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d75a77b69052e-4405a5a02d7si84567461cf.465.2024.06.11.14.43.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 14:43:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xy5AzKOw; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-210624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9565E1C22599 for ; Tue, 11 Jun 2024 21:43:57 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6E94A15383D; Tue, 11 Jun 2024 21:43:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Xy5AzKOw" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 090242CCB7 for ; Tue, 11 Jun 2024 21:43:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718142232; cv=none; b=GnL0EB0HAOiTRblB1+Lr1pZgJqic6/L/8wjEu4hrhpaZyuUYIgK5yUSgJDv5qaqz0Gnj6lSEn6kQrLAsP6gvBMIpXUBpcCZpDa6L90f3BpDeXfyruGEl2+unpzt30ELQBQX7wI1hTguMLhQvvDSUP3jASgQDgAPCT9DgRaxR5wM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718142232; c=relaxed/simple; bh=4bEauCXpT8+5T6IdGZVJG5R/Lvn0TYgN6qLg45590a0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=upU0zF6yHmIN5SmEZaQt4nTd/GBNpCOk6h6C6Qhhs0LDQWUzpRbxGj47AC2aLY+k5R7eRabxcZxyDsLfioiHUp2B4r3ID4EGNjDmEnaOfDs61lMflUjT6jXL5xUTgq5A4fpn/6YCjUi6CVpMztVqJoz7p43/+T+/bRBT8JlfEQc= 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=Xy5AzKOw; arc=none smtp.client-ip=170.10.133.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 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718142229; 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: in-reply-to:in-reply-to:references:references; bh=hTou1qm81TgVNA2Djt+o16mxlwm2tQTw5dfTSjdkG/I=; b=Xy5AzKOwcRto83bhZi11MuyEqv2a6xuWF5UhzhobZSQUhl3HC8XzSeHN9PMIupzH2GXEUn N7zGAWicqg35VdOXeAJn7sKu6+2rosWYxctx2tVNSgAZSI7VH07vyAjr1oCcEa6zlcnf3x IEU7hApo+I3NP9EeTvggsb+osdarkYM= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-456-AzYQR6lyPua1fLtCHXFBRg-1; Tue, 11 Jun 2024 17:43:48 -0400 X-MC-Unique: AzYQR6lyPua1fLtCHXFBRg-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-79560b25fc4so26429385a.3 for ; Tue, 11 Jun 2024 14:43:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718142227; x=1718747027; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=hTou1qm81TgVNA2Djt+o16mxlwm2tQTw5dfTSjdkG/I=; b=V3exidOTLKcAJHoXTYPHzE68EfKJDri/bL3AJ86bV9mmEol+GUVM12yDV0ECdKbJfD WidbObbgtOBmPxff9hH2xgAoRqOilBiQhbMzQTpz/QgzNeN7o1pJmnKJMilvv5dNhyYr Xrsu+yF8vnLcu4P4nthEfPCtM00BZNsXffbkMhjAGH7YegpXmsGOfLl+onSmRKazPWNw kt0XqkyVkbv0wY8sysLKLDNO5NYuK2gmfCCXMkbbUR/XhgHWpoyPKg/XrBHc606geG6r frIbL4VahQAgC1Lq3AJ7YD3fDx9dmTK4SeZuyRqxgVTZo1Ahbh6Ks9I/cYRwrydmR+9Z auIA== X-Forwarded-Encrypted: i=1; AJvYcCULwISNP1HLELLuK9ZJg59psBqDrdLaUm/f5/NhkdbsNzshNR+efv5BkO+tk0/5XK8BQ+nrpqeN/PmGFcWNfs1FH74ObUIXJ2++mzm4 X-Gm-Message-State: AOJu0YxiA8sUf3H1utcTx2rLM46851iAT8/bxjv0gKerZIPjC6ezQz7X HcwdEY+jU0UDQoxEpE4AE9x15PSO7Ne19M5N2fZ27COIGKyQzrthyb2kluzRe9KjI7xcjPar0WI QXSM0k2hy3JGCATfa9mgTrkt2OWC8a+xiFmucijI2eC9aoGG+YB0DszAfZQ+r7Gxzqah4BQ== X-Received: by 2002:a05:6214:1c84:b0:6af:f955:3a92 with SMTP id 6a1803df08f44-6b05985d61dmr145506606d6.0.1718142227182; Tue, 11 Jun 2024 14:43:47 -0700 (PDT) X-Received: by 2002:a05:6214:1c84:b0:6af:f955:3a92 with SMTP id 6a1803df08f44-6b05985d61dmr145506356d6.0.1718142226586; Tue, 11 Jun 2024 14:43:46 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6b04f984940sm61002196d6.89.2024.06.11.14.43.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 14:43:46 -0700 (PDT) Date: Tue, 11 Jun 2024 17:43:43 -0400 From: Peter Xu To: LEROY Christophe Cc: Oscar Salvador , 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=utf-8 Content-Disposition: inline In-Reply-To: On Tue, Jun 11, 2024 at 07:00:14PM +0000, LEROY Christophe wrote: > But what about something like > > static inline pte_t pmd_pte(pmd_t pmd) > { > return *(pte_t *)pmd_page_vaddr(pmd); > } > > Would it do the trick ? > > Of course it would require to carefully make sure all accesses are done > through pmd_pte(). > > Would that work ? Looks possible to me. It's just that we may miss some spots, and it can hide in the details. I'm looking at Power's pmd_access_permitted() right below pmd_write(), which indeed uses pmd_pte() already. However before that there's also the other call to pmd_is_serializing(), which doesn't look alright to work on pgtable pages.. In this case maybe it's easy, as I assume pgtable page is stable. Didn't further look, though. Said that, this doesn't look like a blocker. So maybe worth trying if we're careful and with some good testing coverages. Thanks, -- Peter Xu