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 0E9C5CD1288 for ; Wed, 3 Apr 2024 18:25:37 +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=2vuHycHvtrFrqj+8R6J4TZf5EYjuoMGho3gX4RrzcPs=; b=p3qVKh0jAep/1O zVFMcFMY9XtrUorFw70cqYTaN9qYoH/PWYLfCP0G2HYwe9/3WP8UU73D3qqBwQIZF4232ha+zbLvC s7cW6jrhw0qt1uoeVeHTEa80TxyPd/Z23IEjRnd1xH0FfckHDKuzTzdUh1+6ewjH3tjdr/Fwqpr9r 12KRtmtGlmOEu9AT/QyNtQvj5QdWeL6Jdr2z8a//TGqisir+4ipiq3ATdk6LRRXFagzjCQft2hINl XFIfHP0graIUlwNICKb/4iWJ9ur1tZKzWI45znpatMU8e4ZrLVUDJOFV5W4hvazVJozURRMIC/1rT c//C0V7FqkusbM1E4Sig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs5Ij-0000000HNxP-0ibK; Wed, 03 Apr 2024 18:25:33 +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 1rs5Ie-0000000HNsI-14IT for linux-riscv@lists.infradead.org; Wed, 03 Apr 2024 18:25:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712168726; 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=YXsmqoOHzY6mBushOHoxlZz3TK/EfZqT4lQukaq20AM=; b=P7wQeRaO8pvv+bsOulr62tjYpf9C/Ld0fZFLGcYNPH5EYnIjilLCjxadWI9eW7sFMOz2Sl YOtZmbPJrKk3igLm1q8w23oy+TciBsvtxjKiAoMtSgx1j9gd25lh9l5ZeYbV3Zmx4aZXY2 s47pBu5TUZPUCNmoQImKpUIaxAbU+eE= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-296-Udli9ZzJP9OF08TcIdcwtA-1; Wed, 03 Apr 2024 14:25:24 -0400 X-MC-Unique: Udli9ZzJP9OF08TcIdcwtA-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6991ad4ea9eso182586d6.0 for ; Wed, 03 Apr 2024 11:25:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712168724; x=1712773524; 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=YXsmqoOHzY6mBushOHoxlZz3TK/EfZqT4lQukaq20AM=; b=Ulik++2OtfS7aOCvE1oUjHJONpnjDrGn6VjGX0MyWLLoVAyTuzqzC5w3wXt465XVAm Wp4rAHBjtNhI0YoRnew414rwxEL4yPYyKak7aW++FqHOVnHyKBhQ6126zLHTKBH7dGgC uM1p3Ue2Mh02I8CmN/2PE9g/8jdT3TglPohH1gdWI88IULh+TbNtMjjBGBH+vtqgYdzH yzpvKfT6e7cTbjShFUuQ1bgvJszjBWbcQ8u6G5fuv31AviuLR4AJgGT5OlA/L1PK0DVf WGUH6MiIFEH0GYjGxC3S5ujYXWHuAeNkOJ8JZkwt2GuHaP1y2usPU+nLL9VelmoQi0v2 PStQ== X-Forwarded-Encrypted: i=1; AJvYcCXXCGsbFeLiC2sbsO9xrjnzJ8Ig9qdyMw3eZg68ZlTWCKqAf3n6TBfG0AKawVQ40rW0Qrkg7KHhn+WcxLssuXpBCQdXL1dYK/7ytC43+20w X-Gm-Message-State: AOJu0Yy6f0MfoscPRNhRkMmaQdMHKEG+qdHqpfdgrNmOgPgdMANnqJF8 j0OK6GrzLXBXRTliOcjitpctfsZIRqZAKdL42cWo/xiiIXSrCyUU0a9TcE/lqz72P+JmHJgEApN ONYY1ZXVzwLthqGo1x8vs6BircgfWzFyLHtHxqWuaL/zWt7I5fDf0sFZkWe3Rq2OfeA== X-Received: by 2002:ad4:5cab:0:b0:699:2242:4ee8 with SMTP id q11-20020ad45cab000000b0069922424ee8mr129111qvh.3.1712168724113; Wed, 03 Apr 2024 11:25:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOuNMZozoa6aScFD4XBgyXphotERni3kWeSwgWQ4wF27W29jsLbCwW0feeq4rwhZfTMS4o4A== X-Received: by 2002:ad4:5cab:0:b0:699:2242:4ee8 with SMTP id q11-20020ad45cab000000b0069922424ee8mr129072qvh.3.1712168723495; Wed, 03 Apr 2024 11:25:23 -0700 (PDT) Received: from x1n ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id s15-20020a0562140caf00b00698fd63d167sm4435500qvs.123.2024.04.03.11.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 11:25:23 -0700 (PDT) Date: Wed, 3 Apr 2024 14:25:20 -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> <20240403120841.GB1723999@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20240403120841.GB1723999@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-20240403_112528_466416_0BCD3AB7 X-CRM114-Status: GOOD ( 29.05 ) 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 Wed, Apr 03, 2024 at 09:08:41AM -0300, Jason Gunthorpe wrote: > On Tue, Apr 02, 2024 at 07:35:45PM -0400, Peter Xu wrote: > > 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. > > Wow, this is definately an arch issue. You can't define pud_leaf() and > not have a pud_pfn(). It makes no sense at all.. > > I'd say the BUILD_BUG has done it's job and found an issue, fix it by > not defining pud_leaf? I don't see any calls to pud_leaf in loongarch > at least Yes, that sounds better too to me, however it means we may also risk other archs that can fail another defconfig build.. and I worry I bring trouble to multiple such cases. Fundamentally it's indeed my patch that broke those builds, so I still sent the change and leave that for arch developers to decide the best for the archs. I think if wanted, we can add that BUILD_BUG() back when we're sure no arch will break with it. So such changes from arch can still be proposed alongside of removal of BUILD_BUG() (and I'd guess some other arch will start to notice such build issue soon if existed.. so it still more or less has similar effect of a reminder..). 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.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 30288153598 for ; Wed, 3 Apr 2024 18:25:28 +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=1712168730; cv=none; b=TUIrYX686KlQP5oLT13yf6i4+CcuRbdP8T3tnfL/lR4TtgTcQAXiGAN3ZH9h0MrWtlgAJMJDC4dW6EccRroWPvOFAycrLNvhFfJe0vi8WZIhqzm3SGbL6q+UwbFvm6Wtaay/QE9ODYg7WCm8AZB1WRY9jNawCLknBTuv6VmQ5KE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712168730; c=relaxed/simple; bh=49xRMMJoQJIUdr7zdlVs8BfmW6KWUNR4b9vQnfKmZbA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: In-Reply-To:Content-Type:Content-Disposition; b=om0ZdJlstqASjUO8VI1MZfK7O2mvnsq8ODVger5PLNWjUzyb2r8aqNhdiR76WVFbKRk6eCFgFhoh5X9QrXmZ/lsHKjTHBSqjyGIfgO7C6oww3qXXPj+E+xGMmq4uEEebnHI5dNLWQAcwIhbArR9Yn7hoMRvqE5keg3eFlKDwg80= 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=heMLqqir; 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="heMLqqir" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712168728; 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=YXsmqoOHzY6mBushOHoxlZz3TK/EfZqT4lQukaq20AM=; b=heMLqqirhetqkyRiPCH3Vkky/06M9DspI45IQqhjcTxHwRJubOfrEAI3s1DGL7zlp/MTy2 crdyh6BwsBeigM43muN/W90oqkQYyAKN72tVevCQkugKm/nHF0HYLETz6gAtdLkcSQWSTD qivFh9/9bemWtTCaAawtsUFL7kXEX2A= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-266-OhYT0OKiOdyTA-9rPpTxYA-1; Wed, 03 Apr 2024 14:25:27 -0400 X-MC-Unique: OhYT0OKiOdyTA-9rPpTxYA-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-6991ad4ea9eso182706d6.0 for ; Wed, 03 Apr 2024 11:25:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712168726; x=1712773526; 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=YXsmqoOHzY6mBushOHoxlZz3TK/EfZqT4lQukaq20AM=; b=CU+j5daNgO8NAxTRgJi3mTAFsmgt4PD1mfCXvQZXxL/HOPAIEz3ieZfsG7NXl8n7dP ptS//iwjoJQnGVHIjklIvmPqTRPDjk3oc5BUA7qUJs4bjc1xvewK0ebYC/zARmkPFIFL tFA4oPkH/xyhqmkV1ikyuHlAmN3d9UcdSTTFIcJuLLO4v5slWMQIN2GopljAqVLAbFlf dTKkspcPHBdJtUqM7+pAjsF8juTeOmr5iJ0klbkzAAW9GwwfT/ppOD50zxf/g2lI5RuA A0yJXwq0C1XQhv+a5TVVScm2eAesKhNgG1sI4LWCgWHECkhccnW8GsaH4hEaNFHGIPQf zGfA== X-Forwarded-Encrypted: i=1; AJvYcCUF7t1rRmJUeo1blKr0UhIoAYbuR9MaSFeY/6lg0C9Ciz7x+6dS01UB+nKQ/p+F2WV3q8uB0HeB5BSQGuN3w3BN8RmxPbm0Q7IU X-Gm-Message-State: AOJu0Yyn63l0EMbM+bscEvK4DhH8ftySu6RJaGInqUeLmQCQL1yYB95N BfMhEmiESmcO7TEvghQ9aP1UEU7XQ+WaA4/qRN7C24Sw+SLY7cQ3yPNqOcMv5T002YaJTKn3btQ GO7Il7fYgAiixEMLI1/wt/nDJiXdY2a849grjhyPgByvWKfWcZVq+n3k49g== X-Received: by 2002:ad4:5cab:0:b0:699:2242:4ee8 with SMTP id q11-20020ad45cab000000b0069922424ee8mr129114qvh.3.1712168724118; Wed, 03 Apr 2024 11:25:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOuNMZozoa6aScFD4XBgyXphotERni3kWeSwgWQ4wF27W29jsLbCwW0feeq4rwhZfTMS4o4A== X-Received: by 2002:ad4:5cab:0:b0:699:2242:4ee8 with SMTP id q11-20020ad45cab000000b0069922424ee8mr129072qvh.3.1712168723495; Wed, 03 Apr 2024 11:25:23 -0700 (PDT) Received: from x1n ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id s15-20020a0562140caf00b00698fd63d167sm4435500qvs.123.2024.04.03.11.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 11:25:23 -0700 (PDT) Date: Wed, 3 Apr 2024 14:25:20 -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> <20240403120841.GB1723999@nvidia.com> Precedence: bulk X-Mailing-List: loongarch@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20240403120841.GB1723999@nvidia.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On Wed, Apr 03, 2024 at 09:08:41AM -0300, Jason Gunthorpe wrote: > On Tue, Apr 02, 2024 at 07:35:45PM -0400, Peter Xu wrote: > > 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. > > Wow, this is definately an arch issue. You can't define pud_leaf() and > not have a pud_pfn(). It makes no sense at all.. > > I'd say the BUILD_BUG has done it's job and found an issue, fix it by > not defining pud_leaf? I don't see any calls to pud_leaf in loongarch > at least Yes, that sounds better too to me, however it means we may also risk other archs that can fail another defconfig build.. and I worry I bring trouble to multiple such cases. Fundamentally it's indeed my patch that broke those builds, so I still sent the change and leave that for arch developers to decide the best for the archs. I think if wanted, we can add that BUILD_BUG() back when we're sure no arch will break with it. So such changes from arch can still be proposed alongside of removal of BUILD_BUG() (and I'd guess some other arch will start to notice such build issue soon if existed.. so it still more or less has similar effect of a reminder..). 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 4FCDACD128A for ; Wed, 3 Apr 2024 18:26:48 +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=P7wQeRaO; 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=P7wQeRaO; dkim-atps=neutral Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4V8tWB73J5z3vk1 for ; Thu, 4 Apr 2024 05:26:46 +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=P7wQeRaO; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=P7wQeRaO; 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 4V8tTl5XtWz3vd2 for ; Thu, 4 Apr 2024 05:25:31 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712168726; 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=YXsmqoOHzY6mBushOHoxlZz3TK/EfZqT4lQukaq20AM=; b=P7wQeRaO8pvv+bsOulr62tjYpf9C/Ld0fZFLGcYNPH5EYnIjilLCjxadWI9eW7sFMOz2Sl YOtZmbPJrKk3igLm1q8w23oy+TciBsvtxjKiAoMtSgx1j9gd25lh9l5ZeYbV3Zmx4aZXY2 s47pBu5TUZPUCNmoQImKpUIaxAbU+eE= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712168726; 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=YXsmqoOHzY6mBushOHoxlZz3TK/EfZqT4lQukaq20AM=; b=P7wQeRaO8pvv+bsOulr62tjYpf9C/Ld0fZFLGcYNPH5EYnIjilLCjxadWI9eW7sFMOz2Sl YOtZmbPJrKk3igLm1q8w23oy+TciBsvtxjKiAoMtSgx1j9gd25lh9l5ZeYbV3Zmx4aZXY2 s47pBu5TUZPUCNmoQImKpUIaxAbU+eE= Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-120-C59wvAjyMQeGtc97pYwjYw-1; Wed, 03 Apr 2024 14:25:24 -0400 X-MC-Unique: C59wvAjyMQeGtc97pYwjYw-1 Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-6991ad4ea9eso182596d6.0 for ; Wed, 03 Apr 2024 11:25:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712168724; x=1712773524; 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=YXsmqoOHzY6mBushOHoxlZz3TK/EfZqT4lQukaq20AM=; b=svkPD03MvteF9qxW159jNJYC5DUv49ZugMv7eOWrqI9NMndBPP6emPRFgAt1SDVHuS Z5CNrUYaPI68ezm6L1Ru7rqKQcBvwlzUn0C5cfnvDBg6t0JEnjdGfSgYfhu2O2Uzf7HH SygmXLffiJ9o/yz/zQqywdwOUKKVyL/xvC8KaQIt+41ndGPUV9R9vDcozyQrBg8jwSwv R/MDlIfi0/G9epBFtd6Ti4fu7uf21jAbInvPmtQNefb7gPwwYMuW+eD/6TOF15O47zIq Qcyp6WjhuATzHhOMP6JEf+CaI/b1NmTnlZjJtZMv8XXxFHR2wTM+7iioB5V1/pgxEr0r usnA== X-Forwarded-Encrypted: i=1; AJvYcCXp/Jl/c4WMQuGoEUFhpGhpSJzZxEMtFk692zLiYpZxM2WdUDeXazsn7hgBsSJxvGnPuJmLwUdzW/EKZ2F7rG5FwWfXPzqmP/7gP6FXCA== X-Gm-Message-State: AOJu0YyHQe8p9uMFxpgNarmCm+zdjjN+hcv2NoKDPYSnvNM7J1wKE7l7 cZtkubwPnnf+cziIlF+wPfn0HFnhwoJOeQZtqVoHeJbL5UV7stuBC3RkeFqppuq88gvbO8l4UQD y1QCiE7VnRidOMe/8g/dmKAeYeDBstZRa4euHeeex2aLY59RO8jtXvO1EqfJqf+U= X-Received: by 2002:ad4:5cab:0:b0:699:2242:4ee8 with SMTP id q11-20020ad45cab000000b0069922424ee8mr129096qvh.3.1712168724109; Wed, 03 Apr 2024 11:25:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOuNMZozoa6aScFD4XBgyXphotERni3kWeSwgWQ4wF27W29jsLbCwW0feeq4rwhZfTMS4o4A== X-Received: by 2002:ad4:5cab:0:b0:699:2242:4ee8 with SMTP id q11-20020ad45cab000000b0069922424ee8mr129072qvh.3.1712168723495; Wed, 03 Apr 2024 11:25:23 -0700 (PDT) Received: from x1n ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id s15-20020a0562140caf00b00698fd63d167sm4435500qvs.123.2024.04.03.11.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 11:25:23 -0700 (PDT) Date: Wed, 3 Apr 2024 14:25:20 -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> <20240403120841.GB1723999@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20240403120841.GB1723999@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 Wed, Apr 03, 2024 at 09:08:41AM -0300, Jason Gunthorpe wrote: > On Tue, Apr 02, 2024 at 07:35:45PM -0400, Peter Xu wrote: > > 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. > > Wow, this is definately an arch issue. You can't define pud_leaf() and > not have a pud_pfn(). It makes no sense at all.. > > I'd say the BUILD_BUG has done it's job and found an issue, fix it by > not defining pud_leaf? I don't see any calls to pud_leaf in loongarch > at least Yes, that sounds better too to me, however it means we may also risk other archs that can fail another defconfig build.. and I worry I bring trouble to multiple such cases. Fundamentally it's indeed my patch that broke those builds, so I still sent the change and leave that for arch developers to decide the best for the archs. I think if wanted, we can add that BUILD_BUG() back when we're sure no arch will break with it. So such changes from arch can still be proposed alongside of removal of BUILD_BUG() (and I'd guess some other arch will start to notice such build issue soon if existed.. so it still more or less has similar effect of a reminder..). 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 1CE88CD128A for ; Wed, 3 Apr 2024 18:25:49 +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=CjB0gc6AmOYRyie5swXk1j5SOV2AMiffF8A1xGufnGU=; b=WWWrG0dOt1r2os J+kOxxviy5u4KoOetM7JnUWzjTYD3ffWt6PM5LcSIf0jzkbO8fLfDvIqWoSFH66v+NYo/bUFtfz9D UkcH7u2X0q/FL0w3JHRY6a98Owzy82lX+NyOaBM4oYIsSGgfuaz+MzH1HL5mr0B/Wn2GFyhGVTxEQ sJubjQrCeqikdAIvaK1ZO5mDErdjO2uCuPXbKGBVdNQD29OnVyOMvh5fJfqGhsqghpm/U3Gk91yNW Y7Ic5b+7TmEsDBEjWQO3YnBH9IQKx0JMOOnOfM32FC8BfgH5URqlngskeb1VoJ12wzQvIqXp9IKWu M7e4J+s39rP2+8Rf+lfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rs5Ij-0000000HNy0-3qHP; Wed, 03 Apr 2024 18:25:33 +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 1rs5Ie-0000000HNsH-0Xa2 for linux-arm-kernel@lists.infradead.org; Wed, 03 Apr 2024 18:25:30 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1712168726; 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=YXsmqoOHzY6mBushOHoxlZz3TK/EfZqT4lQukaq20AM=; b=P7wQeRaO8pvv+bsOulr62tjYpf9C/Ld0fZFLGcYNPH5EYnIjilLCjxadWI9eW7sFMOz2Sl YOtZmbPJrKk3igLm1q8w23oy+TciBsvtxjKiAoMtSgx1j9gd25lh9l5ZeYbV3Zmx4aZXY2 s47pBu5TUZPUCNmoQImKpUIaxAbU+eE= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-116-HWBIyB4kOPm945veI9msZg-1; Wed, 03 Apr 2024 14:25:24 -0400 X-MC-Unique: HWBIyB4kOPm945veI9msZg-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-6991ad4ea9eso182496d6.0 for ; Wed, 03 Apr 2024 11:25:24 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712168724; x=1712773524; 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=YXsmqoOHzY6mBushOHoxlZz3TK/EfZqT4lQukaq20AM=; b=d1BnIvFB4GOb62S19F6qL4xe31JCWTYMXmTiRm8/OTsCv4UHzh7fE8OqMrMKfHzJsY LtYk/Mp3T6x9v30vd+Rx8X2GVaE6HUjNjkn4HwWjzotIdnAhDvBQxXWDRWDKv93A23wz zRXz4RKegJBOxm/CmiJg6veRsXVTql84zKpEkawS1jZtWyipFOLvUpMFrndwzmhg0DA7 NlhTdP6+g/gPzJhV98Qw+pxxfdb8XjQFimYXt0TvO46n8bFq6vMDLEyfMWBbD5pwL0yR Ngl8x7nQB2VfMFNMBV68WtydwchvyHw47noDMCs40C9R0c3oBo1dE+TyuNuiGdJ5vIpE w2uA== X-Forwarded-Encrypted: i=1; AJvYcCWp2F6cjF2IF9uJFZh3pSg6TGZD6n14V5/qJutib4BT0KiHQB6eTq9GkDZmO9obfYrofStYMRVQqyo0o0AuxA7Fa39Fc9HF1K1P9ZtMZN9VXn3HGDY= X-Gm-Message-State: AOJu0Yy8v9mL3I2GlFNYMNMDrjF0w/MyiyLKUTZ8b2Bl613PRaBbhdJE 3k4pEmE0ZFPLKNevZMoiXrp+0RRTATl6uXOCiTL6SO2cmmBdIu8KgCxkWto0SJdQMlzD0B+UYLP mhdsvRTSZJreNiYwgHC+diYdm6/ucaCLp2PyPV+s97bqhBpg1UyBd8lVZMethcWmWnPlIrep/ X-Received: by 2002:ad4:5cab:0:b0:699:2242:4ee8 with SMTP id q11-20020ad45cab000000b0069922424ee8mr129107qvh.3.1712168724110; Wed, 03 Apr 2024 11:25:24 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHOuNMZozoa6aScFD4XBgyXphotERni3kWeSwgWQ4wF27W29jsLbCwW0feeq4rwhZfTMS4o4A== X-Received: by 2002:ad4:5cab:0:b0:699:2242:4ee8 with SMTP id q11-20020ad45cab000000b0069922424ee8mr129072qvh.3.1712168723495; Wed, 03 Apr 2024 11:25:23 -0700 (PDT) Received: from x1n ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id s15-20020a0562140caf00b00698fd63d167sm4435500qvs.123.2024.04.03.11.25.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 11:25:23 -0700 (PDT) Date: Wed, 3 Apr 2024 14:25:20 -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> <20240403120841.GB1723999@nvidia.com> MIME-Version: 1.0 In-Reply-To: <20240403120841.GB1723999@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-20240403_112528_310645_FFA82E11 X-CRM114-Status: GOOD ( 30.50 ) 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 Wed, Apr 03, 2024 at 09:08:41AM -0300, Jason Gunthorpe wrote: > On Tue, Apr 02, 2024 at 07:35:45PM -0400, Peter Xu wrote: > > 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. > > Wow, this is definately an arch issue. You can't define pud_leaf() and > not have a pud_pfn(). It makes no sense at all.. > > I'd say the BUILD_BUG has done it's job and found an issue, fix it by > not defining pud_leaf? I don't see any calls to pud_leaf in loongarch > at least Yes, that sounds better too to me, however it means we may also risk other archs that can fail another defconfig build.. and I worry I bring trouble to multiple such cases. Fundamentally it's indeed my patch that broke those builds, so I still sent the change and leave that for arch developers to decide the best for the archs. I think if wanted, we can add that BUILD_BUG() back when we're sure no arch will break with it. So such changes from arch can still be proposed alongside of removal of BUILD_BUG() (and I'd guess some other arch will start to notice such build issue soon if existed.. so it still more or less has similar effect of a reminder..). Thanks, -- Peter Xu _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel