Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp3953220rwb; Sat, 21 Jan 2023 03:25:17 -0800 (PST) X-Google-Smtp-Source: AMrXdXuPUClIL6yoD3DT6DRv1nqrjfbjQAUBAdzPgI1RvBSR/Ce59B91FBJC6P3ZevMen2buo29/ X-Received: by 2002:a17:90a:688f:b0:228:e790:4c2a with SMTP id a15-20020a17090a688f00b00228e7904c2amr19030958pjd.2.1674300317529; Sat, 21 Jan 2023 03:25:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674300317; cv=none; d=google.com; s=arc-20160816; b=w5SzesrD4le+okjkx/Pcf70jCkFdQyLaQsKftRJbcW6SR6dDndKq3aOM1dIV5FiMGd RfaDwx8tssd/CPTUvkDFjM+BUdmP8F1gozzDRGIrzXornQJrH5qInZR90+tql56HcutH Jbkj5b+RW03EaIvM0Vm5ordo9lzvi/KCkTRi4n89vRqa5h1gwwDI9WQWKulAmquT3zKG /eoSePOxfgkorRH5rYuIQEFQuvqvV8fdNbcZlnX/NE2QmnwnWQZPFmgHEmWpD8T9jjO4 ZY/Fg6htG0olxAkUBVvxKYczkNJPJ4ZQBRIXJX1O6vMcwdeRV11/o+cszyunGKA3kTvj ESjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:ui-outboundreport:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:mime-version:date:message-id:dkim-signature; bh=uMF5I8tUHfQh0DF1j3so9R+nhJOIUIlI+zUDwDr0V7E=; b=eOTY4WXpgvbmV5GyDTqeqRy0j+aEFAJHBIKxVNf70fkK7jiOIn/lRszTQcYUd503UX Xq3dlSTkBUlePp3Ii0ERwTl/ilnn1Nlx/um9Ui+tS3euxF4jqkramF9fOgSpRrsP7iAE fJCBJLbtUOyT7RMePGNNchS8nmnzIzinoI2oJ0kLpdCdnBvJFlXXYPHN8NDf/6CJ9P8b KXeuy3dhk4B6W27YndtfzAoNQ9IqIGJq6jej6yHRJXdwIsvlPrQ92OBBMbwelRZbdL0c nhZxkQUBSOTdsTiChYEyMCts6UP5k9/w/at2arpGG/GTk70T1j2FgALjc83yr35KPuzq 4sHA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=nnzt9Zpp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gl14-20020a17090b120e00b002263b1df9f7si11254911pjb.0.2023.01.21.03.25.10; Sat, 21 Jan 2023 03:25:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmx.de header.s=s31663417 header.b=nnzt9Zpp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmx.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229604AbjAUK5i (ORCPT + 52 others); Sat, 21 Jan 2023 05:57:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35946 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229450AbjAUK5f (ORCPT ); Sat, 21 Jan 2023 05:57:35 -0500 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4EAFC4DBD2; Sat, 21 Jan 2023 02:57:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1674298637; bh=L/aJJn/riBYG9saLW8J+sSsBQJtwlVhELhY1kNywEKw=; h=X-UI-Sender-Class:Date:Subject:To:Cc:References:From:In-Reply-To; b=nnzt9ZppPiw/3D6ZRnJNFnZsDJjBpLxJF7g7N35RXr2SIodmoNUI7UchRHPug9srM /AU6UCnU1Rh2BxIOWJ7Wu0fv+gsGio62RKqhJxu6Hteny6w0I5L077afhNr9PVuDVu LHr4dYmhraGv9xZOvmIKzJ3oS1ny91lNWe8rRDq6PNqfJ8MXcRGU6+ZjcqPJw2aYmg rTyJKDStbqY1Aep0c+pq+n1gMKv9765nEDQFmuIOjSGNRGSmoUIvHfliwELWR5RCB/ NxkPRjRPJrdoAER+XVro/RGj/IpZEDv7QpQQ8fi22q5Li1v3n8IAOnWT/DVdPaex+b /UmyZYr7To3wg== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from [192.168.20.60] ([92.116.167.128]) by mail.gmx.net (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1Ma20k-1pFrfU45hM-00Vvkl; Sat, 21 Jan 2023 11:57:17 +0100 Message-ID: Date: Sat, 21 Jan 2023 11:57:12 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v3 4/4] fs/sysv: Replace kmap() with kmap_local_page() Content-Language: en-US To: Ira Weiny , Al Viro , Matthew Wilcox Cc: "Fabio M. De Francesco" , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-parisc@vger.kernel.org References: <20230119153232.29750-1-fmdefrancesco@gmail.com> <20230119153232.29750-5-fmdefrancesco@gmail.com> <99978295-6643-0cf2-8760-43e097f20dad@gmx.de> <63cb9ce63db7e_c68ad29473@iweiny-mobl.notmuch> From: Helge Deller In-Reply-To: <63cb9ce63db7e_c68ad29473@iweiny-mobl.notmuch> Content-Type: text/plain; charset=UTF-8; format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qYvL26kWaMJ4eCz5mNZELcZuaVTE3tLAjDvt2uwL/Q5RkbKbfRjlBCV3F klcyZLOKmrbvfHRDeU1z2IPuklrBJkq12JeQAswadJImABEGvLMcvsSZEneXbZIGwSzLZ6j0b gpTzqQOTMhoyzbbaYsvaK6eZ118QOIrxPyuFnvZOIct5yeEzKirLrkfc49Q65gKSZeq0bEJhk 7Nnm/LCJJ93hzMFchD1ojkMjvGY= X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/21/23 09:05, Ira Weiny wrote: > Helge Deller wrote: >> On 1/20/23 06:56, Al Viro wrote: >>> On Fri, Jan 20, 2023 at 05:07:48AM +0000, Al Viro wrote: >>>> On Fri, Jan 20, 2023 at 04:54:51AM +0000, Matthew Wilcox wrote: >>>> >>>>>> Sure, but... there's also this: >>>>>> >>>>>> static inline void __kunmap_local(const void *addr) >>>>>> { >>>>>> #ifdef ARCH_HAS_FLUSH_ON_KUNMAP >>>>>> kunmap_flush_on_unmap(addr); >>>>>> #endif >>>>>> } >>>>>> >>>>>> Are you sure that the guts of that thing will be happy with address= that is not >>>>>> page-aligned? I've looked there at some point, got scared of paris= c (IIRC) >>>>>> MMU details and decided not to rely upon that... >>>>> >>>>> Ugh, PA-RISC (the only implementor) definitely will flush the wrong >>>>> addresses. I think we should do this, as having bugs that only mani= fest >>>>> on one not-well-tested architecture seems Bad. >>>>> >>>>> static inline void __kunmap_local(const void *addr) >>>>> { >>>>> #ifdef ARCH_HAS_FLUSH_ON_KUNMAP >>>>> - kunmap_flush_on_unmap(addr); >>>>> + kunmap_flush_on_unmap(PAGE_ALIGN_DOWN(addr)); >>>>> #endif >>>>> } >>>> >>>> PTR_ALIGN_DOWN(addr, PAGE_SIZE), perhaps? >>> >>> Anyway, that's a question to parisc folks; I _think_ pdtlb >>> quietly ignores the lower bits of address, so that part seems >>> to be safe, but I wouldn't bet upon that. >> >> No, on PA2.0 (64bit) CPUs the lower bits of the address of pdtlb >> encodes the amount of memory (page size) to be flushed, see: >> http://ftp.parisc-linux.org/docs/arch/parisc2.0.pdf (page 7-106) >> So, the proposed page alignment with e.g. PTR_ALIGN_DON() is needed. >> > > I'm not sure I completely understand. > > First, arn't PAGE_ALIGN_DOWN(addr) and PTR_ALIGN_DOWN(addr, PAGE_SIZE) t= he > same? Yes, they are. > align.h > #define PTR_ALIGN_DOWN(p, a) ((typeof(p))ALIGN_DOWN((unsigned long)(p= ), (a))) > > mm.h: > #define PAGE_ALIGN_DOWN(addr) ALIGN_DOWN(addr, PAGE_SIZE) > > Did parisc redefine it somewhere I'm not seeing? No, there is nothing special in this regard on parisc. > Second, if the lower bits encode the amount of memory to be flushed is i= t > required to return the original value returned from page_address()? No. If the lower bits are zero, then the default page size (4k) is used for th= e tlb purge. So, if you simply strip the lower bits (by using PAGE_ALIGN_DOWN() or ALIG= N_DOWN()) you are fine. Helge