Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp1152180rdb; Wed, 6 Dec 2023 09:56:44 -0800 (PST) X-Google-Smtp-Source: AGHT+IFI7STw54b3I5FXEJ1vaITQu+fgy2Rzj1mKFuvGrhEDKSs0qYLgLaFDOuPRN2SNJ/lftaBw X-Received: by 2002:a05:6a20:6a1c:b0:18f:97c:925f with SMTP id p28-20020a056a206a1c00b0018f097c925fmr1253963pzk.68.1701885404331; Wed, 06 Dec 2023 09:56:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701885404; cv=none; d=google.com; s=arc-20160816; b=eGHR8DWzKJ8P7JaQaEzdmQlRkaEseGTgVT5kSsinSsTAIw2K6yb5Xqp5IyKS3QOSGR 2A3Q8OYUw5spaED7l+ARQLLA/hFYrGsPV/U+OtBEhBHA88NslGX07FL31d4oFbDyzDb0 vxxPR0iYdR5c2leKxDebC/Y6I6IddhRCKp6LIqtPg+PPa5iuG78dK9rJaa/upFItXAj8 m3J+9WH8NjwbguuBPrqqCjFu0GfSX2Al6vRqMRy+I0GZRFg3acAtnbaAh3aCgtpsMFMo B+Hi6rmWNXN/npHlgNNCjYBSRMAF9MM6YCGc9Vsu4XJAK2pRRfoLFs90VN0Hm8gi9Tim OWYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:to:from:cc:in-reply-to:subject:date:dkim-signature; bh=YzmOds210uOLMoqUxUrCLSQtsPcHifLKozmBM1oKPoo=; fh=wfLuxy7+aeBxWTWNe0TWuu/y+laUOmu+yyLHrUPd+Tg=; b=YAiP/ZEkNdrWuU80ygehELlkv/2mBzucjCJ927gv73VIy5YQYuynxg4/UWdS/WRQqc EsfMzGEOwPERPZ3dd9tBP0Zl3KLw/izgywPcbraH+VWIdOrvgv+0ItFZ7YuGopjkl5mI ouVdtXxEpV1gjlS8rYcb2TSD/jYtbqFZXQsA5FdfSfy59S0w/+mRlLPO8C+8pAIWr5ep bexWeXxZr4PdAM6fQzA7FIKG9bDQ35iYGVDwC2Ds+bq7JDk3+OrRPKKd1wh8HZgKwt2A UuzbcTW9QFHXe8cfcBvp4vM9uof73N9Us6pp+EEZmVFnexFG+x1yLH/ygFhZfJNK8CB4 9HCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@dabbelt-com.20230601.gappssmtp.com header.s=20230601 header.b=rgsk+fXm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id w69-20020a638248000000b005bdbd683601si251942pgd.57.2023.12.06.09.56.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 09:56:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@dabbelt-com.20230601.gappssmtp.com header.s=20230601 header.b=rgsk+fXm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 471D0806CC0A; Wed, 6 Dec 2023 09:56:22 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231416AbjLFR4M (ORCPT + 99 others); Wed, 6 Dec 2023 12:56:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230238AbjLFR4L (ORCPT ); Wed, 6 Dec 2023 12:56:11 -0500 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48F6ED42 for ; Wed, 6 Dec 2023 09:56:17 -0800 (PST) Received: by mail-ot1-x32d.google.com with SMTP id 46e09a7af769-6d7e56f6845so31442a34.0 for ; Wed, 06 Dec 2023 09:56:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dabbelt-com.20230601.gappssmtp.com; s=20230601; t=1701885376; x=1702490176; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:from:to:cc:subject:date:message-id :reply-to; bh=YzmOds210uOLMoqUxUrCLSQtsPcHifLKozmBM1oKPoo=; b=rgsk+fXmwfOtpzhA+iN3t9CjJdk7u5+m/oIz9Uap6AdURbAn06Ukz0RVvIrTKpQ20u 3d8HTuNtHWPCYtR3xPxZsu3kAzCJ5wg7/djU9jA5PmPbxhOlGYTpB+20GVIdOE4qxgbS +ggG/JNrXlwvLKxHRW0NTq34QZZuTFWyqIk2oZt6g5ChHcVtFSN+E7hXQLS9tY1dcxkp M7YE84bO8yGZcGErOCduAStWPGztCMp3GPzJKEiKlsHM4M9P5KOtYDmTqChCzNrwuLYC iliQCI11ICQVq1tdWcwvY8ZbAvT9S3hZpmd4DmNzzWabMh70yH5U+dptnQ+u6f9VWatR LxMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701885376; x=1702490176; h=content-transfer-encoding:mime-version:message-id:to:from:cc :in-reply-to:subject:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=YzmOds210uOLMoqUxUrCLSQtsPcHifLKozmBM1oKPoo=; b=G6hzWV9tF7CR4G7DDQSVvTY3Yh0lqs2RBPMC6WnfsBVGrK+I/y8hagLtYxBngGab1i P4l61poaqq8eCzi2/r/X6bOAEtbX7/P485zK4z6uKVNJIzdLhW3oZjjjmOdG1dk2k1da xg8509b2nDymPEn9i8Yffq6D2nOFlMYDWe4CX5W5BK1FNCUbL9WVU5DDjl6+60X4BmNW /IRqfA+MJBKY5JeVA/AkZYpdIL4v9z5wUpStbldaapf+Bw24T9BGKL8YlKNvh/CynRGb lNDPa7GqHvYephG4n2G5ZzB2X+2AmXOG7SonefRKbL8pTwtf2uZFlMXwhKF3XDP7w0fA EWuw== X-Gm-Message-State: AOJu0YyD+K2slUx6W0TY4GL29Le0+gDdOCeevVqXqXbzNRp7j3AM+PIV maxtst2gQ7t0bjxUUGlqQES6NA== X-Received: by 2002:a05:6830:1e69:b0:6d8:74e2:a3d3 with SMTP id m9-20020a0568301e6900b006d874e2a3d3mr1377709otr.47.1701885376195; Wed, 06 Dec 2023 09:56:16 -0800 (PST) Received: from localhost ([192.184.165.199]) by smtp.gmail.com with ESMTPSA id l11-20020a0568301d6b00b006d81e704023sm52207oti.2.2023.12.06.09.56.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Dec 2023 09:56:15 -0800 (PST) Date: Wed, 06 Dec 2023 09:56:15 -0800 (PST) X-Google-Original-Date: Wed, 06 Dec 2023 09:56:13 PST (-0800) Subject: Re: [PATCH 2/2] membarrier: riscv: Provide core serializing command In-Reply-To: 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 From: Palmer Dabbelt To: parri.andrea@gmail.com Message-ID: Mime-Version: 1.0 (MHng) Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Wed, 06 Dec 2023 09:56:22 -0800 (PST) On Wed, 06 Dec 2023 09:42:44 PST (-0800), parri.andrea@gmail.com wrote: >> > 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). IIRC we patterned our MMIOWB/after-spinlock barriers after PPC, so that's probably a good place to start here as well. > 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