Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1821499pxb; Wed, 9 Feb 2022 05:20:22 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUwSuIvMPqmlY1ArUerk2YdS6xgMC9v9KgfNuloU1nty6nJOCXwRhokfQ8Bf31kvS2+WRM X-Received: by 2002:a05:6a00:1a87:: with SMTP id e7mr2250261pfv.84.1644412821749; Wed, 09 Feb 2022 05:20:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644412821; cv=none; d=google.com; s=arc-20160816; b=FjaPAeDeFWkgYSZ+9uTE5g+kRlt+ben3NOI+A/I8CTSS3ouMfo3roao0gR7Vzg+hRX DsdHoCHxvYN4mcCYh7C0QOBncz8y7+Y3GorcoNPG66LLPmkWlGK4YGPqLIL8KCERo8dQ teXSGdCYpGesv4YCOnA5eoOGcDV1jz9ze1lGq/r6Cb7ypPmRaxlZ4e8MXqovrgz18szj uT2D+GyIPMfEAY7yg7nZXtHXMU3MxImVJnAoB1hN9qxEz3N/ArFslAOe+8WozgKxnOgZ LClLqbsU8ZlhJL7sUEw3yVr8gnSFmn2qYBLaipv5+zF2bCYBKELQ1HmxXvG6sztCN2RI sCcw== 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=qr3B/YdhuJDpFc8HHxnJqkEY9TcdrNCwos1PAv6QaS8=; b=Njb9fn6/Dvp+jBI2kZ+g/PcQnd1EnbSAbu4icwM4xR09jQ3K2Obt36qHOx4b8xox53 Oe2S7w1EinaEF5xJG3N2UG32av5g1lTR0e2ncLrnL1Yg/LeElHRuupoLTY/kpWo+l+qo x5lC3AAXFvNeYPQzlWB141xKSalU223KfcUMb1dwX4RpbdNJGn7yyB8nFgob+yQS2R5M m+2pjj6spgZVy4d9KS9f2OaYEznXJZHKRTqUa9IDCyLjhbAyscDIhW45j6mUcQnQtWTA GtxESPsoaoKiAB5z/s9DPoI/esCAx3+WUGhZBDFbQKGu+jssd4q3T3midanLnkLOlnI4 h0JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EW8ROf3b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id d17si15077176pls.431.2022.02.09.05.20.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 05:20:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EW8ROf3b; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 88BFDE0F9DBB; Wed, 9 Feb 2022 02:06:18 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349603AbiBHJHY (ORCPT + 99 others); Tue, 8 Feb 2022 04:07:24 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231674AbiBHJHW (ORCPT ); Tue, 8 Feb 2022 04:07:22 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC600C0401F0 for ; Tue, 8 Feb 2022 01:07:20 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A61C3B812A2 for ; Tue, 8 Feb 2022 09:07:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EE818C004E1; Tue, 8 Feb 2022 09:07:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1644311238; bh=L0Queu/J22hPtJlTspT9X3XGQIvM4Eac6YqmWHNc+DU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EW8ROf3bW4Vrqq2Ld2IiU8cCkWLdVnOSyKbCyAxGIpHKABy95z412qcuIGgpbJ1OF fv5NQDwtPa4BLABcTBzbMYRd+Zvl7iUQBr0lkKLUsTcjFeCinEwvrgAnQeFRTA6nhR 37XkOpBlMHsJ+czh00cFa3oL2fGPHFHvznCR0zP0ZvQ9zAbVj3tG1DlUP8BtfCfq/R gXb9c5Ue27dCA/QMT7a+ZB2gddXn8FTswx44Su4k08oJqAKxXmBZsGjYEIZDVsHVo8 P+exbaXwa+8U5FTikoP9XLhD/uDWxvnCFmBcfKJ2t2uts90YE2don5ZV2bljYHvzK4 bk9gPeMYWXMgw== Date: Tue, 8 Feb 2022 11:07:07 +0200 From: Mike Rapoport To: Michel Lespinasse Cc: Linux-MM , linux-kernel@vger.kernel.org, Andrew Morton , kernel-team@fb.com, Laurent Dufour , Jerome Glisse , Peter Zijlstra , Michal Hocko , Vlastimil Babka , Davidlohr Bueso , Matthew Wilcox , Liam Howlett , Rik van Riel , Paul McKenney , Song Liu , Suren Baghdasaryan , Minchan Kim , Joel Fernandes , David Rientjes , Axel Rasmussen , Andy Lutomirski Subject: Re: [PATCH v2 33/35] arm64/mm: attempt speculative mm faults first Message-ID: References: <20220128131006.67712-1-michel@lespinasse.org> <20220128131006.67712-34-michel@lespinasse.org> <20220131080729.GA785@lespinasse.org> <20220207173919.GB12302@lespinasse.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220207173919.GB12302@lespinasse.org> X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, RDNS_NONE,SPF_HELO_NONE,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 Mon, Feb 07, 2022 at 09:39:19AM -0800, Michel Lespinasse wrote: > On Tue, Feb 01, 2022 at 10:58:03AM +0200, Mike Rapoport wrote: > > On Mon, Jan 31, 2022 at 12:07:29AM -0800, Michel Lespinasse wrote: > > > On Sun, Jan 30, 2022 at 11:13:26AM +0200, Mike Rapoport wrote: > > > > The speculative page fault implementation here (and for PowerPC as well) > > > > looks very similar to x86. Can we factor it our rather than copy 3 (or > > > > more) times? > > > > > > In each arch, the speculative code was written along the lines of the > > > existing non-speculative code, so that behavior would be unchanged > > > when speculation succeeds. > > > > > > Now each arch's existing, non-speculative code paths are quite similar, > > > but they do have small differences as to how they implement various > > > permission checks, protection keys and the like. The same small > > > differences end up being reflected in the new speculative code paths. > > > > > > I agree it would be nice if this code could be unified between archs, > > > but IMO this should start with the existing non-speculative code - > > > I don't think it would make sense to try unifying the new speculative > > > code while trying to follow the behavior of the non-unified old > > > non-speculative code paths... > > > > Then maybe this unification can be done as the ground work for the > > speculative page fault handling? > > I feel like this is quite unrelated, and that introducing such > artificial dependencies is a bad work habit we have here in linux MM... The reduction of the code duplication in page fault handlers per se is indeed not very related to SPF work, but since the SPF patches increase the code duplication, I believe that the refactoring that prevents this additional code duplication is related and is in scope of this work. > That said, unifying the PF code between archs would be an interesting > project on its own. The way I see it, there could be a unified page > fault handler, with some arch specific parts defined as inline > functions. I can see myself making an x86/arm64/powerpc initial > proposal if there is enough interest for it, but I'm not sure how > extending it to more exotic archs would go - I think this would have > to involve arch maintainers at least for testing purposes, and I'm not > sure if they'd have any bandwidth for such a project... There is no need to convert all architectures and surely not at once. The parts of page fault handler that are shared by several architectures can live under #ifdef ARCH_WANTS_GENERIC_PAGE_FAULT or something like this. > -- > Michel "walken" Lespinasse -- Sincerely yours, Mike.