Received: by 2002:a05:6358:a55:b0:ec:fcf4:3ecf with SMTP id 21csp1476263rwb; Thu, 19 Jan 2023 11:07:04 -0800 (PST) X-Google-Smtp-Source: AMrXdXuvrJP08AENk1u/GukS7MPDyKsbYcLfr6piAJR1s3QaUV5eksjguNcD4VEFKnJL7AjKXcDx X-Received: by 2002:a17:907:6745:b0:86c:f7ac:71f7 with SMTP id qm5-20020a170907674500b0086cf7ac71f7mr13323796ejc.8.1674155224330; Thu, 19 Jan 2023 11:07:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674155224; cv=none; d=google.com; s=arc-20160816; b=iAhdilUOKhZZ3nri/erUHHW6KOB8bqhUkHBkhBFWtuXyHC9I2XBCa8za2OE1qOyfbC t3fR4JUpH0J2iGZKMc/SHU+P0YNSOXqXMS5bdtxNPQMfEGAa/X5KiOOThg67Cm2U+xnr lT3mAqqE7+KPHkPKq5sxdIqsMae6ID1mRyd2HhQTnMRajBd8ow4zYRpP12emupeajVu7 nUvp8vId4Bx+Ww/PQN6x0CZ+OzbAOzJMbgllO/tgvqvGB2e1Xm8Q85D3gnP1K1Pbce0H eMToZMEMQXrGhNyYoAB532SBDvDuSKAFVJYOJ13vKsDzOYQT2NsDXhJSDePPm6YUcwqB ekag== 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:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=FrgBLCO/EHogDCZyEIjf8YRwbFdhTk3SUDAq2KI9nDk=; b=DucTm+gyWVRvhTiw8HVdA/xyvqrOHguEe0JrtVOkP+l7UW2Y40MKl9f+UIwmkW4hhd Y2miI7CPJclKd7MqwgD8FV6XYCZue2wotmzYhYhVj1oz7Wc61nh+G65pQQbSpjkZiwyI jpSGxFwdf1QR8ha/5lMHSi7X8Ot0hcWkcLEzKcHEB1Sid3ZkWzaoTkRiNiGuPoI0D8sB K8P0l2FjKIYk38HiE3EW0LtGFFA48dKlrbtGKsemgB8vvmZEfuqwZg5ElXm4qGWyHr90 Mqw5H7G4jO/sOQ5arRK1HcdNwvOdOVbOCy3oIhX01iLXjzCRDFOQPyRiKoo4qrVpyyJ8 6qnQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=XxSltk75; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg6-20020a1709072cc600b00869f2ca6a96si23112397ejc.917.2023.01.19.11.06.49; Thu, 19 Jan 2023 11:07:04 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=XxSltk75; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230306AbjASSnn (ORCPT + 47 others); Thu, 19 Jan 2023 13:43:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60044 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229630AbjASSnl (ORCPT ); Thu, 19 Jan 2023 13:43:41 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DAA365244 for ; Thu, 19 Jan 2023 10:43:39 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7515261D12 for ; Thu, 19 Jan 2023 18:43:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D26B7C433D2; Thu, 19 Jan 2023 18:43:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674153818; bh=r9BPSDUS8mqlBvmsXRq+sQLqmfkEfzZt7oZC+21HoEg=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=XxSltk754tzpSmRlyAm/oOqUhiYnkvsxw5YKmKwrmj+eKQifuVk2ZSlR4VqICVP4U IHbx5jqa/kObv/HXPPVIlmGcEiPiP0sNO0xFKOFANlS/bbWyZWnTf/57C0rizFRHzJ Rh0IL3eiGbCKEDiBiVGZYu3bh37jZOqamhKFDTpKZPT9XelMkeHoUICxqwK33QEQtW g6PM5lqzfTvJGdKN6G6DCS4+URTwi+2t9Fk5sfYuEJbdAnj48vzQQPpoKQPsaaaHix 60zXLl8t9rMW/xsHz7uLgPtGeuT8mJH1I9c4CE1+GOpVj+kcAo63jMMQZWmjfszf+f 5n4ujQruUfb+Q== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id 801985C1A49; Thu, 19 Jan 2023 10:43:38 -0800 (PST) Date: Thu, 19 Jan 2023 10:43:38 -0800 From: "Paul E. McKenney" To: Alan Stern Cc: Jonas Oberhauser , Peter Zijlstra , "parri.andrea" , will , "boqun.feng" , npiggin , dhowells , "j.alglave" , "luc.maranget" , akiyks , dlustig , joel , urezki , quic_neeraju , frederic , Kernel development list Subject: Re: Internal vs. external barriers (was: Re: Interesting LKMM litmus test) Message-ID: <20230119184338.GU2948950@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org References: <20220921173109.GA1214281@paulmck-ThinkPad-P17-Gen-1> <114ECED5-FED1-4361-94F7-8D9BC02449B7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 On Thu, Jan 19, 2023 at 11:41:01AM -0500, Alan Stern wrote: > On Thu, Jan 19, 2023 at 12:22:50PM +0100, Jonas Oberhauser wrote: > > > > > > On 1/19/2023 3:28 AM, Alan Stern wrote: > > > > This is a permanent error; I've given up. Sorry it didn't > > > work out. > > > > [It seems the e-mail still reached me through the mailing list] > > [For everyone else, Jonas is referring to the fact that the last two > emails I sent to his huaweicloud.com address could not be delivered, so > I copied them off-list to his huawei.com address.] > > > > > I consider that a hack though and don't like it. > > > It _is_ a bit of a hack, but not a huge one. srcu_read_lock() really > > > is a lot like a load, in that it returns a value obtained by reading > > > something from memory (along with some other operations, though, so it > > > isn't a simple straightforward read -- perhaps more like an > > > atomic_inc_return_relaxed). > > The issue I have with this is that it might create accidental ordering. How > > does it behave when you throw fences in the mix? > > I think this isn't going to be a problem. Certainly any real > implementation of scru_read_lock() is going to involve some actual load > operations, so any unintentional ordering caused by fences will also > apply to real executions. Likewise for srcu_read_unlock and store > operations. > > > It really does not work like an increment at all, I think srcu_read_lock() > > only reads the currently active index, but the index is changed by > > srcu_sync. But even that is an implementation detail of sorts. I think the > > best way to think of it would be for srcu_read_lock to just return an > > arbitrary value. > > I think I'll stick to it always returning the initial value. Paul said > that would be okay. Just confirming. > > The user can not rely on any kind of "accidental" rfe edges between these > > events for ordering. > > > > Perhaps if you flag any use of these values in address or control > > dependencies, as well as any event which depends on more than one of these > > values, you could prove that it's impossible to contrain the behavior > > through these rfe(and/or co) edges because you can anyways never inspect the > > value returned by the operation (except to pass it into srcu_unlock). > > > > Or you might be able to explicitly eliminate the events everywhere, just > > like you have done for carry-dep in your patch. > > On second thought, I'll make it impossible to read from the > srcu_read_unlock events by removing them from the rf (and rfi/rfe) > relation. Then it won't be necessary to change carry-dep or anything > else. Although that works very well for srcu_read_lock() and srcu_read_unlock(), it would be an issue for srcu_down_read() and srcu_up_read(). But one thing at a time! ;-) Thanx, Paul