From patchwork Wed Feb 23 05:22:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junaid Shahid X-Patchwork-Id: 12756385 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09971C433F5 for ; Wed, 23 Feb 2022 05:24:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 33F228D001B; Wed, 23 Feb 2022 00:24:43 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2C62B8D0001; Wed, 23 Feb 2022 00:24:43 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 118978D001B; Wed, 23 Feb 2022 00:24:43 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0233.hostedemail.com [216.40.44.233]) by kanga.kvack.org (Postfix) with ESMTP id 0367C8D0001 for ; Wed, 23 Feb 2022 00:24:43 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id BCCBC1816393E for ; Wed, 23 Feb 2022 05:24:42 +0000 (UTC) X-FDA: 79172904804.25.7C6D754 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf30.hostedemail.com (Postfix) with ESMTP id 4347980003 for ; Wed, 23 Feb 2022 05:24:42 +0000 (UTC) Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-2d2d45c0df7so163208827b3.1 for ; Tue, 22 Feb 2022 21:24:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=qiOY3I7MTzDOyydGuOsoL3kibVHTWqt/T8NonRDSdjI=; b=gHD/ZzZ2afDsPzQ43uzTfHDeNudIA9BOq9xrr9L14+jP+dH61iVLZ9hzKNk6oCuBOI frJ4Y/pMW9lHMFuHIDT5LntquphVA/hdUftBkeKzRimB/OZsUvqrqt+OTldNL/5M2dvF +PIjZDytqBI9qNUICzwPtZ9WZreG3la5anScSUKXP0fumh99WG+FQaCeyfbwMohmDN9Z TqQY1Ne53dTgZlticBLJ/nLFoMZJ6npZslQ1FhKLNnIG+gBpH+SHHrgjBmREZgI8pcKn GtFQ6xyENvmtRWa1WOq2159X/570g6HXWtqzHRNADNoxBQZmRvsc5EkR5xI3zImo/8Xk CC5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=qiOY3I7MTzDOyydGuOsoL3kibVHTWqt/T8NonRDSdjI=; b=ZnGuNsckVZpSGazdP44hft8Bt99lJeoqPnrNu3TO54e3alXfAO7vsJ2UydK3xrfjXV aU43+GwykJ1pg8EEaz1/MUy01dJR7MgKozoxAHO//nT4AcsmDC2mSuRev8F1IPB8fBtQ 5Id72OuisWsNbaByc1Hd379ykzbOkjpgfNkYXaxN7TfXvp9wW2YfZ+l/HMjOxBSZizlA j5WKj+XnkPLeYaLahsFi2//YqwswXgiEYW8MWwkhCYJwZFW4+n8FKg6/Ti9LPZTxJHnK xvVxPHzqjkyU1ioS+vtYDvTgFtS+LvcgSfZ8YeXBCQuYc9y2D7LmJqVQi9AF4WFdwr5n cVyQ== X-Gm-Message-State: AOAM530OYd/+BMCRtYgYjYcPHGrb5P37pQnKUpFq7SRoyFSoQrGtH9IV OGX84TYe8MfKmDUgMuEomwSWUU5AWre0 X-Google-Smtp-Source: ABdhPJz0RUH+JeSNvxcFS2t+PaXJsk2Yx25dJd/bxX+okavoC9VlrjteMlukvkj4zkv9eNKI+iSQhOk6jOMd X-Received: from js-desktop.svl.corp.google.com ([2620:15c:2cd:202:ccbe:5d15:e2e6:322]) (user=junaids job=sendgmr) by 2002:a25:bad2:0:b0:620:fe28:ff53 with SMTP id a18-20020a25bad2000000b00620fe28ff53mr26732357ybk.340.1645593881600; Tue, 22 Feb 2022 21:24:41 -0800 (PST) Date: Tue, 22 Feb 2022 21:22:01 -0800 In-Reply-To: <20220223052223.1202152-1-junaids@google.com> Message-Id: <20220223052223.1202152-26-junaids@google.com> Mime-Version: 1.0 References: <20220223052223.1202152-1-junaids@google.com> X-Mailer: git-send-email 2.35.1.473.g83b2b277ed-goog Subject: [RFC PATCH 25/47] mm: asi: Avoid warning from NMI userspace accesses in ASI context From: Junaid Shahid To: linux-kernel@vger.kernel.org Cc: kvm@vger.kernel.org, pbonzini@redhat.com, jmattson@google.com, pjt@google.com, oweisse@google.com, alexandre.chartre@oracle.com, rppt@linux.ibm.com, dave.hansen@linux.intel.com, peterz@infradead.org, tglx@linutronix.de, luto@kernel.org, linux-mm@kvack.org Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b="gHD/ZzZ2"; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf30.hostedemail.com: domain of 3GcUVYgcKCBI1C5s0vAy66y3w.u64305CF-442Dsu2.69y@flex--junaids.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3GcUVYgcKCBI1C5s0vAy66y3w.u64305CF-442Dsu2.69y@flex--junaids.bounces.google.com X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 4347980003 X-Stat-Signature: w7gpp8pz3q1y9eb47yoaoeba77ffp54k X-HE-Tag: 1645593882-559695 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000229, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: nmi_uaccess_okay() emits a warning if current CR3 != mm->pgd. Limit the warning to only when ASI is not active. Signed-off-by: Junaid Shahid --- arch/x86/mm/tlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 25bee959d1d3..628f1cd904ac 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -1292,7 +1292,8 @@ bool nmi_uaccess_okay(void) if (loaded_mm != current_mm) return false; - VM_WARN_ON_ONCE(current_mm->pgd != __va(read_cr3_pa())); + VM_WARN_ON_ONCE(current_mm->pgd != __va(read_cr3_pa()) && + !is_asi_active()); return true; }