Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp452237ybi; Fri, 21 Jun 2019 02:26:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqwZ7CCfHKIt5vy/sIQILTj/urrRVH4w26hWWNCTnrZNK7YJ/U3g4AnHjsrLFnpFomiYBNpk X-Received: by 2002:a17:90a:36a9:: with SMTP id t38mr5350061pjb.19.1561109205131; Fri, 21 Jun 2019 02:26:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561109205; cv=none; d=google.com; s=arc-20160816; b=U6lLK33YyG0RepJvKArbG/XdznRL65MJcAmDxMNMKkYllnkJZEhVrDSmyG0UmTKe24 OMjddorokGub0lytkltMTVbd8vbUCcjNE+1DrOcAk2p/8gHDt9xCFJv0eTVyx8oGjaqk VKKXXZ1jTBFskf63S4KjX0p5DgAjBymeWJ3YBtbYCaHkZY3RfphuDO2IYwbnpGlax+e2 UwIztxg71KRbAhwDadF6lFk0wFSaihjbz4Ej3+UPxCKGRoSQB3N6+v/jlBYXl/fGmLI+ c5eM6IO18POhlJJl1D6XQUB5DXYKeoselVTisBvCRTN1XLem17JB7tr2WUGKMp9EuEJl udqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=bxv8AIAF+vbWnNHQODpa0e08ZKpZME4xVDCVWGsgOhw=; b=XlOeVnoxLE48o6VLMhWeMRXPUT+pi/Zel1FKStLvBMBAke474KgWSWw8hmKG28a/JG oQIVGsdxpTzjYB5OY2/Y1/TeLniFAizCV/DX+nP2fPg1FUNbT+K/ONH9clXudNBUA4kU EUSBzcRi0O1lXxefyXunhBCJwlJMRjEu7LVR3QeGPOyNCPyKQgS+/QQrVc64kz5g9fXS //9MsodVaIP0VkdiAJcXaXZVI8YpZWKFlOxba+hHlFAxwuWsZiE4K3t3AA89xPtM6Ear gDI7g7Vgcl/2KpwX4s9uWoJ3RGAHhfFP/zVK89hoz30WtwB/bnu1YMm50mrmhcgIb5lp Q6jg== 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 i101si2466528pje.4.2019.06.21.02.26.29; Fri, 21 Jun 2019 02:26:45 -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 S1726414AbfFUJ0H (ORCPT + 99 others); Fri, 21 Jun 2019 05:26:07 -0400 Received: from mail-qt1-f196.google.com ([209.85.160.196]:44234 "EHLO mail-qt1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726210AbfFUJ0H (ORCPT ); Fri, 21 Jun 2019 05:26:07 -0400 Received: by mail-qt1-f196.google.com with SMTP id x47so6174747qtk.11; Fri, 21 Jun 2019 02:26:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bxv8AIAF+vbWnNHQODpa0e08ZKpZME4xVDCVWGsgOhw=; b=OZ28ist+UGw9clfTiBYOtQoCwj9c4Iz5zgoDMKW/aubIwzEbuc1LWMfBNiHtmPkl37 iZOphOl1GVk2IE4eizcsbSbFcJPVgaYJI9+qmfecb1PSKbHp6uhX/jpavZPp4rTem42V q2G/cmKfkrxZUTtkuiy9R7rt5+JZMtc4m4vfT4KwXSFrLoc7QGBCmSH4VNqmRNouptTV vlDicTaNxbHmtbKFjB6i2WBeT7bQhKOKXnCwrom9JGX687xxhlZ8QEMqaNWAdY+8+Xep 7n7ksU5vItZnxzACmNq7hYLpvOqLVBtCj6GrTp1Sxmd6W1QJTFJD5MNjOyVqHEeq+ATv F+oA== X-Gm-Message-State: APjAAAVHJn6ghLDwmUmZojYR+6erK3+9+fbPZ3K5D+hlCvDBtPvx0SBK SrmlUPD61VK11VupbueZcr2FKy7raMiedDeIZg4= X-Received: by 2002:a0c:87bd:: with SMTP id 58mr43431993qvj.62.1561109166469; Fri, 21 Jun 2019 02:26:06 -0700 (PDT) MIME-Version: 1.0 References: <20190614063341.1672-1-fancer.lancer@gmail.com> <20190620174002.tgayzon7dc5d57fh@pburton-laptop> In-Reply-To: From: Arnd Bergmann Date: Fri, 21 Jun 2019 11:25:47 +0200 Message-ID: Subject: Re: [PATCH] mips: Remove q-accessors from non-64bit platforms To: "Maciej W. Rozycki" Cc: Paul Burton , Serge Semin , Ralf Baechle , James Hogan , Serge Semin , "Vadim V . Vlasov" , "linux-mips@vger.kernel.org" , "linux-kernel@vger.kernel.org" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 20, 2019 at 8:19 PM Maciej W. Rozycki wrote: > > On Thu, 20 Jun 2019, Paul Burton wrote: > > > So this seems pretty reasonable. Build testing all our defconfigs only > > showed up one issue for decstation_defconfig & decstation_r4k_defconfig: > > > > drivers/net/fddi/defza.c: In function 'fza_reads': > > drivers/net/fddi/defza.c:88:17: error: implicit declaration of > > function 'readq_relaxed'; did you mean 'readw_relaxed'? > > [-Werror=implicit-function-declaration] > > #define readq_u readq_relaxed > > ^~~~~~~~~~~~~ > > drivers/net/fddi/defza.c:126:13: note: in expansion of macro 'readq_u' > > *dst++ = readq_u(src++); > > ^~~~~~~ > > drivers/net/fddi/defza.c: In function 'fza_writes': > > drivers/net/fddi/defza.c:92:18: error: implicit declaration of > > function 'writeq_relaxed'; did you mean 'writel_relaxed'? > > [-Werror=implicit-function-declaration] > > #define writeq_u writeq_relaxed > > ^~~~~~~~~~~~~~ > > drivers/net/fddi/defza.c:151:4: note: in expansion of macro 'writeq_u' > > writeq_u(*src++, dst++); > > ^~~~~~~~ > > CC net/core/scm.o > > cc1: some warnings being treated as errors > > make[4]: *** [scripts/Makefile.build:279: drivers/net/fddi/defza.o] Error 1 > > > > These uses of readq_relaxed & writeq_relaxed are both conditional upon > > sizeof(unsigned long) == 8, ie. upon CONFIG_64BIT=y so they're not going > > to present a runtime issue but we need to provide some implementation of > > the *q accessors to keep the compiler happy. > > > > I see a few options: > > > > 1) We could just have defza.c include to get > > the appropriate declarations, which should then get optimized away by > > the compiler anyway & never actually be used. > > This, definitely. The compiler should generally not be allowed to combine two adjacent readl_relaxed() back into a 64-bit load. Only __raw_readl() can be combined or split up. If the mips version of the *_relaxed() accessors allows the compiler to do this, I would consider that a bug. > > 2) We could have defza.h #define its readq_u & writeq_u macros > > differently for CONFIG_32BIT=y kernels, perhaps using > > __compiletime_error to catch any bogus use of them. > > > > 3) We could do the same in a generic header, though if nobody else has > > needed it so far & this is the only place we need it then maybe it's > > not worth it. > > > > So I'm thinking option 2 might be best, as below. Having said that I > > don't mind option 1 either - it's simple. Maciej do you have any > > preference? > > The use of 64-bit operations to access option's packet memory, which is > true SRAM, i.e. no side effects, is to improve throughput only and there's > no need for atomicity here nor also any kind of barriers, except at the > conclusion. Splitting 64-bit accesses into 32-bit halves in software > would not be a functional error here. The other property of packet memory and similar things is that you basically want memcpy()-behavior with no byteswaps. This is one of the few cases in which __raw_readq() is actually the right accessor in (mostly) portable code. Arnd