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 X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B9BFCC433E7 for ; Tue, 1 Sep 2020 07:14:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6A02D206EB for ; Tue, 1 Sep 2020 07:14:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="FzFP0Eel" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6A02D206EB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id ACF056B0055; Tue, 1 Sep 2020 03:14:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A7F156B005A; Tue, 1 Sep 2020 03:14:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BC6B6B005C; Tue, 1 Sep 2020 03:14:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0138.hostedemail.com [216.40.44.138]) by kanga.kvack.org (Postfix) with ESMTP id 706126B0055 for ; Tue, 1 Sep 2020 03:14:57 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 394372464 for ; Tue, 1 Sep 2020 07:14:57 +0000 (UTC) X-FDA: 77213630634.25.dirt63_110081927096 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 006951804E3AF for ; Tue, 1 Sep 2020 07:14:56 +0000 (UTC) X-HE-Tag: dirt63_110081927096 X-Filterd-Recvd-Size: 6710 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) by imf29.hostedemail.com (Postfix) with ESMTP for ; Tue, 1 Sep 2020 07:14:56 +0000 (UTC) Received: by mail-pl1-f193.google.com with SMTP id k13so81348plk.13 for ; Tue, 01 Sep 2020 00:14:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :message-id:content-transfer-encoding; bh=/al16fY+oG7wi8gO1nM/m78+AsYvlumHk2pMFQ3TMsk=; b=FzFP0Eel9iYvlia4Nc5BLKhYQ54+BGAO1V2tU/sGXdJi8MQOW6L4pqSSrXN/K6KAXe a25uqaPQexMChZ0hBxdfINVvfgzS10W82DNoflEcaI5aMXG5toT7JTuHzaNT0FV8KRr/ B18beaCY809MMTEtF6Ef2ysrZGWifvmgAlU5X+rxwdirukbTi8/kAgwSlgZ3m7Cuywc9 QEXehQYQmWmJN4dnov52qhMFMN+vk2Bmyrgpk4i7J7i+RSmIIwb0aDtJy+qGCHuJ5Xdv gBFQhGiqxOr/OkbwEPk8j4NEv3747Nbg/NQS1PDVLYmftJSPwqJF/rkesYa1xp8HJkvK jseQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:message-id:content-transfer-encoding; bh=/al16fY+oG7wi8gO1nM/m78+AsYvlumHk2pMFQ3TMsk=; b=GGM1ebBwonOR1hE2zWyrwN7hZEZOCLGKHD5Z0Zsrg3aflZQ0fszlDKt6cpTLys7XgV L7TzrBDMRNy2etMkYTYfmvXnNARzoFhgv+TSn/z6wg/r3ln+UO5UlAHASUduR0cEYliK stleXk1q9KHzlotyaKKTmFcOpl7zIg+fbGXODns6CKRWZh1vt4TNnIVeMcBZv5oz5wlO j7TyfRUUrwiho4WKAy/+ywGb6yFPE8Fr9wo9rR/IGH1bHXieO+LHZG08I+Px04vLEKm9 Z4wOB23u+94uBY5Tq3usMNw5MgsXcHdXa64OGHv24aBn4QGdQQsjnfwv7p2O+JPLCFBp Xqow== X-Gm-Message-State: AOAM530geBFv/GHhoPT8kRsEJXpy2WHsD4AcLAf7pVmkN0C2Qr/QIvKL GPeb1FQTuldxuMyrLycT9Hw= X-Google-Smtp-Source: ABdhPJy9bArofpAKo5x0vO2HmR7rXYEt3ff/ZWj+qQcrpne0DH/wDOxuF4qjlER9qSn3Qx7ZbAzskQ== X-Received: by 2002:a17:90b:40cb:: with SMTP id hj11mr294026pjb.67.1598944495637; Tue, 01 Sep 2020 00:14:55 -0700 (PDT) Received: from localhost ([203.185.249.227]) by smtp.gmail.com with ESMTPSA id y7sm555814pfm.68.2020.09.01.00.14.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Sep 2020 00:14:55 -0700 (PDT) Date: Tue, 01 Sep 2020 17:14:49 +1000 From: Nicholas Piggin Subject: Re: [PATCH v2 01/23] asm-generic: add generic MMU versions of mmu context functions To: Mike Rapoport Cc: Arnd Bergmann , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org References: <20200826145249.745432-1-npiggin@gmail.com> <20200826145249.745432-2-npiggin@gmail.com> <20200901064942.GD432455@kernel.org> In-Reply-To: <20200901064942.GD432455@kernel.org> MIME-Version: 1.0 Message-Id: <1598944165.q4bl4ks3dk.astroid@bobo.none> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 006951804E3AF X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam02 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: Excerpts from Mike Rapoport's message of September 1, 2020 4:49 pm: > On Thu, Aug 27, 2020 at 12:52:27AM +1000, Nicholas Piggin wrote: >> Many of these are no-ops on many architectures, so extend mmu_context.h >> to cover MMU and NOMMU, and split the NOMMU bits out to nommu_context.h >>=20 >> Cc: Arnd Bergmann >> Cc: linux-arch@vger.kernel.org >> Signed-off-by: Nicholas Piggin >> --- >> arch/microblaze/include/asm/mmu_context.h | 2 +- >> arch/sh/include/asm/mmu_context.h | 2 +- >> include/asm-generic/mmu_context.h | 57 +++++++++++++++++------ >> include/asm-generic/nommu_context.h | 19 ++++++++ >> 4 files changed, 64 insertions(+), 16 deletions(-) >> create mode 100644 include/asm-generic/nommu_context.h >>=20 >> diff --git a/arch/microblaze/include/asm/mmu_context.h b/arch/microblaze= /include/asm/mmu_context.h >> index f74f9da07fdc..34004efb3def 100644 >> --- a/arch/microblaze/include/asm/mmu_context.h >> +++ b/arch/microblaze/include/asm/mmu_context.h >> @@ -2,5 +2,5 @@ >> #ifdef CONFIG_MMU >> # include >> #else >> -# include >> +# include >> #endif >> diff --git a/arch/sh/include/asm/mmu_context.h b/arch/sh/include/asm/mmu= _context.h >> index f664e51e8a15..461b1304580b 100644 >> --- a/arch/sh/include/asm/mmu_context.h >> +++ b/arch/sh/include/asm/mmu_context.h >> @@ -133,7 +133,7 @@ static inline void switch_mm(struct mm_struct *prev, >> #define set_TTB(pgd) do { } while (0) >> #define get_TTB() (0) >> =20 >> -#include >> +#include >> =20 >> #endif /* CONFIG_MMU */ >> =20 >> diff --git a/include/asm-generic/mmu_context.h b/include/asm-generic/mmu= _context.h >> index 6be9106fb6fb..86cea80a50df 100644 >> --- a/include/asm-generic/mmu_context.h >> +++ b/include/asm-generic/mmu_context.h >> @@ -3,44 +3,73 @@ >> #define __ASM_GENERIC_MMU_CONTEXT_H >> =20 >> /* >> - * Generic hooks for NOMMU architectures, which do not need to do >> - * anything special here. >> + * Generic hooks to implement no-op functionality. >> */ >> =20 >> -#include >> - >> struct task_struct; >> struct mm_struct; >> =20 >> +/* >> + * enter_lazy_tlb - Called when "tsk" is about to enter lazy TLB mode. >> + * >> + * @mm: the currently active mm context which is becoming lazy >> + * @tsk: task which is entering lazy tlb >> + * >> + * tsk->mm will be NULL >> + */ >> +#ifndef enter_lazy_tlb >> static inline void enter_lazy_tlb(struct mm_struct *mm, >> struct task_struct *tsk) >> { >> } >> +#endif >> =20 >> +/** >> + * init_new_context - Initialize context of a new mm_struct. >> + * @tsk: task struct for the mm >> + * @mm: the new mm struct >=20 > 'make *docs' will complain here about missing Return: description Thanks, I added something. Looks like we can't get rid of it, sparc and um can return error. Oh well. >> + */ >> +#ifndef init_new_context >> static inline int init_new_context(struct task_struct *tsk, >> struct mm_struct *mm) >> { >> return 0; >> } >> +#endif >=20 > Most architectures have non-trivial init_new_context, maybe this > should go into nommu_context.h? Hmm, I guess you could go either way. A few do have no-op functions so I=20 think that qualifies them if the rule is less ambiguous and we provide=20 no-op for functions unless it does not make any sense (e.g., switch_mm=20 for MMU). More importantly I already have the code written and am lazy =20 :) Thanks, Nick