Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp3026520lqo; Tue, 21 May 2024 04:57:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU+0xyNOZ+wYKE5FGqXgDH60cJT2Nn1RYZKdNY4xrv+fWNsB1EZ1GbeRq1epDw8FFFf9DqMPRbuC8WL7BGpm2fl9O1hW1Xm7TFxqwTjsQ== X-Google-Smtp-Source: AGHT+IHyEhgFtghYeFzSz/n79gDe43YNq6QoI0TEwDjpACBomdw5rSI4WeD7mfLdOIhfvo+jCujh X-Received: by 2002:ac2:53a4:0:b0:521:9963:3896 with SMTP id 2adb3069b0e04-5220fc6da32mr17582987e87.41.1716292679226; Tue, 21 May 2024 04:57:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716292679; cv=pass; d=google.com; s=arc-20160816; b=qEvsmpgtW1SmyOhx8vhUKMMvM+z3glf671nrV6L0zJlkWUSac4cNPJKPENCYYCAopX qpBvthByBiaeGnLpoKQ1/33zuQYMuE0fzVh+9Dk1yDtNfOx13N3Ji/xyUUhJjMXdagUW YpzWCL+D13o/iUYGbePAD347q1OzuqJ3od9TnViamOFum8sD7YGR8QAwkAl4nkrjKxRc ZDkE4RWN11Lccdf+ytjUId1KaX+Ui29I1Ubgy/E1MpiZ1OSVKktGrTlfFhEfF/hPvg0J lH8c/F5GONppg1zMZGtL82r+Oh0BeHmThW00gluZ9hsPWLDZD+WxkhI0xFBWotSHRn2a kJ0A== 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; bh=dzeVyW39LqoyWWLKyKDjxIhWpkob/DeWMnc6kqHfElg=; fh=XobNcCcmv1RMbJWoPDiDSgmh3M3Zu3JoWQSiqVCYrVs=; b=NuuZx4sRSlijhN673nox4VH5IRvmjPQo4nel4WsYaL4ppr7VOI474IjRNNZjbg9E9G K4Ol64GjZp4+SDVO6jF3aT0zIKI6YAQPQqlH7//az/Im7Gw4kGLSR938UTqdSLnVDfPZ YG3OoBP5zCjIrc4gVDk4zZZFAg56jVoYg/cId7n27BIAU+G2uTZC59nwrCAHeqFqe3kb +NHO4m6zjhsQoEbsXWDayef57jZBt8R5lsloQDKj5uTLK8CTll0vkXkWil4QcKkUsIvM TCkizNNbu3a1478UoDHnIjm9C1RXrgd9UH4t0JjK7fE7eHuwXsJE2aC6/ukjPF1hC6QK 8hYg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-184916-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (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 a640c23a62f3a-a5cfca34104si552007266b.559.2024.05.21.04.57.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 04:57:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184916-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; arc=pass (i=1 spf=pass spfdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-184916-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184916-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (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 EC57D1F210ED for ; Tue, 21 May 2024 11:57:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 46843768EA; Tue, 21 May 2024 11:57:26 +0000 (UTC) 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 21FFA7710F for ; Tue, 21 May 2024 11:57:23 +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=1716292645; cv=none; b=nOUTpOwS2Aq16v394ydHVJVw+KRz8fxPOOFRVaiDrvFgoOi/nsNY08aZ45CcrcGhbyuyxaRGTJKWBeInoDKxMxgjE5KG3vNm+VZL1EvjUcWrOn893n5eywQSq9MIhJ/eFdlsuWmsC/MW+3XQQTOVk1lstLCkKHENlgXcGE89dfM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716292645; c=relaxed/simple; bh=bf3ANCvFz6G43u67m8NYWZRX5TZ8iz1p0YKTdXCKx5E=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Af+DUW61UDKDyw0LlhOhkyoCIsAUOjN5On0Md/yYa3JyUEWcHk8ULcY3wIRpe4DMGEj2dNWuhEO6NvJC+UGoSmLdjagPCLrVCr6x/DjAHhSBqqpPp0u5n+UHLAiwzc5DhEQ/vrc47Q8D6GlU1xvUOF0h3PKFwVvV7uw/EQvHATA= 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; 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 (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104: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 64D505C0FA; Tue, 21 May 2024 11:57:22 +0000 (UTC) Authentication-Results: smtp-out2.suse.de; none 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 D202413A21; Tue, 21 May 2024 11:57:21 +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 2qi3MCGMTGZncgAAD6G6ig (envelope-from ); Tue, 21 May 2024 11:57:21 +0000 Date: Tue, 21 May 2024 13:57:20 +0200 From: Oscar Salvador To: Christophe Leroy Cc: Andrew Morton , Jason Gunthorpe , Peter Xu , Michael Ellerman , Nicholas Piggin , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , "linuxppc-dev@lists.ozlabs.org" Subject: Re: [RFC PATCH v2 01/20] mm: Provide pagesize to pmd_populate() Message-ID: References: <91159d49bcbee0526ca6235ff7ef1ee7d378d013.1715971869.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-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spam-Level: X-Spamd-Result: default: False [-4.00 / 50.00]; REPLY(-4.00)[] X-Spam-Flag: NO X-Spam-Score: -4.00 X-Rspamd-Queue-Id: 64D505C0FA X-Rspamd-Server: rspamd2.dmz-prg2.suse.org X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action On Mon, May 20, 2024 at 04:24:51PM +0000, Christophe Leroy wrote: > I had a quick look at that document and it seems to provide a good > summary of MMU features and principles. However there are some > theoritical information which is not fully right in practice. For > instance when they say "Segment attributes. These fields define > attributes common to all pages in this segment.". This is right in > theory if you consider it from Linux page table topology point of view, > hence what they call a segment is a PMD entry for Linux. However, in > practice each page has its own L1 and L2 attributes and there is not > requirement at HW level to have all L1 attributes of all pages of a > segment the same. Thanks for taking the time Christophe, highly appreciated. > rlwimi = Rotate Left Word Immediate then Mask Insert. Here it rotates > r10 by 23 bits to the left (or 9 to the right) then masks with > _PMD_PAGE_512K and inserts it into r11. > > It means _PAGE_HUGE bit is copied into lower bit of PS attribute. > > PS takes the following values: > > PS = 00 ==> Small page (4k or 16k) > PS = 01 ==> 512k page > PS = 10 ==> Undefined > PS = 11 ==> 8M page I see, thanks for the explanation. > That's a RFC, all ideas are welcome, I needed something to replace > hugepd_populate() The only user interested in pmd_populate() having a sz parameter is 8xx because it will toggle _PMD_PAGE_8M in case of a 8MB mapping. Would it be possible for 8xx to encode the 'sz' in the *pmd pointer prior to calling down the chain? (something like as we do for PTR_ERR()). Then pmd_populate_{kernel_}size() from 8xx, would extract it like: unsigned long sz = PTR_SIZE(pmd) Then we would not need all these 'sz' parameters scattered. Can that work? PD: Do you know a way to emulate a 8xx VM? qemu seems to not have support support. Thanks -- Oscar Salvador SUSE Labs