Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1733802rdb; Wed, 31 Jan 2024 07:34:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IEirLknJUTOojeJYOImhBFsm22ht3cvMm0C5sf9MHxyDg2Ooia+2G8TJpmhLgi7PJfv5URT X-Received: by 2002:ad4:5ec8:0:b0:686:49a0:fa24 with SMTP id jm8-20020ad45ec8000000b0068649a0fa24mr2106036qvb.18.1706715287921; Wed, 31 Jan 2024 07:34:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706715287; cv=pass; d=google.com; s=arc-20160816; b=IP3hrS4EithHrDsWphzwzTu7NNGfuyTdsZVvYQ+yuCkC5odZyUsJ++HPDirtp10Yk+ 5iz+CWfWrMcW0RgdX7dgcOG4+acrEhTkyM167/5ogm638uo3Lpnshweyi4AYdDENSujE 3GbX7tG0L/hCZbGmriR/msj0fCIUvKeVQd5fKfthcI5s5OjZx5kFEhHoRQAY9mbszbUL L0YptQwtLDvWpwYLJdFAS2fLUnasEbJ5H7S5JQT98b+Ti319JNg8bzpNxmEBwf9tRjNH ZOYRaCzwrIXW99lTSIn0/+kkv7GDKh4Q4tOaaE2YKRLC4YIukcBvN1E7M8Fdx1PnVGrn btVw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=3KKx9ivp6dsUTizTz13FlZ1sHVV9IWnIwrubcBg6iXA=; fh=C2K+q5g6tBTVZwcPHS0hPiEYPKAH3BgMBvctu5GNJgE=; b=OPH5o4iguVHDo0+vp6iYnrHLccunqcb2hG2Ie0GSdOkbrSSzFAp6lYDXbYqDfdGPiC IGNQXyrR4m49yJXKx1aZh3Zo+Y53Uvc0DSsU09D+seH89e+ykgLHN9MRu9C5Js2Xj3Xn Er0dV47d5Ly0PxdFvRqLThIk4enMTXXZ+swVn137dKVV6okVJm/wY5xKE7If0j9Y4nh7 FVRKkeQ5PXGCEJGmORc4mLMTy1FG3pvzSV50q53vBfbOFarL07L0RVryGGNSxQ15+//e myc0P9//Z+7nkGCxz50Pf6Po16JQVSo51tfBJO4Ph8+y0/AYyZgGx7weiB2EAhs0xbJP mqAQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=lPSfX5mK; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-46721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com X-Forwarded-Encrypted: i=1; AJvYcCXw6SJBb8D+z5K2qb/BJFPp9z7ryy9UU3jVtE4IQp+BFlnAHaE5gwiO4yrInyWUoRS0QNPyY1dVWZnPE6/9ezoKVeTH/r/BniVutfcxiw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id i3-20020ad45c63000000b0067f931f6bf8si12411429qvh.122.2024.01.31.07.34.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 07:34:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-46721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=lPSfX5mK; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-46721-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-46721-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A88671C21E00 for ; Wed, 31 Jan 2024 15:34:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A913112A162; Wed, 31 Jan 2024 15:34:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="lPSfX5mK" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (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 2BCA712A14F; Wed, 31 Jan 2024 15:34:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706715242; cv=none; b=JyoiK1LwONhuq6z82LcfDW+GQqoc3JouVhK4m8okrV+cDdKZw2b3x2DMxmtL7kKiQUuRUp1DmlXZ2O4JojWTHf4rVN4S3rRYsaBcmiDJhVm3hLMBwcKzGgXSmfdkiOv9BG2VTi23T0nwo5UiueWEqiz+Lm1dQHGp5yyf27LKLyc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706715242; c=relaxed/simple; bh=JvE4wxUL3PufVxrqn37IX2VRkyiWvVzHahoJOEeAAN0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=U3KtuWkV5Xlv27ziF/rWLnEqVOASDzj2tka9Hv3FbdXhGqHohvbvJWFvgkKo3fUyB7Q46rFX2CoL5hmlTbS22fAE7/QLKpm+59cHhRIwf8127bVY/gmwrxBzqYvDplUguxHJ9eS2N86J6aZhI2Rft50FBEz1aHiwJfsdEkMs/RI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=lPSfX5mK; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1706715240; bh=JvE4wxUL3PufVxrqn37IX2VRkyiWvVzHahoJOEeAAN0=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=lPSfX5mKN8KAdjUyhp4wQqLXqMyQtU4oXSSaIK93ceIbBz3nqA+xyShSZ63eNMUEY 4ltH4cpctRQ2bKBh2jPUz7YzlckoykLXBXL1iKZGhjEsqitBuZDmZyJzJykroyGZYI UBRzcNKyl0x3ztSsfJ0bzfrYwiCZy2rcArsz5GTC+j1RVGNmPtBcLry/HUkANuRMO7 COWdL0YdaUce34kcdlXBa1wur1kg1WwGiV7ZRfpL1fu8Ts2gaEHLM78D8xZmtK+QV5 D2TwH4bbt7gA4rZTlIw2qNkrfTkpwniCn8FOD4uTIYdA+HjQ3EqofTYkLu5XDgPZiF wGhhl/Jzf6dQg== Received: from [172.16.0.134] (192-222-143-198.qc.cable.ebox.net [192.222.143.198]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TQ5fv5JhHzVrW; Wed, 31 Jan 2024 10:33:59 -0500 (EST) Message-ID: <8325617c-51a4-4747-8082-befe9ff1c0f3@efficios.com> Date: Wed, 31 Jan 2024 10:33:59 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v4 4/4] membarrier: riscv: Provide core serializing command Content-Language: en-US To: Andrea Parri , paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, paulmck@kernel.org, corbet@lwn.net Cc: mmaas@google.com, hboehm@google.com, striker@us.ibm.com, charlie@rivosinc.com, rehn@rivosinc.com, rdunlap@infradead.org, sorear@fastmail.com, linux-riscv@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240131144936.29190-1-parri.andrea@gmail.com> <20240131144936.29190-5-parri.andrea@gmail.com> From: Mathieu Desnoyers In-Reply-To: <20240131144936.29190-5-parri.andrea@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-01-31 09:49, Andrea Parri wrote: > RISC-V uses xRET instructions on return from interrupt and to go back > to user-space; the xRET instruction is not core serializing. > > Use FENCE.I for providing core serialization as follows: > > - by calling sync_core_before_usermode() on return from interrupt (cf. > ipi_sync_core()), > > - via switch_mm() and sync_core_before_usermode() (respectively, for > uthread->uthread and kthread->uthread transitions) before returning > to user-space. > > On RISC-V, the serialization in switch_mm() is activated by resetting > the icache_stale_mask of the mm at prepare_sync_core_cmd(). > > Suggested-by: Palmer Dabbelt > Signed-off-by: Andrea Parri Reviewed-by: Mathieu Desnoyers -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com