Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp593598iog; Fri, 17 Jun 2022 09:18:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sN8AR9FOfqfkhkr4jjmQiqgCA/vN/123PToiPBLlIkNleIwV11Y/A2057ezDFHLM2s6sZz X-Received: by 2002:a05:6402:3805:b0:435:61d8:8da0 with SMTP id es5-20020a056402380500b0043561d88da0mr4152280edb.63.1655482738569; Fri, 17 Jun 2022 09:18:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655482738; cv=none; d=google.com; s=arc-20160816; b=RsvQqCqt1KUvEf0fEH0Hpxw+zu8v6llRaU8G8qUE5HmMHNe5b7v1sxJOM1bddg38GL AIIaqBXg2kjWrIXP8Ywg3fcdELswvuui/qh9zl6L1kc4hLMNi78TuQU0ZR3q3nHbGlNc iLjAagMNYe87PeWawiB4UFdQGHzHxJGe37DFpJXJeL8mm+1KHVrnl+P+1YZZ64eq4+/N RpNmViFCmVetCizKaHJ6PbxYf+sXnkgj/87auz+Cslm7qpCmYi8WSkAqZC5HiCpMkTNr w6D1vl65a+A9P9vXAevwPqWeLKa86Dm11UvpwjhvaY/UBiY50j3aDbZ1QGkbcRYES05F nC2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=aIKnwKkhzdC958qsh/vVhbGBEqfmlkokiLIf9TRq+B8=; b=tlOmEwqJSNclvEMRtpnnWmATiAMmScHZFVDkIYGha4ID1sKVk6NIsGITFgS8dvHa5i ypXqcRFR/UwiENXda0ZWU7bYLvxINI9N8IMEPfSLqh7N16O1yxpb8vCzer58phfxK0m+ LmXz0/15iXblrevFQAvrUROlzFarjRuQD7iF5iEp/ZQWPdzaBypF+AKpN5mhW4uids7f 7TwsMjjC0LdlNKTNEzW+35kfWTv9mwGy8E5/4NHPpzqLcSkEKtOf0zOXc7rZZNq9XGDP gxptN8y3CKqdEsROKk2abDS5k5kXXwr8LTqtE5R0Kga65wJe4dXxvzSv45eZE6j/aGo3 exaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=nQdZTTAQ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hd11-20020a170907968b00b00718c7b4cbeasi689266ejc.991.2022.06.17.09.18.32; Fri, 17 Jun 2022 09:18:58 -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=@google.com header.s=20210112 header.b=nQdZTTAQ; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231967AbiFQPfp (ORCPT + 99 others); Fri, 17 Jun 2022 11:35:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231410AbiFQPfn (ORCPT ); Fri, 17 Jun 2022 11:35:43 -0400 Received: from mail-yb1-xb2d.google.com (mail-yb1-xb2d.google.com [IPv6:2607:f8b0:4864:20::b2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B467523BC9 for ; Fri, 17 Jun 2022 08:35:42 -0700 (PDT) Received: by mail-yb1-xb2d.google.com with SMTP id t1so7866598ybd.2 for ; Fri, 17 Jun 2022 08:35:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=aIKnwKkhzdC958qsh/vVhbGBEqfmlkokiLIf9TRq+B8=; b=nQdZTTAQ6ceFqR+sZ6oSkoAhXkBjUpnxm76h7VUqgfr9EK+LTZpkPJ5WXXgpYgNNuD kZRh/VcWDLCa29F9i4Y+VNEXUUau4Twkjc8CIo8+7JAuvQlArxy5+vJ1r9+ABefa7EGA o7VVphjiFVt9zhEMhhizfN8+OTfOYqQMMZ8ON/HRjwNRDUPW2bjv9wZDVGq+S438svib aIiOASrHMUBuTUfG/fHTN9IkCBjOShOn0Iq/YpRZisvKjJl4OpBq1z+dJmBGtAoizioS k9XLpwI0BD32Eo8evKItPhvJh58Mpr9OJc1dmL7+CFt9HNh3YFUB9Azewj+pPp5CTS/W 4XvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=aIKnwKkhzdC958qsh/vVhbGBEqfmlkokiLIf9TRq+B8=; b=MQQIVoLUllys7X3P1IyRD67rpcX2DsjgnqvuTHg6BgB/7CZ9KDhrgxTlhgbzdIR83/ x6yFly+Z4pwHlAjbVD4S3xhvTzZDH5Xa5VxjfCUubACQilCjUzQb3QTNBYy/2YST1cHf ofEIpqr1RdRZeMlCDFEvBWs2VbOZisjrvHFDJ4SqXMQrgcWYO9xyxl25X0LSpSjoKcyz 7yIJAleJR7TnYlN+gXp33iOwa8Vo4wvXYOp5UnVGvRR5I2n79vIy7TOfsPL/UO5waEER PX+bdh0FbDmTbNdqQZpFCztZBhFbEAdZP3tOdcUwDB3jtOOusGwV8Zc2sV55BCnXixH/ HPOQ== X-Gm-Message-State: AJIora8b9FuhbUJt26ZpGC0EV4wCw1FP4fWgj9Hnjr/mCTjLt5CV0DuK OcsSI3rHig4mGq0rNPF1qUecS4Vhd7fhPE3hqmx0Sw== X-Received: by 2002:a05:6902:1007:b0:665:197a:a3a8 with SMTP id w7-20020a056902100700b00665197aa3a8mr11539927ybt.274.1655480141505; Fri, 17 Jun 2022 08:35:41 -0700 (PDT) MIME-Version: 1.0 References: <20220610143527.22974-1-kirill.shutemov@linux.intel.com> <20220610143527.22974-5-kirill.shutemov@linux.intel.com> In-Reply-To: <20220610143527.22974-5-kirill.shutemov@linux.intel.com> From: Alexander Potapenko Date: Fri, 17 Jun 2022 17:35:05 +0200 Message-ID: Subject: Re: [PATCHv3 4/8] x86/mm: Handle LAM on context switch To: "Kirill A. Shutemov" Cc: Dave Hansen , Andy Lutomirski , Peter Zijlstra , "the arch/x86 maintainers" , Kostya Serebryany , Andrey Ryabinin , Andrey Konovalov , Dmitry Vyukov , "H . J . Lu" , Andi Kleen , Rick Edgecombe , Linux Memory Management List , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL 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, Jun 10, 2022 at 4:35 PM Kirill A. Shutemov wrote: > > Linear Address Masking mode for userspace pointers encoded in CR3 bits. > The mode is selected per-thread. Add new thread features indicate that th= e > thread has Linear Address Masking enabled. > > switch_mm_irqs_off() now respects these flags and constructs CR3 > accordingly. > > The active LAM mode gets recorded in the tlb_state. > > Signed-off-by: Kirill A. Shutemov > +#ifdef CONFIG_X86_64 > +static inline u64 mm_cr3_lam_mask(struct mm_struct *mm) > +{ > + return mm->context.lam_cr3_mask; > +} Nit: can we have either "cr3_lam_mask" or "lam_cr3_mask" in both places? --=20 Alexander Potapenko Software Engineer Google Germany GmbH Erika-Mann-Stra=C3=9Fe, 33 80636 M=C3=BCnchen Gesch=C3=A4ftsf=C3=BChrer: Paul Manicle, Liana Sebastian Registergericht und -nummer: Hamburg, HRB 86891 Sitz der Gesellschaft: Hamburg Diese E-Mail ist vertraulich. Falls Sie diese f=C3=A4lschlicherweise erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter, l=C3=B6schen Sie alle Kopien und Anh=C3=A4nge davon und lassen Sie = mich bitte wissen, dass die E-Mail an die falsche Person gesendet wurde. This e-mail is confidential. If you received this communication by mistake, please don't forward it to anyone else, please erase all copies and attachments, and please let me know that it has gone to the wrong person.