Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4818076img; Tue, 26 Mar 2019 18:06:12 -0700 (PDT) X-Google-Smtp-Source: APXvYqx9kBEBgLKJgrkosQBhaWnnwqEuQDEXae2FM7sKZ3XZ6gfdwOdck4QbKl3Z7dfWGxnVkT0+ X-Received: by 2002:a17:902:47c2:: with SMTP id d2mr5810076plh.277.1553648772629; Tue, 26 Mar 2019 18:06:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553648772; cv=none; d=google.com; s=arc-20160816; b=cROhbKEzWD3mGUPRZ9W+yCmGS7fTB4ADB3eLWDZJ4V1xOHQEbranJOer+8HDu46miy D8VCwly/+MRgMEu7Ift9bdqTCZaJeDdp8rHyTDuGPxBfCGMU4k9XDFWpkro3fx4xkXAk COGLgJauwh+Y5NSksCzSqLqm/eyHthMwdLVfDyhCxJTiWAjlD/szu0vY268+vFm6Ezee faEMvOWUn4D6m+EOAHq3qFlJtLv446vIM6q6TWRVMiHjv6F9wrJqby/qHT25SIauxQUl 4ZxHxjJVsuARDpNve/f7GTTAS3vUyyiOR1hXJUk6aIvjsPMn7nUn3RZ2lFjC+R9JqAhw PBVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:references :in-reply-to:subject:cc:date:to:from; bh=kTkubQqb9pFtkzmTWH55fkvfV7qMlTYmZc9FeajnFcg=; b=srBs5ICca9e5jirNPVMk/coxKEMZrDGY52fqDGry2mZJNH2CkdjaTr6wfdZ26ZNqr3 gWumZ4SmtRq0xrNPKl762IemyJnEW2qDfT3gSwfYNRlBVXku1ZFDSo4W409l14mdicFQ I+oVSE81qFU3oIrkMlA8ga2A3o/8HqG66EP3vUBDyfYRDdTeGxNYmf4yQE3raYoZ30+T Zq7YPztVDzINM6N3l9K7YXjU6cEUkpN+UgA1JaeN+EREJdbUoiPm5FlMgTRWbtU6+Yqb c72WrXKgEH2EARbN3XZ3ciaayilZT00jrfra5N4OGglJEf/XE1gPhFQDCgyakNs7PoI3 yrVg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bj7si14470018plb.408.2019.03.26.18.05.56; Tue, 26 Mar 2019 18:06:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732099AbfC0BFT (ORCPT + 99 others); Tue, 26 Mar 2019 21:05:19 -0400 Received: from mx2.suse.de ([195.135.220.15]:57594 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1731579AbfC0BFT (ORCPT ); Tue, 26 Mar 2019 21:05:19 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id A1FA3ABA1; Wed, 27 Mar 2019 01:05:17 +0000 (UTC) From: NeilBrown To: Herbert Xu Date: Wed, 27 Mar 2019 09:35:18 +1100 Cc: Thomas Graf , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, "Paul E. McKenney" Subject: Re: [PATCH 3/4] rhashtable: use bit_spin_locks to protect hash bucket. In-Reply-To: <20190326050320.gwk3tgtqwl5csivt@gondor.apana.org.au> References: <155349021177.1111.15681654355431465791.stgit@noble.brown> <155349033961.1111.18247269615646768227.stgit@noble.brown> <20190326050320.gwk3tgtqwl5csivt@gondor.apana.org.au> Message-ID: <874l7p463d.fsf@notabene.neil.brown.name> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain On Tue, Mar 26 2019, Herbert Xu wrote: > On Mon, Mar 25, 2019 at 04:05:39PM +1100, NeilBrown wrote: >> >> + * Sometimes we unlock a bucket by writing a new pointer there. In that >> + * case we don't need to unlock, but we do need to reset state such as >> + * local_bh. For that we have rht_unlocked(). This doesn't include >> + * the memory barrier that bit_spin_unlock() provides, but rcu_assign_pointer() >> + * will have provided that. > > Hmm, are you sure that's enough? IIRC rcu_assign_pointer only > provides a write barrier compared to the more complete (but one-way) > barrier that a spin-lock provides. > The bit_spin_unlock(), which I am avoiding as unnecessary, would have provided release semantics. i.e. any write by this CPU that happened before the releasing write will be visible to other CPUs before (or when) they see the result of the releasing write. This is (as I understand it) exactly that rcu_assign_pointer() promises - even before acquire semantics were added as Paul just reported. So yes, I am sure (surer now that I've walked through it carefully). Thanks, NeilBrown --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEG8Yp69OQ2HB7X0l6Oeye3VZigbkFAlyaqSYACgkQOeye3VZi gblG1BAAugBQSAHkt7j0YxxaNGdLzZFDd1c7CFpL3USh8KEqNJlSZidq0g+746mk YlEW67d9PUu0ey4A1dalzjD3vD/ti4MCy1GqWS5LF+JV1GoYOpFesq6aHi28yBsf JeFHBBk8EBiKZ3LspXL9sjd/KodwbujTEtQKw0Ax1FJWizCMiF8g80G+Ly3RjUn3 8QF3WHCgdjNfPcHXmMkLnRVXEnKRUSgutvPTj9rPSdhUme3ZLcQFee3ff+HbKD9r BSun9EA8nEW+9wfFscXu+F0we5l+cmATr8sK9y4OEyiu+HCdj3JgG3lOiAaDeW3+ ZOuoX8C3AUsDpBMQB3Xx0nppDnl7cI3WW7JmLnIAAIyk8fKrJBYaXNQX0xlxGipu c2HDn738xwBMGd1ECfQECXDEANUjGdmSXR/sZISx3rPjIgyyYRllgvV3LvcdhZk4 f9cB8LEkmW3Vo1+M4J1CT8Iwb6LFVJrqxbc8HlzIEyBMUEqIJiKwR+plTUeeXPUd NfF83LluCow4a12uFWyn86jqydlxeHKe1qqPFPZGexHDWvnHJNsmGxGWU75I0Knq w6xikBUm9tcQauQVRXmF85Fv6AnbLapyAiYSEuG+oKvr5xvwd+1/hQaGRcZ5Oj1k j3FgQ+tECDpaMcFh6FAHO1XLq4TD3EbOmX1eT201gIJdjzeQeS4= =u/o4 -----END PGP SIGNATURE----- --=-=-=--