Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp2140727rwb; Thu, 19 Jan 2023 21:52:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXvfYYJB4XoU3q6rwKdG9sEWV47aSzeruQfOYF7P3PmVcsIGziF82DL/klGv2alSnpUzLYi+ X-Received: by 2002:a05:6a21:999b:b0:b5:c353:d97b with SMTP id ve27-20020a056a21999b00b000b5c353d97bmr17451655pzb.50.1674193963738; Thu, 19 Jan 2023 21:52:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674193963; cv=none; d=google.com; s=arc-20160816; b=1Bnr8GxoWSz/mR/g/zS1ERcJk2SmbVZAVgBBFqq260b2szBA2hWK9n10eaUDbz2752 5Rs6P7Zyn1r5onVlRF2H6imQLf+8XERnpJ2BOaV7gbuoKricOGwa/nwKbXwbmQXjjyY6 yukfDhf189m8/2mC26htsWibjfhkfzMGgC8WwmGU1armVQsMOHvjd4Vc+d3oSVvypAer qiqYyL7aLDHDPip/TKshWH6N8mnQ1MDGy34n/mMyZZkwmgXTBBLChSu/U0IGsMjgP2v+ TFlI6bb2YdRN3ePFipXuMEUPnTL36SiI9uA11p85Hx48nvBxbdAWoeg2FuXRJPTQrDZf Vh0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=AgSRB+mgoCTnHm8pcHJStBFI1tbB4PFeuxr32dF+q1I=; b=gZMR4ZlTqRwBordqXYjiqxkbOGjbb8cOKAS0eWD6O5qPJPrPJd7Dq+TCQq6W9/Hvta axtbW51jZ2fIXJzkOsJx67Z0i5FvX03YzJlqZzZGYuFYxREyUXPnZIb05dSDoEFSeffE t4zwVGsXiGkTmsGWhtASKosUQ7r7qUBL6FBVbVUHq5SRIndrWTgVT3V3oZw96SwZ/Upo lcviWC4n+cL4ZPvO9swpiJcB2VjtGWEpU34kLKAwTlG1by0q6fkRUMdenWocqyM+jGZ2 APm1d3ms6xV59pPwDoqG3+Puy7Epn/JpyJsX/sLFYz1LNSEYonZZyUvK05NhrTgff63d 8nwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b="m/LXF6aD"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r20-20020a6560d4000000b004961cb25a14si36948583pgv.499.2023.01.19.21.52.38; Thu, 19 Jan 2023 21:52:43 -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=@infradead.org header.s=casper.20170209 header.b="m/LXF6aD"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229720AbjATFJX (ORCPT + 47 others); Fri, 20 Jan 2023 00:09:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230215AbjATFIy (ORCPT ); Fri, 20 Jan 2023 00:08:54 -0500 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A06080B90; Thu, 19 Jan 2023 20:56:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=AgSRB+mgoCTnHm8pcHJStBFI1tbB4PFeuxr32dF+q1I=; b=m/LXF6aDW8XnPkVzayqKAoi9G5 MFuhM+DkNyUv7XxxxNEKIkZgCiuXOylKdcJOC87wvTEUItyPUr43o5SgA1zTs9VTiSruEjSjxlz4H ytf34ZfHN5dz8+ggf0UzcFIh4XD8qwkvLUkGRUdvKkkcxGudCX66iL9KCR8d1mknRZYrZ1dhXQ+aS WIkftehBCvolqC0Hf0BZWBcEcFRXm7W+g2g+3XAynoTzMLFpKXcD1zRE+jW6ufWlkHE7+Xa1aEjXG XqN3PbRKsgxXgGPQtIhchhs9SW5ZOEadjtk+xe6iCf3AzxavZVpQj6kod5nDXTgtgJU1sf9iK4KCl N7mIS0eg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1pIjQR-001fc3-QV; Fri, 20 Jan 2023 04:54:51 +0000 Date: Fri, 20 Jan 2023 04:54:51 +0000 From: Matthew Wilcox To: Al Viro Cc: "Fabio M. De Francesco" , Christoph Hellwig , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Ira Weiny Subject: Re: [PATCH v3 4/4] fs/sysv: Replace kmap() with kmap_local_page() Message-ID: References: <20230119153232.29750-1-fmdefrancesco@gmail.com> <20230119153232.29750-5-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE 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 Fri, Jan 20, 2023 at 04:45:17AM +0000, Al Viro wrote: > On Fri, Jan 20, 2023 at 04:28:12AM +0000, Matthew Wilcox wrote: > > On Fri, Jan 20, 2023 at 04:21:06AM +0000, Al Viro wrote: > > > On Thu, Jan 19, 2023 at 04:32:32PM +0100, Fabio M. De Francesco wrote: > > > > > > > -inline void dir_put_page(struct page *page) > > > > +inline void dir_put_page(struct page *page, void *page_addr) > > > > { > > > > - kunmap(page); > > > > + kunmap_local(page_addr); > > > > > > ... and that needed to be fixed - at some point "round down to beginning of > > > page" got lost in rebasing... > > > > You don't need to round down in kunmap(). See: > > > > void kunmap_local_indexed(const void *vaddr) > > { > > unsigned long addr = (unsigned long) vaddr & PAGE_MASK; > > > > 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 parisc (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 manifest 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 } Thoughts?