From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB0CBC6FD1F for ; Tue, 2 Apr 2024 23:36:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=D0jZsYeSNAH3+HEBToMazkf3nhDPH5GLaRmmQWK/wBI=; b=HQ4h+3B7gX9Nex oDgb78q24dRJVY9sgLl6kiDFQSEyyduX1j5OE6CWa2AftsCRi3OBHJJRtqu9+g5JNdk6CViMlUobK mxxo1v/8cc2zhmRFizgWApJOiefYJzCQGUQXrm37HgqJUpQmR3Q6Tulh1TNJ72AzL4g3Hh5j3hZr+ TLodlCkfsokD0nxiSKElHea8uYTO8RnEjJ9CZZ+Fq49AWmWK37epG8aE2TPag323R968qiXULi9Ir d8hxCmMGu2ahfYD2DonqBbp1MRNC04A+f14Re1KP7bE0ihz+QouAVup2weRXB5Bx5uoLACyuwbEXj BcdWW7IWmIbFrhQiJehQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrnfZ-0000000DCWk-1arl; Tue, 02 Apr 2024 23:35:57 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrnfW-0000000DCV8-3BsS for linux-riscv@lists.infradead.org; Tue, 02 Apr 2024 23:35:56 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712100953; 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=HP6iCpNSGY021srGiNxOfFS1yawEzwYl7dLs1n/YW+Y=; b=Ztr6bB2UK05WGxDokJzMkzdRqAjGbzJPLJqartAOn+Yont0sbnE9C2AooBepyvCFRMqpXC kznpRQ/I+ySsoe917KUB6yKB9ccQL3TIu1VPQArdlOjlNFZGEw85M968HppYLg6w9YzhUo rgjCyj6FayLKD2/4MO9SLO5mxXEXTzc= Received: from mail-ot1-f71.google.com (mail-ot1-f71.google.com [209.85.210.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-80-fNWoR5UMPYWizE3MFePiMQ-1; Tue, 02 Apr 2024 19:35:50 -0400 X-MC-Unique: fNWoR5UMPYWizE3MFePiMQ-1 Received: by mail-ot1-f71.google.com with SMTP id 46e09a7af769-6e6b0efc193so2551202a34.0 for ; Tue, 02 Apr 2024 16:35:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712100949; x=1712705749; 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=HP6iCpNSGY021srGiNxOfFS1yawEzwYl7dLs1n/YW+Y=; b=MDehO9NqCulUihkRL8O6Jp0VDVgqQJd3BUKaHbzgelg0Y6oRDOW/7I5AzR7w78T4ze L+sGiToWWKzuOXJGkeF8krryQpftHG9oAqI7i6jti6yA2lasr4/cf2U/z/aORL+cRab7 wkyKDBwY2MIgWiNHRpEgsP82oYRRDXap5QXGCPEe2BLFTpmUL1t84Pf5/Yv/aVcljJlz uKwYdHxXM0UF1ZHpbpSss8VGnSUKEzb3puAC/5qiI+KTkvasK/w4DNQNyKf4WhAFOJ8h gqJjEIuCL+EGe2uE/z2v2ATbdRB1LHUXtrtE0/xZwFteq1wSNJT1eiGAv/7I3roZ/jfA SCtg== X-Forwarded-Encrypted: i=1; AJvYcCUET++w25Pmc5bvkNI0NS+fdmHxGGkdxUNn4mOd5p8uBtN3KnMnxD33PFQdZ43fUJ/wmR71/2efFmpoPRe9iZj9KDoZjRRi6ujRn5Aa2ioo X-Gm-Message-State: AOJu0YzTBDV/l5SaliUfXWMiBdLL9o6XYGdBzQbe4yxxddAP/HgzRK74 tJVq73E+fdz/8DwvOFTaLRUr0gnGLfP+cQIfYuCRf2upq+5+XlEl+GFg2IBpe7tdKQWWNzJPofk Fg8ggPJRvnExCVeSkImaOdUVcz4sjTGKs8mKKb0X4OOCLQt03Ug+il5UBf5qy7v8jDg== X-Received: by 2002:a9d:4c86:0:b0:6e7:7ef6:10da with SMTP id m6-20020a9d4c86000000b006e77ef610damr13684093otf.1.1712100949125; Tue, 02 Apr 2024 16:35:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvGEFvbrAiLdQh8lUIUnqC+uQoSnGXUScHs/S+SFU0VVogBN2f5CbF/OzNKGljOo4S/t2faA== X-Received: by 2002:a9d:4c86:0:b0:6e7:7ef6:10da with SMTP id m6-20020a9d4c86000000b006e77ef610damr13684059otf.1.1712100948622; Tue, 02 Apr 2024 16:35:48 -0700 (PDT) Received: from xz-m1.local ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id ob12-20020a0562142f8c00b0069046d929a3sm5893803qvb.145.2024.04.02.16.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 16:35:48 -0700 (PDT) Date: Tue, 2 Apr 2024 19:35:45 -0400 From: Peter Xu To: Jason Gunthorpe Cc: Nathan Chancellor , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yang Shi , "Kirill A . Shutemov" , Mike Kravetz , John Hubbard , Michael Ellerman , Andrew Jones , Muchun Song , linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Christophe Leroy , Andrew Morton , Christoph Hellwig , Lorenzo Stoakes , Matthew Wilcox , Rik van Riel , linux-arm-kernel@lists.infradead.org, Andrea Arcangeli , David Hildenbrand , "Aneesh Kumar K . V" , Vlastimil Babka , James Houghton , Mike Rapoport , Axel Rasmussen , Huacai Chen , WANG Xuerui , loongarch@lists.linux.dev Subject: Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback Message-ID: References: <20240327152332.950956-1-peterx@redhat.com> <20240327152332.950956-6-peterx@redhat.com> <20240402190549.GA706730@dev-arch.thelio-3990X> <20240402225320.GU946323@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20240402225320.GU946323@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240402_163554_893826_B461B0D1 X-CRM114-Status: GOOD ( 19.21 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On Tue, Apr 02, 2024 at 07:53:20PM -0300, Jason Gunthorpe wrote: > On Tue, Apr 02, 2024 at 06:43:56PM -0400, Peter Xu wrote: > > > I actually tested this without hitting the issue (even though I didn't > > mention it in the cover letter..). I re-kicked the build test, it turns > > out my "make alldefconfig" on loongarch will generate a config with both > > HUGETLB=n && THP=n, while arch/loongarch/configs/loongson3_defconfig has > > THP=y (which I assume was the one above build used). I didn't further > > check how "make alldefconfig" generated the config; a bit surprising that > > it didn't fetch from there. > > I suspect it is weird compiler variations.. Maybe something is not > being inlined. > > > (and it also surprises me that this BUILD_BUG can trigger.. I used to try > > triggering it elsewhere but failed..) > > As the pud_leaf() == FALSE should result in the BUILD_BUG never being > called and the optimizer removing it. Good point, for some reason loongarch defined pud_leaf() without defining pud_pfn(), which does look strange. #define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) But I noticed at least MIPS also does it.. Logically I think one arch should define either none of both. > > Perhaps the issue is that the pud_leaf() is too far from the pud_pfn? My understanding is follow_pud_mask() should completely get optimized and follow_huge_pud() will be dropped in the compiler output if pud_leaf()==false. Thanks, -- Peter Xu _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv 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 394F63D962 for ; Tue, 2 Apr 2024 23:35:52 +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=1712100953; cv=none; b=tJqxphXsvL9bQ6ao9PCp4l4P+2VyFuSZaUXeTva9K92SA+obvnDKKAnzX8m4IStrtOHGAi+x7yVKN2H8YUpYEs4KOTz0414XeVateR+17F65sGHEeCp1sxX684A+UQ+5/totszF4Fpp4OlbEbCJMTr+3MCl6GCyGA3aiJXzNwmU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712100953; c=relaxed/simple; bh=dCoRqma6yqwIrFc2Ju/9ocy+ca8jMOV5zqLtsYm4O98=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: In-Reply-To:Content-Type:Content-Disposition; b=tcICIzDQXjiL3bp4X5S3eZ6B5YOadC+SFNZoucAl1Wuq6bhou1e9IdHDbSZrlk+mzaz02wPOoxrPFf/fEzuhLA+84LQoYt91I4mNB8bACh3s3UjM9IeUwe+2fYg2D615o3Lv9Mpv1H25ASqJqaNpW84eR+Sax9nmG/6+hZA3NNY= 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=SernlilP; 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="SernlilP" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712100951; 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=HP6iCpNSGY021srGiNxOfFS1yawEzwYl7dLs1n/YW+Y=; b=SernlilPx0ivm1TcTtzb7+vEpxjwHEyJDuDBqj8+JyXykNsdXTQ+HHACBTxSxQ11VzxUqg jMuV5q7ipH+LXIHpJd2lJTYx1H59Z9EHIpua3K+zyajwImDVX1FQE30CKeZ9C+Rah+Uo9E gk69vgrtq6qhJefGuiVsjjtP3HkkVbM= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-633-sHClzX7RMaGgDQihDJKJyQ-1; Tue, 02 Apr 2024 19:35:50 -0400 X-MC-Unique: sHClzX7RMaGgDQihDJKJyQ-1 Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-6e6b0efc193so2551209a34.0 for ; Tue, 02 Apr 2024 16:35:50 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712100949; x=1712705749; 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=HP6iCpNSGY021srGiNxOfFS1yawEzwYl7dLs1n/YW+Y=; b=GPjBRQIcX9XBplWNOVb+1jR0ObruaG88/gQ7LEEqZqz9depdvyOUrGYZj1+fY5jJpE VkKczE34eUukNQPEE8L0Y6YfvMmobsTiWReQ1znKePfV2BDcWLJ4J4Amx/lTtGxOOLCd XAgtGdMUbNOgbynHaKVUk870p2Vpi0hxCTbP03NPFooxziwD0fPfmjgKy028VZ3MJn/C j0fSEBSIida+2MZlRdOji7hFv2bmvs8X7t7O9g5t/YKyusx++go+CcjO6Go0aG7IM/NO ilUnk5VPjHaU4jkFyFs9wCLqS0vWsRO6xnTgNPekywxhLeNls+pmX6Ncg5cD4LbRnWPQ yR8Q== X-Forwarded-Encrypted: i=1; AJvYcCWby1LKkTSXx0NulPY77ch8rLj7SsEY8pJLRwR9FbqlcSDCYes6hK1uq15kUCmXGSWqmxSmrVgKyYOyf1XtvbS418DLN6qiaYsH X-Gm-Message-State: AOJu0YyXKqlmVk9KljXmgycy71oFz/ECSsQdqr4Ryw/SfIX7ocbXK6HI GFWuAB1kjMoDacbhkO/OJ9w6q7NFT22aQT2hlCrAI9lj2EVfHy4/8alZXjbUn/ff/5NbnV/EWvT o0/qrKxijfjtVtDbsO5wQKn6M56To+LV+aVQ9grz4BEGKcqtcWsUb7m9evg== X-Received: by 2002:a9d:4c86:0:b0:6e7:7ef6:10da with SMTP id m6-20020a9d4c86000000b006e77ef610damr13684100otf.1.1712100949125; Tue, 02 Apr 2024 16:35:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvGEFvbrAiLdQh8lUIUnqC+uQoSnGXUScHs/S+SFU0VVogBN2f5CbF/OzNKGljOo4S/t2faA== X-Received: by 2002:a9d:4c86:0:b0:6e7:7ef6:10da with SMTP id m6-20020a9d4c86000000b006e77ef610damr13684059otf.1.1712100948622; Tue, 02 Apr 2024 16:35:48 -0700 (PDT) Received: from xz-m1.local ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id ob12-20020a0562142f8c00b0069046d929a3sm5893803qvb.145.2024.04.02.16.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 16:35:48 -0700 (PDT) Date: Tue, 2 Apr 2024 19:35:45 -0400 From: Peter Xu To: Jason Gunthorpe Cc: Nathan Chancellor , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yang Shi , "Kirill A . Shutemov" , Mike Kravetz , John Hubbard , Michael Ellerman , Andrew Jones , Muchun Song , linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Christophe Leroy , Andrew Morton , Christoph Hellwig , Lorenzo Stoakes , Matthew Wilcox , Rik van Riel , linux-arm-kernel@lists.infradead.org, Andrea Arcangeli , David Hildenbrand , "Aneesh Kumar K . V" , Vlastimil Babka , James Houghton , Mike Rapoport , Axel Rasmussen , Huacai Chen , WANG Xuerui , loongarch@lists.linux.dev Subject: Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback Message-ID: References: <20240327152332.950956-1-peterx@redhat.com> <20240327152332.950956-6-peterx@redhat.com> <20240402190549.GA706730@dev-arch.thelio-3990X> <20240402225320.GU946323@nvidia.com> Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240402225320.GU946323@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On Tue, Apr 02, 2024 at 07:53:20PM -0300, Jason Gunthorpe wrote: > On Tue, Apr 02, 2024 at 06:43:56PM -0400, Peter Xu wrote: > > > I actually tested this without hitting the issue (even though I didn't > > mention it in the cover letter..). I re-kicked the build test, it turns > > out my "make alldefconfig" on loongarch will generate a config with both > > HUGETLB=n && THP=n, while arch/loongarch/configs/loongson3_defconfig has > > THP=y (which I assume was the one above build used). I didn't further > > check how "make alldefconfig" generated the config; a bit surprising that > > it didn't fetch from there. > > I suspect it is weird compiler variations.. Maybe something is not > being inlined. > > > (and it also surprises me that this BUILD_BUG can trigger.. I used to try > > triggering it elsewhere but failed..) > > As the pud_leaf() == FALSE should result in the BUILD_BUG never being > called and the optimizer removing it. Good point, for some reason loongarch defined pud_leaf() without defining pud_pfn(), which does look strange. #define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) But I noticed at least MIPS also does it.. Logically I think one arch should define either none of both. > > Perhaps the issue is that the pud_leaf() is too far from the pud_pfn? My understanding is follow_pud_mask() should completely get optimized and follow_huge_pud() will be dropped in the compiler output if pud_leaf()==false. Thanks, -- Peter Xu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CC54CD1284 for ; Tue, 2 Apr 2024 23:36:42 +0000 (UTC) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SernlilP; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=J3x39rLO; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4V8PRF06WMz3vrF for ; Wed, 3 Apr 2024 10:36:41 +1100 (AEDT) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=SernlilP; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=J3x39rLO; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=peterx@redhat.com; receiver=lists.ozlabs.org) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4V8PQN29X4z3vgf for ; Wed, 3 Apr 2024 10:35:54 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712100951; 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=HP6iCpNSGY021srGiNxOfFS1yawEzwYl7dLs1n/YW+Y=; b=SernlilPx0ivm1TcTtzb7+vEpxjwHEyJDuDBqj8+JyXykNsdXTQ+HHACBTxSxQ11VzxUqg jMuV5q7ipH+LXIHpJd2lJTYx1H59Z9EHIpua3K+zyajwImDVX1FQE30CKeZ9C+Rah+Uo9E gk69vgrtq6qhJefGuiVsjjtP3HkkVbM= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712100952; 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=HP6iCpNSGY021srGiNxOfFS1yawEzwYl7dLs1n/YW+Y=; b=J3x39rLOj3X+1wtKFNqvXdNcw6rGN5gutDYuKnFxDNGqxSrACZ4pwS2GeCy7B6gwyZr2am p59fOAde+dkXxY3iPlbSakJxFfz/UfPkZ3WGBBX3SUxaB+xWd+l2+reCoJOW8OP85F0cs+ cIoTwim3Ew2+ztebme/PMARh1hduHpg= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-80-g68KHLFcNxm5zphtCxc0nw-1; Tue, 02 Apr 2024 19:35:50 -0400 X-MC-Unique: g68KHLFcNxm5zphtCxc0nw-1 Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-6e6cb8055b8so1936323a34.1 for ; Tue, 02 Apr 2024 16:35:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712100949; x=1712705749; 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=HP6iCpNSGY021srGiNxOfFS1yawEzwYl7dLs1n/YW+Y=; b=IiTedWd1J02VF0Ki3iv54WIb0ZBhy0QOvVfbqJF5NGnSf6x++Rr06OnRclL8TZhiHk YcvaHOHkwG11j/KnWHQN7O8TFs0yt+K8mpOzsiaxt5NEp8hA31pUITrL/+8Wc3Bzb2q/ hpZ9c9lZkcPAvKBbTYEHjxRkF3o3lFhG60TeyylCBtcRvPQN0U3t4IkOlxse7DWCyWgj ksDFWNVjZe05NNs+elIG7oNtl2rjL08iVKfc16CJgVTxddeB3ZM3DXPpgP63BldyNHiC 5Km2CUh8C/qqSxzW5Rk3239cGOWNRTRdhA0LVumq5N1raLIRFKlAsph2ci9hiO1TL2kX tIPQ== X-Forwarded-Encrypted: i=1; AJvYcCXvsehXwuZ/j8wpj3rFEsoXZ4K1nf7ejYmjbzI9Cvvu63JeKzFclQaxeQSAMt08PNWTk3hPm+JwBrGeK211dBRpQ+pd7IkVSBvYisoPBw== X-Gm-Message-State: AOJu0YyDBagXVsdMnMCI/2QlvZwBWjqzA+VBaX/7vxe3AyRBC6TCD0uq vlbOyODolsji26JjEdYkOnagO6KKPNYqnrGBC7qd7GdkSEwvitWNeBlREr6Cd7Pj+cToagKzqBo wjd0p3O7LmSw2cPMWfP1tkJIf7tiM73wiPv81GMIdN918BnI/BXP/9t/bdBL16xA= X-Received: by 2002:a9d:4c86:0:b0:6e7:7ef6:10da with SMTP id m6-20020a9d4c86000000b006e77ef610damr13684092otf.1.1712100949125; Tue, 02 Apr 2024 16:35:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvGEFvbrAiLdQh8lUIUnqC+uQoSnGXUScHs/S+SFU0VVogBN2f5CbF/OzNKGljOo4S/t2faA== X-Received: by 2002:a9d:4c86:0:b0:6e7:7ef6:10da with SMTP id m6-20020a9d4c86000000b006e77ef610damr13684059otf.1.1712100948622; Tue, 02 Apr 2024 16:35:48 -0700 (PDT) Received: from xz-m1.local ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id ob12-20020a0562142f8c00b0069046d929a3sm5893803qvb.145.2024.04.02.16.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 16:35:48 -0700 (PDT) Date: Tue, 2 Apr 2024 19:35:45 -0400 From: Peter Xu To: Jason Gunthorpe Subject: Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback Message-ID: References: <20240327152332.950956-1-peterx@redhat.com> <20240327152332.950956-6-peterx@redhat.com> <20240402190549.GA706730@dev-arch.thelio-3990X> <20240402225320.GU946323@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20240402225320.GU946323@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: James Houghton , David Hildenbrand , Yang Shi , Andrew Jones , linux-mm@kvack.org, Matthew Wilcox , linux-riscv@lists.infradead.org, WANG Xuerui , Andrea Arcangeli , "Aneesh Kumar K . V" , Huacai Chen , Christoph Hellwig , Vlastimil Babka , Axel Rasmussen , Rik van Riel , John Hubbard , Nathan Chancellor , loongarch@lists.linux.dev, "Kirill A . Shutemov" , linux-arm-kernel@lists.infradead.org, Lorenzo Stoakes , Muchun Song , linux-kernel@vger.kernel.org, Andrew Morton , linuxppc-dev@lists.ozlabs.org, Mike Rapoport , Mike Kravetz Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Tue, Apr 02, 2024 at 07:53:20PM -0300, Jason Gunthorpe wrote: > On Tue, Apr 02, 2024 at 06:43:56PM -0400, Peter Xu wrote: > > > I actually tested this without hitting the issue (even though I didn't > > mention it in the cover letter..). I re-kicked the build test, it turns > > out my "make alldefconfig" on loongarch will generate a config with both > > HUGETLB=n && THP=n, while arch/loongarch/configs/loongson3_defconfig has > > THP=y (which I assume was the one above build used). I didn't further > > check how "make alldefconfig" generated the config; a bit surprising that > > it didn't fetch from there. > > I suspect it is weird compiler variations.. Maybe something is not > being inlined. > > > (and it also surprises me that this BUILD_BUG can trigger.. I used to try > > triggering it elsewhere but failed..) > > As the pud_leaf() == FALSE should result in the BUILD_BUG never being > called and the optimizer removing it. Good point, for some reason loongarch defined pud_leaf() without defining pud_pfn(), which does look strange. #define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) But I noticed at least MIPS also does it.. Logically I think one arch should define either none of both. > > Perhaps the issue is that the pud_leaf() is too far from the pud_pfn? My understanding is follow_pud_mask() should completely get optimized and follow_huge_pud() will be dropped in the compiler output if pud_leaf()==false. Thanks, -- Peter Xu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5C7A7CD1284 for ; Tue, 2 Apr 2024 23:36:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UwezhUlyypsOin+tCbtJrCrHoYqACss5zgnI2Mi+h2s=; b=HhFD0LgOYMESYG CxhQRDQWLcjZagyIRoYtICfQrUtUrHG6D55/FjMlYLWJKHhB1PvUQpxTl4n+XbvJ8WZrrVArGETTJ f7idk/Y0gS3KCLVUjq8JwTW8eSHCwWKVDbOyPm6LtEaTZeHQMQaPqxcFW3+afDsdZA1mDiOeZPLiu YW/dLI/FUt7J28NQiWmXJaHprwGrZKlJVypE0hYPHZDnmFOq6lDcMqk0TNsT1SkIfL4kSmXEe+KJ0 6Jm5gLarxNdEv7Z2yF+x2OjWbOWrNs5Z48oNDAPb6Wp5PZWP0NWmu20/LLbHA8gVVp6o4HsRhEeXW rI+4OCANtRyN2v+6uKwQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrnfX-0000000DCVt-2DeJ; Tue, 02 Apr 2024 23:35:55 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rrnfV-0000000DCUN-05tv for linux-arm-kernel@lists.infradead.org; Tue, 02 Apr 2024 23:35:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712100951; 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=HP6iCpNSGY021srGiNxOfFS1yawEzwYl7dLs1n/YW+Y=; b=SernlilPx0ivm1TcTtzb7+vEpxjwHEyJDuDBqj8+JyXykNsdXTQ+HHACBTxSxQ11VzxUqg jMuV5q7ipH+LXIHpJd2lJTYx1H59Z9EHIpua3K+zyajwImDVX1FQE30CKeZ9C+Rah+Uo9E gk69vgrtq6qhJefGuiVsjjtP3HkkVbM= Received: from mail-ot1-f69.google.com (mail-ot1-f69.google.com [209.85.210.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-136-jqa_mk6_ONCUkd5MdF91Lg-1; Tue, 02 Apr 2024 19:35:50 -0400 X-MC-Unique: jqa_mk6_ONCUkd5MdF91Lg-1 Received: by mail-ot1-f69.google.com with SMTP id 46e09a7af769-6e6cb8055b8so1936321a34.1 for ; Tue, 02 Apr 2024 16:35:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712100949; x=1712705749; 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=HP6iCpNSGY021srGiNxOfFS1yawEzwYl7dLs1n/YW+Y=; b=eKFItPNb1Q0BWiLed32dyN/4OgfC/ZavQEELf9DACSGbVGWui/wBVpv4RXfUpfxM0C sjLhsgWJWO+3bNTGVkAkLDMCkN3KXh9QajaDInO+hquIzi3BguKVqCF4YMTvOgKogz7x y58zV0E0yqICLyJZ7iYJ7m91uTe2uv+kUt/IElI/a0kCNnrLx/FJn6WPo4XCgwenSz94 Xr/PisQG63l4oI3caSWSIK6yPDLybpm0grr6OSUmerjxyo3UJypBdSsXJ3Z2hVTBuScQ OnoCRX8W094FbAOe/fmFlOxqJ+i7gMZdN9YlATOBWeRPo4Gptu0ptF6a3+s/KcbJV9LZ 7ySA== X-Forwarded-Encrypted: i=1; AJvYcCXoxShmdGKHTdw8PzWiCVau9Pz4srl+vwuCcIGm/TgIjhIiBnkLbWyDO01BxWLnN1/q/l0Scl1jwqORNRSn0htErkQzi0SNIFubBeCYJeAkiIR4Vjw= X-Gm-Message-State: AOJu0YxmiSo9i6VAZ/ZyFTDv4LEGPSCyayYxIK4Rfx0X7CHF5lWQZ4ms dOn6jwngAOIlKAbghZ82zq+kuuUjRu1Xm4AOVhz1uW2ZfMynSgVU5sCOvMQQednhkCkjmjxVU76 fyhOxc9tj5Ia2wIdpP9YzXNNhi5VxTgim+w/ixpi6k7eqph+nwUyeFXxRujInlWz7wVN9vTf+ X-Received: by 2002:a9d:4c86:0:b0:6e7:7ef6:10da with SMTP id m6-20020a9d4c86000000b006e77ef610damr13684103otf.1.1712100949126; Tue, 02 Apr 2024 16:35:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEvGEFvbrAiLdQh8lUIUnqC+uQoSnGXUScHs/S+SFU0VVogBN2f5CbF/OzNKGljOo4S/t2faA== X-Received: by 2002:a9d:4c86:0:b0:6e7:7ef6:10da with SMTP id m6-20020a9d4c86000000b006e77ef610damr13684059otf.1.1712100948622; Tue, 02 Apr 2024 16:35:48 -0700 (PDT) Received: from xz-m1.local ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id ob12-20020a0562142f8c00b0069046d929a3sm5893803qvb.145.2024.04.02.16.35.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Apr 2024 16:35:48 -0700 (PDT) Date: Tue, 2 Apr 2024 19:35:45 -0400 From: Peter Xu To: Jason Gunthorpe Cc: Nathan Chancellor , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yang Shi , "Kirill A . Shutemov" , Mike Kravetz , John Hubbard , Michael Ellerman , Andrew Jones , Muchun Song , linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Christophe Leroy , Andrew Morton , Christoph Hellwig , Lorenzo Stoakes , Matthew Wilcox , Rik van Riel , linux-arm-kernel@lists.infradead.org, Andrea Arcangeli , David Hildenbrand , "Aneesh Kumar K . V" , Vlastimil Babka , James Houghton , Mike Rapoport , Axel Rasmussen , Huacai Chen , WANG Xuerui , loongarch@lists.linux.dev Subject: Re: [PATCH v4 05/13] mm/arch: Provide pud_pfn() fallback Message-ID: References: <20240327152332.950956-1-peterx@redhat.com> <20240327152332.950956-6-peterx@redhat.com> <20240402190549.GA706730@dev-arch.thelio-3990X> <20240402225320.GU946323@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20240402225320.GU946323@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240402_163553_281831_4F2247AF X-CRM114-Status: GOOD ( 20.69 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, Apr 02, 2024 at 07:53:20PM -0300, Jason Gunthorpe wrote: > On Tue, Apr 02, 2024 at 06:43:56PM -0400, Peter Xu wrote: > > > I actually tested this without hitting the issue (even though I didn't > > mention it in the cover letter..). I re-kicked the build test, it turns > > out my "make alldefconfig" on loongarch will generate a config with both > > HUGETLB=n && THP=n, while arch/loongarch/configs/loongson3_defconfig has > > THP=y (which I assume was the one above build used). I didn't further > > check how "make alldefconfig" generated the config; a bit surprising that > > it didn't fetch from there. > > I suspect it is weird compiler variations.. Maybe something is not > being inlined. > > > (and it also surprises me that this BUILD_BUG can trigger.. I used to try > > triggering it elsewhere but failed..) > > As the pud_leaf() == FALSE should result in the BUILD_BUG never being > called and the optimizer removing it. Good point, for some reason loongarch defined pud_leaf() without defining pud_pfn(), which does look strange. #define pud_leaf(pud) ((pud_val(pud) & _PAGE_HUGE) != 0) But I noticed at least MIPS also does it.. Logically I think one arch should define either none of both. > > Perhaps the issue is that the pud_leaf() is too far from the pud_pfn? My understanding is follow_pud_mask() should completely get optimized and follow_huge_pud() will be dropped in the compiler output if pud_leaf()==false. Thanks, -- Peter Xu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel