Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp35672701rwd; Mon, 10 Jul 2023 10:43:48 -0700 (PDT) X-Google-Smtp-Source: APBJJlFgo+G9AN94YeW/dv/8j2wR4ks/S2TydAknBqEHUdMUfB9PLY1r3RtMPW5ZsOhtMm4Bpw+P X-Received: by 2002:aa7:dad8:0:b0:518:7a8b:5d4 with SMTP id x24-20020aa7dad8000000b005187a8b05d4mr13867657eds.16.1689011027952; Mon, 10 Jul 2023 10:43:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689011027; cv=none; d=google.com; s=arc-20160816; b=z+BuneHjjlahvSeW7DbKd7lVZEBR8VDeRlUqFl6TiRhAHzd14DxbEPLyki/rTxTsyf 6J18yWWUxef8TvRUjNDsX3r1aIwZ7D9jcV9v0WV+C7l4IQQj9RwKNfP1HOa4UVp3rOHv mTVS8IhPw9uuMZtAYrKIQBbh5Ggt3SNBS6ANberx2z4Bl41AEITJt5ZxyKjJPqA+cdHe ALjvXGCR+8GOjNHwJCPUMXp7SAkpnWBNYE07eeC3pyv9tAxXDRA6gVz/jcg3wCZA1Ugb 0mUf1NZtN7DZ8VQxHETuVkPSRX0PeGPvydsOhMmjVF6cmGrF0tkBIkTc+WdtAABsOFul 9cWA== 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=vDKqe6h9VsjQuDpKI9KRg1N7kbgZMbKA4ecQ1xozFqs=; fh=zcx+dfYYm8l5MyypCkPaD800jaIV9cQ2C8wpvtNbhBg=; b=CVjXQwlkHbTtb8PBC3hQ5cgQuIAyu6CJAK12p8MjLlXzNDPSTnxmg5KQEA1iUqHHzg 0qR/72gxxjhpABnjZ3BTumgBxt5J2N8W8Glk6gPluO1+wIlLFnA2wSn6l7cfRVmxzq9z hLQZyIx/eXNnaZJD3veRdgm4NBN9SEezaVRB3JvkMyPOawbhy7SFyg6ed4+3alTTAH+q 2OjXda4u4y4tdykwXdtvNGic1tgOwa+I7uY5a1DpKNtOEhjo1rNUM85U1o9ZrmtBC4sD Tkvn9p1E8sn1ng54pyaEb3gWLv9lQC1y6HqqMV5hpeC9Xbo0Cdto0fpOYHK5Rlk6iDEv JnTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=IMsBYjy3; 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 bf20-20020a0564021a5400b0051878e08975si1650edb.441.2023.07.10.10.43.22; Mon, 10 Jul 2023 10:43:47 -0700 (PDT) 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=@ziepe.ca header.s=google header.b=IMsBYjy3; 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 S232759AbjGJRVq (ORCPT + 99 others); Mon, 10 Jul 2023 13:21:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232661AbjGJRVd (ORCPT ); Mon, 10 Jul 2023 13:21:33 -0400 Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5F80E5C for ; Mon, 10 Jul 2023 10:21:14 -0700 (PDT) Received: by mail-qk1-x72c.google.com with SMTP id af79cd13be357-766fd5f9536so332767585a.3 for ; Mon, 10 Jul 2023 10:21:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1689009674; x=1691601674; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=vDKqe6h9VsjQuDpKI9KRg1N7kbgZMbKA4ecQ1xozFqs=; b=IMsBYjy3Toq+G3vBDgnvPIjgdoK/8dHggIY3Hs7qoUt25YkpzOmPBi/nHn//DrOYJB /Ua+/QBa5Use8IJESRSiFunKdkGqNHd+YUqoRuJfQ4kcz9FzGR8GIZXsQpoAByEtiRoW aHShM1l7QbL76OMNkc1lG2qoSZ//vH0KwhSWZJu3JAj2Jxo8XWZBsa1X0VxWF2oEWd2s Qu1lVdsr/969sUuC9+ClJLKaydssewFZiIszGWbW/S6Cjo7VrKDsSxZ7RPNvyFeMxk1W 6TYZEng5dbEcOdn1U6fXy08kcBT33/DATCe+/VchSTeFDgqF+J/WUVPSVonRZqpbV4JY T2ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689009674; x=1691601674; 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=vDKqe6h9VsjQuDpKI9KRg1N7kbgZMbKA4ecQ1xozFqs=; b=kPIplTuqw6AK82mSQCSykAu8RhwaFCBzsV2pxGuW18lUFD2ektIUudBE+zvr6Pfh3/ 2ailg8e792EBqrr9IhpkipVAAOcQ6B5on8C0H+V+cN9LjcuRYxF8cm4unSHP9pZzqrrR soZHwSs+0x6LeJa9mAA4moHAFHQn2V7rvbLAw/oqZKqqizWpCBh/nvC89f197xHG7PlT H8YrHrqEYa/QIAX9SzYvPm0xRDDPBlGhzG+30uSkQ/tzHXJngxhoGphjvUGG4iompLLS ktFRD82EpszzrfYXUBBY7yViUVtk9YBI9ZHdVk2/NEMKUkhF2UDW/YcICqAaictNKttr YvpA== X-Gm-Message-State: ABy/qLbtN46jQqaDnbPoIlBwiMD5TfWN7RKp3rGp9bd6jY94lFKEHhvX 73WSmzr6s9Czu7inUaH9YLXrbA== X-Received: by 2002:a05:620a:198f:b0:767:205b:7f4b with SMTP id bm15-20020a05620a198f00b00767205b7f4bmr13197531qkb.41.1689009673882; Mon, 10 Jul 2023 10:21:13 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-142-68-25-194.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.68.25.194]) by smtp.gmail.com with ESMTPSA id g6-20020ae9e106000000b00767dc4c539bsm61695qkm.44.2023.07.10.10.21.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jul 2023 10:21:13 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.95) (envelope-from ) id 1qIuZT-0004Dq-J0; Mon, 10 Jul 2023 14:21:11 -0300 Date: Mon, 10 Jul 2023 14:21:11 -0300 From: Jason Gunthorpe To: Gerald Schaefer Cc: Hugh Dickins , Andrew Morton , Vasily Gorbik , Mike Kravetz , Mike Rapoport , "Kirill A. Shutemov" , Matthew Wilcox , David Hildenbrand , Suren Baghdasaryan , Qi Zheng , Yang Shi , Mel Gorman , Peter Xu , Peter Zijlstra , Will Deacon , Yu Zhao , Alistair Popple , Ralph Campbell , Ira Weiny , Steven Price , SeongJae Park , Lorenzo Stoakes , Huang Ying , Naoya Horiguchi , Christophe Leroy , Zack Rusin , Axel Rasmussen , Anshuman Khandual , Pasha Tatashin , Miaohe Lin , Minchan Kim , Christoph Hellwig , Song Liu , Thomas Hellstrom , Russell King , "David S. Miller" , Michael Ellerman , "Aneesh Kumar K.V" , Heiko Carstens , Christian Borntraeger , Claudio Imbrenda , Alexander Gordeev , Jann Horn , Vishal Moola , Vlastimil Babka , linux-arm-kernel@lists.infradead.org, sparclinux@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2 07/12] s390: add pte_free_defer() for pgtables sharing page Message-ID: References: <20230628211624.531cdc58@thinkpad-T15> <20230629175645.7654d0a8@thinkpad-T15> <7bef5695-fa4a-7215-7e9d-d4a83161c7ab@google.com> <20230704171905.1263478f@thinkpad-T15> <20230705145516.7d9d554d@thinkpad-T15> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230705145516.7d9d554d@thinkpad-T15> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 Wed, Jul 05, 2023 at 02:55:16PM +0200, Gerald Schaefer wrote: > Ah ok, I was aware of that "semi-RCU" fallback logic in tlb_remove_table(), > but that is rather a generic issue, and not s390-specific. I thought you > meant some s390-oddity here, of which we have a lot, unfortunately... > Of course, we call tlb_remove_table() from our page_table_free_rcu(), so > I guess you could say that page_table_free_rcu() cannot guarantee what > tlb_remove_table() cannot guarantee. The issue is the arches don't provide a reliable way to RCU free things, so the core code creates an RCU situation using the MMU batch. With the non-RCU compatible IPI fallback. So it isn't actually RCU, it is IPI but optimized with RCU in some cases. When Hugh introduces a reliable way to RCU free stuff we could fall back to that in the TLB code instead of invoking the synchronize_rcu() For lots of arches, S390 included after this series, this would be pretty easy. What I see now as the big trouble is that this series only addresses PTE RCU'ness and making all the other levels RCUable would be much harder on some arches like power. In short we could create a CONFIG_ARCH_RCU_SAFE_PAGEWALK and it could be done on alot of arches quite simply, but at least not power. Which makes me wonder about the value, but maybe it could shame power into doing something.. However, calling things 'page_table_free_rcu()' when it doesn't actually always do RCU but IPI optimzed RCU is an unfortunate name :( As long as you never assume it does RCU anywhere else, and don't use rcu_read_lock(), it is fine :) The corner case is narrow, you have to OOM the TLB batching before you loose the RCU optimization of the IPI. Then you can notice that rcu_read_lock() doesn't actually protect against concurrent free. Jason