Received: by 2002:a05:7412:5112:b0:fa:6e18:a558 with SMTP id fm18csp1310619rdb; Wed, 24 Jan 2024 10:56:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IECdvf/Q/2xOCGcxwLIpUZFzi9JDOuVwoYDTo15Jmsmdyk7pVU0OszR1C3VMmCJgq3pxhlZ X-Received: by 2002:a05:622a:1a84:b0:42a:5a8e:bb8a with SMTP id s4-20020a05622a1a8400b0042a5a8ebb8amr2172600qtc.100.1706122610204; Wed, 24 Jan 2024 10:56:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706122610; cv=pass; d=google.com; s=arc-20160816; b=objLP90x0yPtZ7clFBXgCnx4/feSk2yCwuVq+Ls9NTkEhtEN6drjbT8WyRdLUDRlXR 1eamujyJ7trCytM7VpFngIAVDEcUvZtBtifCHH2+bMXiTo9acll3o25ltUL6xlAOIV9C AQmDpjHFlvS0c7l+MAPbWRQUFGg4toneQ6+pABCfaBvr6B2VovqfuTe19Jh5I9yFzCo+ RNQQlSFcQBFFuSc79vdDwkwrwJlNuQIIPoTd8PsPQUIf2wfJ85927oJsc5iaHKuFoM1K Z6E2H5I3K6hUPI9W5gn6eN5/ex43dNqi5wV4x0dhtaexHUgd2qSmZVGLOcyRLX/f9I/b JBHA== 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=L1DgfPPe90UKjQus6zbva0WEpL8KAYZWR1c9F/7pba8=; fh=LIZrMaSG5TmDcSDek8aang/Vv0b1m9ZI6eZiTPpjgRg=; b=0eaFoX0tyfuI4BxA3Hb5Rnf1COLVlhKOtw5GNb5zmuHzu1cpLReF4zJrTB8G9s+MCr uqWFFACfHN6COVHaKAGMIy8Ta5sLLmCPlOFlG82OQ3iv4EmJ+6v0WD7dUEGBdjKVnvb5 OQeequ7T+Uj7XHHRli4KQLFS6qDUA63LenK/uRKpAddsDnKpSbZ6Trv5Llw76M17HerC EmivL6PTiRniqkNpvMVmxumgz/NA/33e3Tu2VbFaCPfkt2hZrOEtU4wg8DwrVBdJUTNX OA8IQPFA3UmNgoTeBbC4Lh9IfuzWPQ8XC5YDzJPzeHZsq/x++KTRkAIrx3vbPHZRgmS8 LAjw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=GIqZE93q; 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-37557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37557-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id h17-20020ac87d51000000b0042a4d8a580asi4524818qtb.416.2024.01.24.10.56.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Jan 2024 10:56:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-37557-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=GIqZE93q; 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-37557-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-37557-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 E43FB1C23C4B for ; Wed, 24 Jan 2024 18:56:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1BCEB131E2F; Wed, 24 Jan 2024 18:56:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="GIqZE93q" 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 03CC2131749; Wed, 24 Jan 2024 18:56:41 +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=1706122604; cv=none; b=kXiGXrjUljyKjJA4qiACp2CYoKCwh4xdnSbl8ZmV8F+V4/c7sJdbISoyd5YPLZBCHPCwHrx64Ewpzx+2s/IkR7Zt5uUuSyW52WjGez5KD0Pclqpkv8XlIs3LJEiURTN2Br7l7h/FgHWj7LksYS/gYkXwz0+zoFklmbaK2kNmFGY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706122604; c=relaxed/simple; bh=fDgg8tctrn6emEkzshBFTOOEhEUdkdDODjW+wwsHgnw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=WTLkl8GjTOvV7lVWT2sg0Nnv/MpH/xbTocWsOk0qW/z6IuJkEoKBkcuBsI6vAUfxHKMhepX+gw8UUuasbuMHji28QfWHRCXStN3B9CWUxrBSPOOTi+Vk2mjweBtsVBb4PUS6vsLv/Lu1Lscxl74gk+L6s4STAlSQOur7vbRo1N8= 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=GIqZE93q; 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=1706122599; bh=fDgg8tctrn6emEkzshBFTOOEhEUdkdDODjW+wwsHgnw=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=GIqZE93qwRmJH38eufPCxDmBlobXjUjtf9LO71Cd6BqdAn3+KILbVJqzUUuIQ+t8r 50enT+rOVnRPsPWiDuVJ3PfVyRZBTgwuYT5B6E+0DTnKDrb2Grg19TjQGhApoaFTiu xOJFpG7FAwVXjMVJ9gYR2wFYFGm8oJ3tfx2cpp2UQWjW2hvynNgoFAPtnt/5Gsxt8J 1Xj7OqtUEM1zq3tQqe79mpmZu23v0vPbxppiZ4t86pVWE7sNana2YjbFjymgJ3CcF4 v5sDKO1R1TQ2gDlxEYeIspgjjzH1pYwT7MYrLH0fo/ocSoXqQvQYi2LvnDpJcFFgnI 53aOA3D0lNr4w== 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 4TKtTz2L4CzV7C; Wed, 24 Jan 2024 13:56:39 -0500 (EST) Message-ID: Date: Wed, 24 Jan 2024 13:56:39 -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 v3 4/4] membarrier: riscv: Provide core serializing command Content-Language: en-US To: Andrea Parri Cc: paul.walmsley@sifive.com, palmer@dabbelt.com, aou@eecs.berkeley.edu, paulmck@kernel.org, corbet@lwn.net, mmaas@google.com, hboehm@google.com, striker@us.ibm.com, charlie@rivosinc.com, rehn@rivosinc.com, linux-riscv@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240110145533.60234-1-parri.andrea@gmail.com> <20240110145533.60234-5-parri.andrea@gmail.com> From: Mathieu Desnoyers In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-01-24 13:44, Andrea Parri wrote: >>> +# riscv uses xRET as return from interrupt and to return to user-space. >>> +# >>> +# Given that xRET is not core serializing, we rely on FENCE.I for providing >>> +# core serialization: >>> +# >>> +# - 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) to go back to >>> +# user-space. >> >> I don't quite get the meaning of the sentence above. There seems to be a >> missing marker before "to go back". > > Let's see. Without the round brackets, the last part becomes: > > - via switch_mm() and sync_core_before_usermode() to go back to > user-space. > > This is indeed what I meant to say. What am I missing? Would it still fit your intent if we say "before returning to user-space" rather than "to go back to user-space" ? Because the switch_mm(), for instance, does not happen exactly on return to user-space, but rather when the scheduler switches tasks. Therefore, I think that stating that core serialization needs to happen before returning to user-space is clearer than stating that it happens "when" we go back to user-space. Also, on another topic, did you find a way forward with respect of the different choice of words between the membarrier man page and documentation vs the RISC-V official semantic with respect to "core serializing" vs FENCE.I ? Thanks, Mathieu > > Andrea -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com