Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6149023iog; Thu, 23 Jun 2022 12:21:18 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sKYYWzz7YmG9Way1YLXYSPX2HC2RMIJ75/j8M3LtRK5jeJ5IZ58gWfSdayUW6cjBmHhD0n X-Received: by 2002:a17:907:6294:b0:6e1:ea4:74a3 with SMTP id nd20-20020a170907629400b006e10ea474a3mr9663322ejc.168.1656012078649; Thu, 23 Jun 2022 12:21:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1656012078; cv=pass; d=google.com; s=arc-20160816; b=s60dXMC62I/KjFka1OvqLzHXcJXe6BhbNFTlrzRtQzdK+Mgw5RHcy+0dlv7Q38wmov 0SWY2nHl/3CwzD+POEmwT49/jAYyPcLOthuWChkn2Nbz3mmzHFhhmNfL1N1Ckjd6VIRA 9g3WeapxlisFQO0dyJLnXf3P6wA19a0N4JmayfToBQch1cK6JkjbMV7ustSGMbR8Ljj6 ilP5NSVhyAKi0Nc+Ltn7VqpEP+1J1X5AZdby2gbWQgF2tG1vpYmb57YjjfnBby5bAPTV bEF4ubAhVerEbQgwfG5p3hoXr3sDi/XZn1Oa2yHqKFosD/6rK9w+3rDOvlyC8dMfdZbg rNwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=qYbgrSFrhvGWW+RzOTE4cXKoGn9hIRNFXQJEszRuaUc=; b=Yc0IoAM8Zf8Vz8F9rBgQLQnt/a3OaFXszNdjGJ4B8R1JiJAF8xhSroDkpAyfxJgAiE IzGIqHTCTfUJ2fZMO0omDG6a+5CdqSI9y+4VmfLK6HGaAWfDPxpjuuKbw2/bx0mwlF1M wXVQUoTTqQurIbr76uqEHn1jRMvPpAhk7q2BYr47bs3faimtkr+wnO37Q5WXkuusdpG0 t3N+Z7xwlHnjDykqIrX/8Ku4V4VHcMIcqE11s2WFVGtPHs4eAdbCTbX0riHW4D+xvbOY 1le2OzCjO2CYL7qWtctR9iTguBSgiz4YeIQ8ZeZ5d5gajNMHBaiVgjVppNkj0ezfjkhO 8weg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="Gf/2xvHt"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k18-20020aa7c392000000b00435b9a16d08si404357edq.49.2022.06.23.12.20.51; Thu, 23 Jun 2022 12:21:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b="Gf/2xvHt"; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234547AbiFWRoO (ORCPT + 99 others); Thu, 23 Jun 2022 13:44:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235270AbiFWRjY (ORCPT ); Thu, 23 Jun 2022 13:39:24 -0400 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (mail-bn1nam07on2086.outbound.protection.outlook.com [40.107.212.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF92862C06; Thu, 23 Jun 2022 10:09:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jshkuSfCIVNiVWM/ZOLnGbd9inGB5QOFmXdWleDbESitF4Bm9iDwuX7BLGyI8bmsU/3WaZZTuSfy4iqy3rhObAtsIi5R1VKsWrMaXg0MtJqG25Ro2Y/Ltt5MnLbqR4mojGO3LxJr1DYDidxuotiOPXsrngeBfbNQyxlTathAWJH/WTwq0nxvhCZv4IdmdgJHGh+QK8/5guCiyTHPLKeJJqPRMma2wW+47G3vsF4qiXM43AmpFtFAXg8K3iaZcCkBPAznsgk0GACxgoOCH4CBpOFr9qj6mXP3sUsuhGw7Tf6AGGKEHTknDfIM51CgF9WSlHE77nu1WEYGiB0h72EiQg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=qYbgrSFrhvGWW+RzOTE4cXKoGn9hIRNFXQJEszRuaUc=; b=Xo8i77FahL3t879dgv0PDz8VssJj+ixcmmbwVZzB68bAVonSDdIf/j8Oyh27Yy5NAivz3eRNWnWde3+r8CrULIIFIbPqafvXwFLsOMMyZG1meMe9DD4zPbttL3EjR83vbFBK+jfqC7c9IBUpjYC5bZwgANZeSOsG0T5chT5uY5xB+fnajQoHCZ9xK7roqf+rzcp6tE5Y5Fv58yW3KOH+2t4kqTbLZWSB4pChd/UfTy8aDSwP9NbizRFtffM+6IUvaW74EEtJAVjghg7MU3LeEEX67N5xv+sbEEq+vce6LF1dOx+0ozRzNnxfKCjBhS/A5Vf/mxciglplxiCneU+Uig== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qYbgrSFrhvGWW+RzOTE4cXKoGn9hIRNFXQJEszRuaUc=; b=Gf/2xvHtZ7v47k+N0O5bhrmLg8YhTGU0h5tQYW+DUoO3nZMyLdd4Ig7DVFDnDdXcMOzY9a/+RG/f2ZuMXld4i6h2nu8F58zDm1jMP5KQXjP5JOeSHkOruUxlwUbrM5/IXFyGAcVdF+LSCGlmQgFDqQHlT7g3AfDNHLiHHM8dis+uNtDmNc685gKO+EzOBsESGqh5UOFdJDeYIhtG3YPI1IGITavJ3g5XFb7OY1PKf8WsWq7pTWnw5FbPLsQqlVAv8G1aZJjTqzwEOEH089W/fdyeud9bzLXlrDe6ngirg8OzkgWDT6ttx2CwJVMHAvIHW/m9c+CCtkqFsnfnNK0ebQ== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN2PR12MB3437.namprd12.prod.outlook.com (2603:10b6:208:c3::20) by DM4PR12MB6040.namprd12.prod.outlook.com (2603:10b6:8:af::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5353.15; Thu, 23 Jun 2022 17:09:36 +0000 Received: from MN2PR12MB3437.namprd12.prod.outlook.com ([fe80::9d83:45f6:174f:73c]) by MN2PR12MB3437.namprd12.prod.outlook.com ([fe80::9d83:45f6:174f:73c%7]) with mapi id 15.20.5353.019; Thu, 23 Jun 2022 17:09:36 +0000 Message-ID: Date: Thu, 23 Jun 2022 13:09:23 -0400 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: Re: [PATCH V4 5/5] riscv: atomic: Optimize LRSC-pairs atomic ops with .aqrl annotation Content-Language: en-US To: Boqun Feng , Andrea Parri Cc: Guo Ren , Palmer Dabbelt , Arnd Bergmann , Mark Rutland , Will Deacon , Peter Zijlstra , linux-arch , Linux Kernel Mailing List , linux-riscv , Guo Ren References: <20220614110258.GA32157@anparri> From: Dan Lustig In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MN2PR19CA0068.namprd19.prod.outlook.com (2603:10b6:208:19b::45) To MN2PR12MB3437.namprd12.prod.outlook.com (2603:10b6:208:c3::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 83909f70-8a7e-4845-f15c-08da553b2665 X-MS-TrafficTypeDiagnostic: DM4PR12MB6040:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: =?utf-8?B?UUg2Z3ZML05UWDcrRlRHL0Rna1FWYUFCNzFlQUZYYWRKdy9DOEpORnZ3bmtX?= =?utf-8?B?T2pTc2hvMDBNakJXTHRhWjRCQVFjdWFLWjVxVG1iTEo5c2FMZXNHSitYcC9O?= =?utf-8?B?ZUhyTDNaRWQrSmZGUUs3T21jejdNUDhxeFkycXNiY1ZMelk3MDN6SUgzQXJa?= =?utf-8?B?MWdkeExSUUU1WjZlbytEQTlQdE9EVUhrdTczTnNiWExYUElEajQ5d0FlRWNi?= =?utf-8?B?N0I3UjNXeUZoSHpsaUpYd3duM29VTWdSNHBHZ0s5NEs2RXNXTFd6SCsrdVVG?= =?utf-8?B?aFpzUVpGZEN1NWgyYkc1Q2NVZnVIRHYxL2ZLREpnTFBXMHFkS1pudjNwM1Nu?= =?utf-8?B?QUVQZWdCQUtta1RIMmlJWmFjOGR4K1cyeTZYajhkWU1PRG5WUTZzZXVUQzRB?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Bzck14dz09?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3437.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(39860400002)(376002)(396003)(136003)(366004)(478600001)(5660300002)(186003)(36756003)(83380400001)(26005)(6666004)(38100700002)(6506007)(316002)(6486002)(31686004)(66556008)(4326008)(66476007)(53546011)(8936002)(7416002)(966005)(66946007)(86362001)(2906002)(31696002)(54906003)(6512007)(110136005)(41300700001)(8676002)(2616005)(142923001)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?K0s1YnR5UFdzR3hZSnVRcUxkZjlIVytPYzVKREFYZldCajJlWENWR052Y0p6?= =?utf-8?B?VjRpZ0lyK0xjSHZEZEUxR25lSUFpdloyNHBmU1FPenYwSE14TjVSRG1wUlVD?= =?utf-8?B?R2hHS3lxZ1kzV1pXdXNkNHBrazIrb1FXWlRSNUV6S1FnSnN4VjZCS0MybVpX?= =?utf-8?B?eFExczNObUJVYTZ0YlZWZGozR1BJdVQxUmdzY01hNG1VOFE3ZWNoMk5HaTl4?= =?utf-8?B?ZDAya1JuRnlyR2lHeitPVGRxTkpiRCtINmVPRnM5V0FPNTRBWURoYXc3STAz?= =?utf-8?B?U3EyTUk5UlpVYWdnR0M3TWxpT1piRXhvY1lqWUZLN3V6aUdyc05Za3ZxZlV0?= =?utf-8?B?R3IxNWRraVZCd0NXY0twcFo2RFZPWVUwVTlmOUswVkNvdVYwck1SMUpjTnRE?= =?utf-8?B?eDlHTit6RmZBSTFJMjNweXo4YjBVRnFWeGdudDJwRTlDK3JXZkc4UWdDUHd3?= =?utf-8?B?YnBzME5ZUmJmREVheVl5NiszOCt6Z3c4YlQ0SWtiMmp2ZWczZ0xkSFNScDNW?= =?utf-8?B?Y05GY2lFdjdrM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URNZStDOFlNQT09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83909f70-8a7e-4845-f15c-08da553b2665 X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3437.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2022 17:09:36.3867 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZGlE0z4Q+5RoQqEybhtmZLM3ZbTjQsXPqqVaKH/UIKgImfnyGpmYHxRlC7h4O593EBfLiIRIs1aGilKyc7ugUg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB6040 X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On 6/22/2022 11:31 PM, Boqun Feng wrote: > Hi, > > On Tue, Jun 14, 2022 at 01:03:47PM +0200, Andrea Parri wrote: > [...] >>> 5ce6c1f3535f ("riscv/atomic: Strengthen implementations with fences") >>> is about fixup wrong spinlock/unlock implementation and not relate to >>> this patch. >> >> No. The commit in question is evidence of the fact that the changes >> you are presenting here (as an optimization) were buggy/incorrect at >> the time in which that commit was worked out. >> >> >>> Actually, sc.w.aqrl is very strong and the same with: >>> fence rw, rw >>> sc.w >>> fence rw,rw >>> >>> So "which do not give full-ordering with .aqrl" is not writen in >>> RISC-V ISA and we could use sc.w/d.aqrl with LKMM. >>> >>>> >>>>>> describes the issue more specifically, that's when we added these >>>>>> fences. There have certainly been complains that these fences are too >>>>>> heavyweight for the HW to go fast, but IIUC it's the best option we have >>>>> Yeah, it would reduce the performance on D1 and our next-generation >>>>> processor has optimized fence performance a lot. >>>> >>>> Definately a bummer that the fences make the HW go slow, but I don't >>>> really see any other way to go about this. If you think these mappings >>>> are valid for LKMM and RVWMO then we should figure this out, but trying >>>> to drop fences to make HW go faster in ways that violate the memory >>>> model is going to lead to insanity. >>> Actually, this patch is okay with the ISA spec, and Dan also thought >>> it was valid. >>> >>> ref: https://lore.kernel.org/lkml/41e01514-74ca-84f2-f5cc-2645c444fd8e@nvidia.com/raw >> >> "Thoughts" on this regard have _changed_. Please compare that quote >> with, e.g. >> >> https://lore.kernel.org/linux-riscv/ddd5ca34-805b-60c4-bf2a-d6a9d95d89e7@nvidia.com/ >> >> So here's a suggestion: >> >> Reviewers of your patches have asked: How come that code we used to >> consider as buggy is now considered "an optimization" (correct)? >> >> Denying the evidence or going around it is not making their job (and >> this upstreaming) easier, so why don't you address it? Take time to >> review previous works and discussions in this area, understand them, >> and integrate such knowledge in future submissions. >> > > I agree with Andrea. > > And I actually took a look into this, and I think I find some > explanation. There are two versions of RISV memory model here: > > Model 2017: released at Dec 1, 2017 as a draft > > https://groups.google.com/a/groups.riscv.org/g/isa-dev/c/hKywNHBkAXM/m/QzUtxEWLBQAJ > > Model 2018: released at May 2, 2018 > > https://groups.google.com/a/groups.riscv.org/g/isa-dev/c/xW03vmfmPuA/m/bMPk3UCWAgAJ > > Noted that previous conversation about commit 5ce6c1f3535f happened at > March 2018. So the timeline is roughly: > > Model 2017 -> commit 5ce6c1f3535f -> Model 2018 > > And in the email thread of Model 2018, the commit related to model > changes also got mentioned: > > https://github.com/riscv/riscv-isa-manual/commit/b875fe417948635ed68b9644ffdf718cb343a81a > > in that commit, we can see the changes related to sc.aqrl are: > > to have occurred between the LR and a successful SC. The LR/SC > sequence can be given acquire semantics by setting the {\em aq} bit on > -the SC instruction. The LR/SC sequence can be given release semantics > -by setting the {\em rl} bit on the LR instruction. Setting both {\em > - aq} and {\em rl} bits on the LR instruction, and setting the {\em > - aq} bit on the SC instruction makes the LR/SC sequence sequentially > -consistent with respect to other sequentially consistent atomic > -operations. > +the LR instruction. The LR/SC sequence can be given release semantics > +by setting the {\em rl} bit on the SC instruction. Setting the {\em > + aq} bit on the LR instruction, and setting both the {\em aq} and the {\em > + rl} bit on the SC instruction makes the LR/SC sequence sequentially > +consistent, meaning that it cannot be reordered with earlier or > +later memory operations from the same hart. > > note that Model 2018 explicitly says that "ld.aq+sc.aqrl" is ordered > against "earlier or later memory operations from the same hart", and > this statement was not in Model 2017. > > So my understanding of the story is that at some point between March and > May 2018, RISV memory model folks decided to add this rule, which does > look more consistent with other parts of the model and is useful. > > And this is why (and when) "ld.aq+sc.aqrl" can be used as a fully-ordered > barrier ;-) > > Now if my understanding is correct, to move forward, it's better that 1) > this patch gets resend with the above information (better rewording a > bit), and 2) gets an Acked-by from Dan to confirm this is a correct > history ;-) I'm a bit lost as to why digging into RISC-V mailing list history is relevant here...what's relevant is what was ratified in the RVWMO chapter of the RISC-V spec, and whether the code you're proposing is the most optimized code that is correct wrt RVWMO. Is your claim that the code you're proposing to fix was based on a pre-RVWMO RISC-V memory model definition, and you're updating it to be more RVWMO-compliant? Dan > Regards, > Boqun > >> Andrea >> >> > [...]