Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp1031868ybi; Fri, 12 Jul 2019 08:33:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqy12DIqdY8wJE7Kb0Zl9lpIdYyw3jr4TUJJBSE6zPPBBbkCPhh+lMkd1QVw5uOHt2vrtKLj X-Received: by 2002:a17:90a:23a4:: with SMTP id g33mr12805862pje.115.1562945618347; Fri, 12 Jul 2019 08:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562945618; cv=none; d=google.com; s=arc-20160816; b=xz3OeSt/O8b5QS3e17HHnyXaTfT8oZlbiMOX/Q/RjZqLtH0PBe+gghiHp2zJQZ7NAf qEXfmGgXgMUvcT+bKPDab8V5RM6yKtn8Co+rW13q1xeWaEHWK6/9XoK0eZM0hymilFXQ fy8wfRdMnUG+jKjb9UKdVY8Ae1k8BKipDQPJ48PVcx7mMhztp5x8acHb/uWGpwVClqLS QVa70n+wlMFf74f98mJuP7y4hq/Kxvin5tfqjlG7xpWvITHxg3fdI9hu48s53FvwzW7k caax8xK+dkYRSFI7UB8r3wl9VDj5gfbn5/u2NlBFTn4cDGlIDaQSWo8oK0Gw7BEGo2Pk SBOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=6zUuNAxC0W8UA4PyJfN+NTLv2uHwtQW0uxPeJFySWhY=; b=Q0RYUHm3fVeHR9RfTh1NmUzNZ+Y9rpFHVTc2ogUappImo3V2cwpoG3mwuWRvUc0RkP gAyzQYWvImWjfuJa1edWABIx0kIE/vO5FklLIvNnrNbRTU8YoDaiW8QDZpxIa+vHlzM/ JgzjD/iHqavwVovfRlYycw6SYo0E+1f6vpvA0EJMGzKNl5kG6eg1wG78khD6yc9YqYD9 TZeEEuKsQBdRJ0ImFGdgZP24jKMVSUlzFpytQW91EwftqUCbQULtSnOcV2leA70nf4sL hplLodWO2OMdex+eHo5xNFUWxOn9KrGPDVR9kkTvF4kT/IsJeLvvrCtwi2enixD78cMa xxQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=WhHL4nEa; 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 t22si8410575pgh.582.2019.07.12.08.33.22; Fri, 12 Jul 2019 08:33:38 -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; dkim=pass header.i=@ziepe.ca header.s=google header.b=WhHL4nEa; 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 S1727033AbfGLPcp (ORCPT + 99 others); Fri, 12 Jul 2019 11:32:45 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:42204 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbfGLPcp (ORCPT ); Fri, 12 Jul 2019 11:32:45 -0400 Received: by mail-qt1-f196.google.com with SMTP id h18so8469284qtm.9 for ; Fri, 12 Jul 2019 08:32:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=6zUuNAxC0W8UA4PyJfN+NTLv2uHwtQW0uxPeJFySWhY=; b=WhHL4nEaSeEd0vRZOuyDcURKZ0cIDxWXvxDZbS9TJi+X/uea1BzMCjEV3BPQDBS7kF Dpkkz2XDk8Cq31X6ysMikLsVpO4/A6/XX+9SpUG+W1O09Ph1QgZt6F95E72Jvv5xOz7E q7g3yVOFNmZDNJiyrLb7uSW1KGLl0Q1+OFgPCeLMQs4aOOlyJ3DLJmK3xFUpVrkpjcsB QQY6IbgORFPsALQkh8diwYLGK2Iijn5DUi7LcqCzPyJj5Pixni0GPZh99oEQHA9a1HDc QuLsPci3N/i5e6QkqSbRmroGlDOqP8DKDJE1pkprzCZ4CQ2YDpVXaUlmhimtsJwtsYcH a6bA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=6zUuNAxC0W8UA4PyJfN+NTLv2uHwtQW0uxPeJFySWhY=; b=UmXGdEGHfMixbIsJyZ+5BxQfTxvxvNY2V9Fc1QzEotKi+1Zj1QjW6M2DPinzyqjSfD TaaDz9wL8rYcNpNYIv5Ao14rugQgiblkSTYJZeKKj/Euczo2OZ7sv8ZxdrzRHqftIqrj 5wvg6J28TRjrBNEZ7KlQ0ionCTYlRslgZ4hAUwrLTb99vxl2VWLvWuv8u2SIT90vyqYZ 4c8Lzpp3GtHWHecOWwURvYlXxt1WG/b8sxCkiToDHeIoxiUDy570boIZKi3hG3ccta9u nWzg88hVhxZeJ9KFAFLNG+zIyo8pNXZCU8CyUmjpCDNf7c08ET1bSJGHnuxC1bWJUDMT qyWA== X-Gm-Message-State: APjAAAUVN6Nj0yfZOlaR9GiqUlZ/qFJFM2EW2jkat5XiEnGcL0RN23BV PeeH13Apl8V8BtBuYkjiTLRUtw== X-Received: by 2002:ac8:444c:: with SMTP id m12mr6913649qtn.306.1562945564475; Fri, 12 Jul 2019 08:32:44 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id v75sm4201337qka.38.2019.07.12.08.32.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 12 Jul 2019 08:32:44 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hlxXP-0002Tp-KZ; Fri, 12 Jul 2019 12:32:43 -0300 Date: Fri, 12 Jul 2019 12:32:43 -0300 From: Jason Gunthorpe To: Bernard Metzler Cc: Arnd Bergmann , Doug Ledford , Peter Zijlstra , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: Re: Re: Re: [PATCH] rdma/siw: avoid smp_store_mb() on a u64 Message-ID: <20190712153243.GI27512@ziepe.ca> References: <20190712144257.GE27512@ziepe.ca> <20190712135339.GC27512@ziepe.ca> <20190712120328.GB27512@ziepe.ca> <20190712085212.3901785-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jul 12, 2019 at 03:24:09PM +0000, Bernard Metzler wrote: > > >To: "Bernard Metzler" > >From: "Jason Gunthorpe" > >Date: 07/12/2019 04:43PM > >Cc: "Arnd Bergmann" , "Doug Ledford" > >, "Peter Zijlstra" , > >linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org > >Subject: [EXTERNAL] Re: Re: Re: [PATCH] rdma/siw: avoid > >smp_store_mb() on a u64 > > > >On Fri, Jul 12, 2019 at 02:35:50PM +0000, Bernard Metzler wrote: > > > >> >This looks wrong to me.. a userspace notification re-arm cannot be > >> >lost, so have a split READ/TEST/WRITE sequence can't possibly > >work? > >> > > >> >I'd expect an atomic test and clear here? > >> > >> We cannot avoid the case that the application re-arms the > >> CQ only after a CQE got placed. That is why folks are polling the > >> CQ once after re-arming it - to make sure they do not miss the > >> very last and single CQE which would have produced a CQ event. > > > >That is different, that is re-arm happing after a CQE placement and > >this can't be fixed. > > > >What I said is that a re-arm from userspace cannot be lost. So you > >can't blindly clear the arm flag with the WRITE_ONCE. It might be OK > >beacuse of the if, but... > > > >It is just goofy to write it without a 'test and clear' atomic. If > >the > >writer side consumes the notify it should always be done atomically. > > > Hmmm, I don't yet get why we should test and clear atomically, if we > clear anyway - is it because we want to avoid clearing a re-arm which > happens just after testing and before clearing? It is just clearer as to the intent.. Are you trying to optimize away an atomic or something? That might work better as a dual counter scheme. > Another complication -- test_and_set_bit() operates on a single > bit, but we have to test two bits, and reset both, if one is > set. Why are two bits needed to represent armed and !armed? Jason