Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp551525lqs; Tue, 5 Mar 2024 09:15:57 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWX5B6wHeuK5WFt8oD+wHKKwWqSjBsGoBDDsfCixOa4Vc8aAz8m7Aqga228A9e1Pcs7H/j/LWn3CoEBZBrKn8mBGv1E2P9pC7DL3KuwrA== X-Google-Smtp-Source: AGHT+IFoVDH+stPcmcnzF5H0qHK4sQB5SJ0fIgdYM+z0Zs3yWMJ8lc1Y6k9gofEXlQedUuwdNDEN X-Received: by 2002:a05:6a20:7489:b0:1a1:4d86:55d with SMTP id p9-20020a056a20748900b001a14d86055dmr3020572pzd.13.1709658957649; Tue, 05 Mar 2024 09:15:57 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709658957; cv=pass; d=google.com; s=arc-20160816; b=B74nHlMcF4gdQuzKub2pebP+j9oem0r/t2MotRMq9ZUlTg32Zy/zTHnXcJAdYXWaip Mkumu2rQ+J0qRsc/mQaxqRxm5MBJdK1BgpTEZpkpIoJcqFH8sacN4N3SDo7VH6Tlfg34 r+UdQ7riBEZ/KumWm+5V9Uo5pKC1kp1zBC088p2KJUtb+tqOHQB+MJnetfj7EBZ6xBWR cqijSnyinXJuruagLb4kkedRBCr+FARgX/1Mend5xX4pD05mCAlWUtiaC7fLP6khNjzf iOzSUawJkSYKnvgYNAamyzI/PBsPP3J1hGIa4PRuroCiGnfHdhSz9+70R+ob0C+e8xbJ EGfQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=gZEKe7BRkNZMzZwAH6HdDbjhxnsuCBzIvW+/rGS6msI=; fh=4QiKELEhRqcM2VHJDpLNAA50EXgeqYSMMY6np1yyygo=; b=R2MqXeO1RprBNBC21IVakoHulk+/XEQpxGI7KClQMvD8RFsSn8viJANkwTYcmeAThv oLAzHsuG2pZvwt14fMCXI0lUhlEo7doN5yidWAu9GAf6VSB13eSSexFufRFY8QP1y39m OqiOI4sqfhvG5Mn/CngkBD/2Q+EPhmHiyOY7RWEVQHlEMtzB+cABOMCmHSt9rJQNlpmC ZSO05yvWLuLIFiABpshNU0bLDO8Xn/poyH6W5+KmCkZehCPRIRMdTMtyM2SDOhlsXuHx PW4b4ZpNsm4E/AzyetfC9W1eTCJNeOklb5cd/BZ5R5Lw48DSzgNCokj2ARAWhgX2iHYr 7Xaw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FcE6HeqO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92747-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92747-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id m11-20020a62f20b000000b006e48bbb9073si10202396pfh.309.2024.03.05.09.15.57 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Mar 2024 09:15:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-92747-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FcE6HeqO; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-92747-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-92747-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 4A8512842B2 for ; Tue, 5 Mar 2024 17:13:42 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A0451429F; Tue, 5 Mar 2024 17:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="FcE6HeqO" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 461D4DDDA; Tue, 5 Mar 2024 17:13:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709658810; cv=none; b=dW3dYy3WltnmmHfv1MyM0ZspBwGPO8OEW7cIca74MjX0OnXaNn1rRyEv4qozMYGcSae6dISd3TJfADAWnu6aewnpiVDhcPvxEKJuaLNy9b+6GEe93ErFqgodfyOlW+vheJTxLSk41AlK6dxzHyx/9i8ob1+Q/Dlvp/odB5MJd+8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709658810; c=relaxed/simple; bh=mCb5rz9ozWoqeUEaaPJgZrZ0vT0gaWXiqiWNuvVUgO0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=di4EheIStr7il8qRRLNKArbElSr1G/BPW/R5BWn+WESafx0LNqYMn3KEqVu34ZvC20iAiBbTfUs6hz+DGByQWBWZ6FD69PQtGTWhff75n0APE8zg0477ivd050kLXjX/fGqCM2laS2fEIbXIw5V+V9Fx7vECHfJU1uiCVxS15bI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=FcE6HeqO; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 259A1C433F1; Tue, 5 Mar 2024 17:13:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1709658810; bh=mCb5rz9ozWoqeUEaaPJgZrZ0vT0gaWXiqiWNuvVUgO0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=FcE6HeqOOK1wT2/YX3qgFIm/ZjXrw7B3y/5/HLj9piykdyuccrb8QPZnN0Srxl7zP TBiU0e0yqNKVyp0xsVvpi8QLbgi4YZSxj61EzkYlcLimZ9yFv8xHaq2ZxsgdRx0rWG 35/LdjmliS4lGdI8+08v1OxZibwZ86DrccQ9LabSXIsxTM97BJwU+VsWGO59Fl12G8 qhF+WwlTKKbdFBVVeE5hsSny529DaK6HuASA84yqFvhYXdwfKpXTwYZQmTFl1Cr9CY 5IhCrTggjAa7lsaRcsz/fY9/0u309LUaWo9L4QMthPO1JlgG5CDoyLPiEv2FRVx/uZ CyQWo7/0eBmNA== Date: Tue, 5 Mar 2024 17:13:24 +0000 From: Will Deacon To: "levi.yun" Cc: catalin.marinas@arm.com, mark.rutland@arm.com, peterz@infradead.org, mathieu.desnoyers@efficios.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, nd@arm.com, stable@vger.kernel.org, Aaron Lu Subject: Re: [PATCH] arm64/mm: Add memory barrier for mm_cid Message-ID: <20240305171324.GA22616@willie-the-truck> References: <20240305145335.2696125-1-yeoreum.yun@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240305145335.2696125-1-yeoreum.yun@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) On Tue, Mar 05, 2024 at 02:53:35PM +0000, levi.yun wrote: > Currently arm64's switch_mm() doesn't always have an smp_mb() > which the core scheduler code has depended upon since commit: > > commit 223baf9d17f25 ("sched: Fix performance regression introduced by mm_cid") > > If switch_mm() doesn't call smp_mb(), sched_mm_cid_remote_clear() > can unset the activly used cid when it fails to observe active task after it > sets lazy_put. > > By adding an smp_mb() in arm64's check_and_switch_context(), > Guarantee to observe active task after sched_mm_cid_remote_clear() > success to set lazy_put. > > Signed-off-by: levi.yun > Fixes: 223baf9d17f2 ("sched: Fix performance regression introduced by mm_cid") > Cc: # 6.4.x > Cc: Mathieu Desnoyers > Cc: Catalin Marinas > Cc: Mark Rutland > Cc: Will Deacon > Cc: Peter Zijlstra > Cc: Aaron Lu > --- > I'm really sorry if you got this multiple times. > I had some problems with the SMTP server... > > arch/arm64/mm/context.c | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/arch/arm64/mm/context.c b/arch/arm64/mm/context.c > index 188197590fc9..7a9e8e6647a0 100644 > --- a/arch/arm64/mm/context.c > +++ b/arch/arm64/mm/context.c > @@ -268,6 +268,11 @@ void check_and_switch_context(struct mm_struct *mm) > */ > if (!system_uses_ttbr0_pan()) > cpu_switch_mm(mm->pgd, mm); > + > + /* > + * See the comments on switch_mm_cid describing user -> user transition. > + */ > + smp_mb(); > } We already have a stronger barrier than smp_mb() (dsb ish) in __switch_to(). Is that not sufficient? Will