Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1145014rdb; Wed, 6 Dec 2023 09:43:18 -0800 (PST) X-Google-Smtp-Source: AGHT+IHvsI3E8Xm6BZTDUnvM/iC/aeFmAIzXqgRSZ3WCnCXjOCWckpkygHn9HmFUoABTM/HKb5gU X-Received: by 2002:a17:902:ceca:b0:1d1:cc09:50af with SMTP id d10-20020a170902ceca00b001d1cc0950afmr922165plg.71.1701884597913; Wed, 06 Dec 2023 09:43:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701884597; cv=none; d=google.com; s=arc-20160816; b=0p1VbA7L096BmqfTO29o970D40iO4pe2vT9z9CJL+4AW4dw2wzbn446m0OwnFYjdf+ R+QyLK4bgWt7tBCVKz20UME6LJa5acerau6kLXJJSqya9afi9KMbm3DAinrvj/yD/FBW qlF/FYF+7yvIm153wTPDGXH+jk5rGMEgCPnGgs5gHoP6RXHJyHlxWt2ZfDVUdbano7FW qhUJyPhTR4hfyYazWUE5TRFTq/ds9bxLDHJJIWiFOqQ9ABZRqSXzGkqY4YzoxKILEx+M mLxdZWYo01I5XOBMY4H342F0NgfEocjUMZ0T6qT+lnAkS1HTin8WUT92Rp/ipNem1A9A 0yTg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=5cQSdmy5VXvMhl1lDfSWOEIqrjKBlLF9FrQbjdBXHKU=; fh=iVYs6/LEFCvLPFXfHZMT83RAc4yb1NrO2i4BGABv0QI=; b=SQc4hPJ5IYhufaGmgmRuwsQk5Wm8TW1JBq/EzRul9jxZwvSZ0xUGxvdlUXUU1c8v2o 6SObOL69UjjZIKZDt2KzoEuDgDywGTM4i6wLP8jFdgVtcmFlqLsQw7GmW0mLAYGV89QW RKuvS9/nXlLi33NssUIkFPUHij0ZmUTVeFD/H+LB1q8UoFfYTbMNnl6u7ZLYiI3+E4Us 0zMsA+bKIkSqIiWwbCBf35h+LzYW101f6mZ8IPMOlhMahoarNlYMrgxQRj/fY2icUnFo 4eWAPUyeSVIq6daaMAq4PbrpZYhk36SR+5xNU9lTxGKfzjLvbVUJ7iuLVxAE98KWb6IB x+Pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eg1Ofqpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id u15-20020a170903124f00b001d06e8a15desi126396plh.322.2023.12.06.09.43.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 09:43:17 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=eg1Ofqpz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 9F5448297C41; Wed, 6 Dec 2023 09:43:14 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230164AbjLFRms (ORCPT + 99 others); Wed, 6 Dec 2023 12:42:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbjLFRmq (ORCPT ); Wed, 6 Dec 2023 12:42:46 -0500 Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1DDA5D4D for ; Wed, 6 Dec 2023 09:42:53 -0800 (PST) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-a1caddd6d28so159144866b.1 for ; Wed, 06 Dec 2023 09:42:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701884571; x=1702489371; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=5cQSdmy5VXvMhl1lDfSWOEIqrjKBlLF9FrQbjdBXHKU=; b=eg1Ofqpzx0mijHYdklLtSTbybubwXFBzq8Bv6wPaiV9rG6eJVuF4Ods+YnItuvJ/VE mT8HIJgHBKBKLmrnUNQpSfwwr7mMwDj7zl1HpMcwbbHYJx02G466rqLzc8/FlkdPm95/ eIpsUDKUw8TOOZxn5IBA/LhUJyKY0MQ2LzH7cb2EANXOINbBpnuZsaO+orLhDkKsV7ES lsbZDTD4jeQuj71/i0el2P0bfxO96adHgboDphlHzdtGRqmdMxOKhtB3qnXhQUD4Qy68 zkF0VzwzLG9dnKFFLDqdvX0YPz+05mkZk/Mt5ytyXO87wsLt99ORPWqjX8WlC9S+7gkf tpJQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701884571; x=1702489371; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=5cQSdmy5VXvMhl1lDfSWOEIqrjKBlLF9FrQbjdBXHKU=; b=r/rys754Gs7vHwYBsWwwoHNMJhvypUb3tbzQ57/2At5azYg1YSfobXZoIRF5YhmGjg emScE/2WnOYyyuVpgesjz7hAWkLQWT6W7oy3Uz9L3SWAkBLcEJ26/oQYpZx+AL0mlCZi RJT7u2XL//w+T0+KogdG3+rzR9A98gzhCaOcbhrWw74YiME6loAZ3ARv2PB1etLGiB2j a4b2ymsKVYmeWcV9bZI8mlulynOGp078R3poUXnvjetm0ub1XOffBJEsoxttFM91DBRl btkmaVxZZavm4U787IauN1GWY6LAy+/gHxmOe6r1lEskIn4jDnz2O4y+f9skUT3CLxgu GTNg== X-Gm-Message-State: AOJu0Yy2sIEApOwkKjjy9PW3tZNtm+DOO7csuZg9CLQoBir3llZ8tqEd hur3IAcvk9oMFGL3wcEpAwU= X-Received: by 2002:a17:907:bb98:b0:a19:a19b:4265 with SMTP id xo24-20020a170907bb9800b00a19a19b4265mr646334ejc.208.1701884570832; Wed, 06 Dec 2023 09:42:50 -0800 (PST) Received: from andrea ([31.189.124.152]) by smtp.gmail.com with ESMTPSA id g11-20020a1709061c8b00b00a1cd9151af6sm207563ejh.210.2023.12.06.09.42.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 09:42:49 -0800 (PST) Date: Wed, 6 Dec 2023 18:42:44 +0100 From: Andrea Parri To: Palmer Dabbelt Cc: mathieu.desnoyers@efficios.com, paulmck@kernel.org, Paul Walmsley , aou@eecs.berkeley.edu, mmaas@google.com, hboehm@google.com, striker@us.ibm.com, charlie@rivosinc.com, rehn@rivosinc.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] membarrier: riscv: Provide core serializing command Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 06 Dec 2023 09:43:14 -0800 (PST) > > The final version of this fix will likely depend on some machinery/code > > introduced by 3ccfebedd8cf54 ("powerpc, membarrier: Skip memory barrier > > in switch_mm()"); but, yes, nothing we can't safely adjust I think. > > Ya, I guess we'll have to look to know for sure but hopefully it's > manageable. Absolutely. One approach would be to follow what PowerPC did: AFAIU, before 3ccfebedd8cf54 membarrier/powerpc used to hard code the required barrier in in finish_task_switch(), "masking" it as an smp_mb__after_unlock_lock(); riscv could use a similar approach (though with a different/new mask function). Alternatively, we could maybe keep the barrier in switch_mm(). But let me complete and send out v2 with the fix at stake... this should give us a more concrete basis to discuss about these matters. Andrea