From patchwork Sun Jul 10 23:33:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nadav Amit X-Patchwork-Id: 12912929 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 E11C9C433EF for ; Mon, 11 Jul 2022 07:08:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7FAD1900015; Mon, 11 Jul 2022 03:08:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7AED7900002; Mon, 11 Jul 2022 03:08:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 67284900015; Mon, 11 Jul 2022 03:08:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 56D08900002 for ; Mon, 11 Jul 2022 03:08:41 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 37A8520418 for ; Mon, 11 Jul 2022 07:08:41 +0000 (UTC) X-FDA: 79673941242.25.07DBADF Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by imf03.hostedemail.com (Postfix) with ESMTP id D172B20030 for ; Mon, 11 Jul 2022 07:08:40 +0000 (UTC) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 8ED2D53B for ; Mon, 11 Jul 2022 07:08:40 +0000 (UTC) X-FDA: 79673941200.23.8DE8B46 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) by imf24.hostedemail.com (Postfix) with ESMTP id 243AD180061 for ; Mon, 11 Jul 2022 07:08:39 +0000 (UTC) Received: by mail-pl1-f169.google.com with SMTP id j12so3696748plj.8 for ; Mon, 11 Jul 2022 00:08:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gadZ2vlA0vhG8v4UXRsB+M5kKIdI90uIBWjUdQuHTNc=; b=D5MgeewHNkpkpqDDGFH3D80y0Da/7tBDDUUtBY0dz+iSjWpsLsHib/uFA8dZ4NSr+M lFWnI+v3sWNqFBp9F761RtlFHl6/obN4DUkTE+nhabIQ30fIfV+4R43ptqfiFyNeti1c oJPELdFS6UJy3HwUlfVEd7BzB5GnTHE618HCcaG+ldnoeD+Z/sMAjVXbueiehq0/0fHq UIiZtNWXfrRp6y8cRvFBcbEmT6hy+/f02iG4/Hfz+migmqhSGMThOJhJLsgnaQY7wOs5 D9eU+zxxJQch59qxvc1EcAUyFYeSAcdTTLJmjqQWqOUCidQwrve+/03xHbrQMPVsXrxV sH1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=gadZ2vlA0vhG8v4UXRsB+M5kKIdI90uIBWjUdQuHTNc=; b=wVpHkpAzKYtDdcYtO0FQnbMojhYxhiMQGQuNURunBRVkJpeolDksAOl7vZ5KgXcUd6 fyZD/YFdUhdwmo8U5k6TS6rKFk75k7vQgTmfxyJR2YjD8/mguCNo24JWgEAPuy6iLvid W+fyWVQkH9UfF+kmCJUQHyUUJI/RKvSEV444Ts2UNkMLFM2JYP5Qhf6i7zF5g9UNgQlr KNuOnWsfRy5Y6ZySxMycbeVF4vYZseGPaQvGaZPFs/SJ+XsbqUGU0P9836ALvEapHOPG Ae5hWq5v4WLXojEBGfpCcw2McusPke1n54HtVtPpAufYCUcpNKkV8EyXX8v73EErj8F0 37lA== X-Gm-Message-State: AJIora9NSPc9VF/RiCALgyeMiTsITSARdpgfjyJWv8Z4Xe2NNsrjN6RI p97h4to1xw0BEr0eIn2keRs= X-Google-Smtp-Source: AGRyM1vkch1kARi9+43efKCVChFZNhmprUPtukujgVbk1oomBgpudfZ208drnPRfnRXj5F25t/VQOQ== X-Received: by 2002:a17:90a:4704:b0:1ef:f369:bd0e with SMTP id h4-20020a17090a470400b001eff369bd0emr15844315pjg.20.1657523318876; Mon, 11 Jul 2022 00:08:38 -0700 (PDT) Received: from sc2-haas01-esx0118.eng.vmware.com ([66.170.99.1]) by smtp.gmail.com with ESMTPSA id o65-20020a625a44000000b0052ac99c2c1csm1945705pfb.83.2022.07.11.00.08.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 00:08:38 -0700 (PDT) From: Nadav Amit X-Google-Original-From: Nadav Amit To: linux-kernel@vger.kernel.org, Thomas Gleixner , Dave Hansen Cc: Ingo Molnar , Borislav Petkov , x86@kernel.org, Linux MM , Nadav Amit , Peter Zijlstra , Andy Lutomirski Subject: [PATCH] x86/mm/tlb: Skip tracing when flush is not done Date: Sun, 10 Jul 2022 16:33:55 -0700 Message-Id: <20220710233355.4066-1-namit@vmware.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657523320; a=rsa-sha256; cv=none; b=W10S37SRiSnASLASfAKHD0ijhGEv5nUlPnrefAlGVP675jDofPJ864Uos/K6aGtCt4aAOe 6A2D2psgXiovxz3tWUWa88BrNYPp5VDepq4sAjtH8oA7OqC2L3hnpAzoGlKfREaUUdNpN7 oU8X2MiinDRgouUdFT1mMwZzDU4pbw0= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=D5MgeewH; spf=none (imf03.hostedemail.com: domain of MAILER-DAEMON@hostedemail.com has no SPF policy when checking 216.40.44.15) smtp.mailfrom=MAILER-DAEMON@hostedemail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657523320; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=gadZ2vlA0vhG8v4UXRsB+M5kKIdI90uIBWjUdQuHTNc=; b=B1zAOCccvmGlD4RAxXeFsEpgNpE2D/9hfllqRdLgXEb1yAfWBnBqzZCz1DDjnrja9KaVbQ 1uR+iB7ZQBci/ez2JKuXoS7PfRPUROjkYVvF+9WOm7orNYM9WtN5pEBgbfcCQB2tU/AcL5 b0bbh19XZcFdiH4SKYTNCHaF+VuqqX0= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: D172B20030 X-Rspam-User: X-HE-Tag-Orig: 1657523319-41878 X-Stat-Signature: 1hhp6uwruiftji44rknc4saoc1yrqp6x Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=D5MgeewH; spf=none (imf03.hostedemail.com: domain of MAILER-DAEMON@hostedemail.com has no SPF policy when checking 216.40.44.15) smtp.mailfrom=MAILER-DAEMON@hostedemail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1657523320-595220 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: From: Nadav Amit Currently, if flush_tlb_func() does not flush for some reason, the tracing of the flush will be done only in certain cases, depending on the reason of the flush. Be consistent and just do not trace in all cases when the flush was eventually not done. Suggested-by: Dave Hansen Cc: Peter Zijlstra (Intel) Cc: Andy Lutomirski Signed-off-by: Nadav Amit --- arch/x86/mm/tlb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index 0f346c51dd99..5c17b86b928d 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -736,7 +736,7 @@ static void flush_tlb_func(void *info) u32 loaded_mm_asid = this_cpu_read(cpu_tlbstate.loaded_mm_asid); u64 local_tlb_gen = this_cpu_read(cpu_tlbstate.ctxs[loaded_mm_asid].tlb_gen); bool local = smp_processor_id() == f->initiating_cpu; - unsigned long nr_invalidate = 0; + unsigned long nr_invalidate; u64 mm_tlb_gen; /* This code cannot presently handle being reentered. */ @@ -795,7 +795,7 @@ static void flush_tlb_func(void *info) * be handled can catch us all the way up, leaving no work for * the second flush. */ - goto done; + return; } WARN_ON_ONCE(local_tlb_gen > mm_tlb_gen); @@ -871,7 +871,6 @@ static void flush_tlb_func(void *info) this_cpu_write(cpu_tlbstate.ctxs[loaded_mm_asid].tlb_gen, mm_tlb_gen); /* Tracing is done in a unified manner to reduce the code size */ -done: trace_tlb_flush(!local ? TLB_REMOTE_SHOOTDOWN : (f->mm == NULL) ? TLB_LOCAL_SHOOTDOWN : TLB_LOCAL_MM_SHOOTDOWN,