Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp11171268ybi; Thu, 25 Jul 2019 11:12:32 -0700 (PDT) X-Google-Smtp-Source: APXvYqyFONEahyTMfIg0st81aD6WwEnCC0Atvz/uyxLLukxnaEPQWzKyW2o2AcBnIqvJAaLA0D32 X-Received: by 2002:aa7:9481:: with SMTP id z1mr18071020pfk.92.1564078352593; Thu, 25 Jul 2019 11:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564078352; cv=none; d=google.com; s=arc-20160816; b=A/Uv8lk+cPEFW781e4qNMRfVw2ykRMUFBWOdW1KlEk4DJHGihNPrzlpuqVMyEqEAKE NDCRoeqW4G5hTJZ8VElYrwYtP0/SuvUTvAdKbp81JjIvg+8ny5PvWN+L92l+5lFMHjLM iYGfiH0UN5ACBBwrmZiFLl9rRKYmspYipJncx9h4SkGt26bIFw0pwlwbu9YIfAamhbqk W94bGH+Zd3mZbwHf56Aoiu7dzpbFuLVME6ud0ywkzt7tfLOYe2cWtoSoSbYaJMnIj9Es 5j/eIcvcbaqOCi0oTNDAs5EJExwGgRiarxwJbjp/LB66e5X7Qdk4hcET+4oEHKgCEC3q Btww== 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=i32w2wAVyyehf6wB6Jc3nUiW8Nc61mU3JB3Ii260K3Q=; b=w+p+bqcSlVUqPTxclVu/9F52s8Mlho2iA+ygFL9jtjUEjUVR1kadsKHBADwPHnKc9A OMGetDgaO2Cr1zpJNxs6vNBzlFk9hq9P+3fntKIb8sKWfrDdZLf7R2fVoWM/YTAnFhwG PmOOrrOjsDldM8oHEvsp/lprs+uDrZHFKGSTeXWHN7OzRwyFjruk/+0nS36xpmyeBKat TmBRSMAvBMpn1KkAY6y/OIExoguhur6cvRizKrQKS2RA2L/MnvljSZ0tsYLbOLPkBl6O TqeTvYFdwZuuU8ieM9zu9M9qdgElKapf96WvD1OC4/mnFtATKQIIxAmniC5s1ufB938B SfhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=hRRa7+Hi; 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 b74si17534309pfb.281.2019.07.25.11.12.17; Thu, 25 Jul 2019 11:12:32 -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=hRRa7+Hi; 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 S1729850AbfGYRXE (ORCPT + 99 others); Thu, 25 Jul 2019 13:23:04 -0400 Received: from mail-qk1-f196.google.com ([209.85.222.196]:39084 "EHLO mail-qk1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728898AbfGYRXD (ORCPT ); Thu, 25 Jul 2019 13:23:03 -0400 Received: by mail-qk1-f196.google.com with SMTP id w190so37008356qkc.6 for ; Thu, 25 Jul 2019 10:23:03 -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=i32w2wAVyyehf6wB6Jc3nUiW8Nc61mU3JB3Ii260K3Q=; b=hRRa7+Hiq0zE4C78OsxpkAoMIJKzhBqZ4cwAv2BA7VorrW62k4JHhQbuMxYU7J8Eo2 vUMVYGx1bih9zqUYlT3Ix+cg+FqFyOffi3DEC+9itXAT36G3GXOPQpqLLOytDUwAn04m bNtbRaxs8SzEzlIRlAmyOwXj+T6L+wNuUdIVNRkRF2vPnSdYGweDlFcqYpTJ+DuBuwtT 0xRKF9fYO0uCBHgsTQRHMmLAL4N+KF4d9Omp5R2i7ODpfrjhg2qc7QAiYCBHtTENCJMG riSyr2v3CfO9VDGkYzXsQUyBzuBzi59UP+QFfBXdvkFzeU21d472IqGTlbAGvnQIsMwA N2qQ== 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=i32w2wAVyyehf6wB6Jc3nUiW8Nc61mU3JB3Ii260K3Q=; b=cVQcCl2Mb5NCFrtXp6QAGNU/bCrnmbJcLrFdURuz6YL3mCkunnIuVuBguSqo0JCuzF knh7Wj0UAmVobrVMcrP9xq0FJigWlmZQ4jvOtqTcAsKwuIXTpazfRsH5RxDmosGLWBGe t8PPncLIqpqdV1Jrw6pn9ARttl8IwtbUNnmmE0fiayJs0Pt5oqp+S7Rw+M/7TtLzuh3T eTavdv0uSpw+MyuWy5OuA6rEaai+QmzH2Tzy34zOc5T5xWFhvUjYhJpnilvc66tA0bzm miItMJY4/CRc9sT8O+BN22BJ9S2VamoXk3Ti7Cq0nTEDhL1aLtU8cAAL6OJxVR/kE0EM Pa5A== X-Gm-Message-State: APjAAAWOfPNbwNB4RdTl2gM/Dd84f8Bpjb4cNhVfIaPkLaMnphNBETcA EWXAyXQwdU3/GPLYsOWjhqkXRQ== X-Received: by 2002:a37:6248:: with SMTP id w69mr59614762qkb.225.1564075382818; Thu, 25 Jul 2019 10:23:02 -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 e1sm24786827qtb.52.2019.07.25.10.23.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 25 Jul 2019 10:23:02 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hqhSH-0001da-Va; Thu, 25 Jul 2019 14:23:01 -0300 Date: Thu, 25 Jul 2019 14:23:01 -0300 From: Jason Gunthorpe To: Arnd Bergmann Cc: Bernard Metzler , Doug Ledford , Peter Zijlstra , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] rdma/siw: avoid smp_store_mb() on a u64 Message-ID: <20190725172301.GA6225@ziepe.ca> References: <20190712085212.3901785-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190712085212.3901785-1-arnd@arndb.de> 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 10:51:23AM +0200, Arnd Bergmann wrote: > The new siw driver fails to build on i386 with > > drivers/infiniband/sw/siw/siw_qp.c:1025:3: error: invalid output size for constraint '+q' > smp_store_mb(*cq->notify, SIW_NOTIFY_NOT); > ^ > include/asm-generic/barrier.h:141:35: note: expanded from macro 'smp_store_mb' > #define smp_store_mb(var, value) __smp_store_mb(var, value) > ^ > arch/x86/include/asm/barrier.h:65:47: note: expanded from macro '__smp_store_mb' > #define __smp_store_mb(var, value) do { (void)xchg(&var, value); } while (0) > ^ > include/asm-generic/atomic-instrumented.h:1648:2: note: expanded from macro 'xchg' > arch_xchg(__ai_ptr, __VA_ARGS__); \ > ^ > arch/x86/include/asm/cmpxchg.h:78:27: note: expanded from macro 'arch_xchg' > #define arch_xchg(ptr, v) __xchg_op((ptr), (v), xchg, "") > ^ > arch/x86/include/asm/cmpxchg.h:48:19: note: expanded from macro '__xchg_op' > : "+q" (__ret), "+m" (*(ptr)) \ > ^ > drivers/infiniband/sw/siw/siw_qp.o: In function `siw_sqe_complete': > siw_qp.c:(.text+0x1450): undefined reference to `__xchg_wrong_size' > drivers/infiniband/sw/siw/siw_qp.o: In function `siw_rqe_complete': > siw_qp.c:(.text+0x15b0): undefined reference to `__xchg_wrong_size' > drivers/infiniband/sw/siw/siw_verbs.o: In function `siw_req_notify_cq': > siw_verbs.c:(.text+0x18ff): undefined reference to `__xchg_wrong_size' > > Since smp_store_mb() has to be an atomic store, but the architecture > can only do this on 32-bit quantities or smaller, but 'cq->notify' > is a 64-bit word. > > Apparently the smp_store_mb() is paired with a READ_ONCE() here, which > seems like an odd choice because there is only a barrier on the writer > side and not the reader, and READ_ONCE() is already not atomic on > quantities larger than a CPU register. > > I suspect it is sufficient to use the (possibly nonatomic) WRITE_ONCE() > and an SMP memory barrier here. If it does need to be atomic as well > as 64-bit quantities, using an atomic64_set_release()/atomic64_read_acquire() > may be a better choice. > > Fixes: 303ae1cdfdf7 ("rdma/siw: application interface") > Fixes: f29dd55b0236 ("rdma/siw: queue pair methods") > Cc: Peter Zijlstra > Signed-off-by: Arnd Bergmann > --- > drivers/infiniband/sw/siw/siw_qp.c | 4 +++- > drivers/infiniband/sw/siw/siw_verbs.c | 5 +++-- > 2 files changed, 6 insertions(+), 3 deletions(-) Bernard, please send at patch for whatever solution we settled on against 5.3-rc1 Thanks, Jason