Received: by 10.223.185.116 with SMTP id b49csp910414wrg; Fri, 23 Feb 2018 08:41:26 -0800 (PST) X-Google-Smtp-Source: AH8x226mO0FTCiXjQPt788J0RINN1EUAlO6XFKmTV8URn9EBCcf5rvsQwc3RiBEfvEzaQAUEmSGz X-Received: by 10.98.59.11 with SMTP id i11mr2350746pfa.57.1519404086844; Fri, 23 Feb 2018 08:41:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519404086; cv=none; d=google.com; s=arc-20160816; b=bsGKGrq7456w5McNtta29XAw9bNIKzZz6cXPraFg3govds1+OB0RDBw74V1gYeMIOr Sx+nBBCOgzuVOltFY+vfQuyS15aqPRb91hgsjFwu9Lt/B2MjqM10ajzOCUj9AFtaXipI kN/KCCk72Gcf4VUd1j/6h5nuUQvFqvZou1FxKcWAmVBvp6Rg07arYeqdKqtZc5rS3jir brfyB9h1oPQ814bHkgQaIOXKqt0mYxPyw1uQGaUxX1flYVQn16RdIevycsLKVcPawRvi QpRPaxE0gX/NGdCwszusB0gk74wiz4Lr3rAhY/nTGUT4zMmy4klfK0wDBLceCUC7dw0N Snaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:cc:to:from :arc-authentication-results; bh=HxqG2zbjU7iTpCf4YdpsTR2Zntvk0WqDMzWZwLAppys=; b=FNwPfAzaWg9gicj1cYrzbpTCVEcxsu74dnDtV9bW3i5/VvdnYRXvjIn+FfuiJUMYsm z2xfBIj1npVi/tNDZXw0usq+MFgdi/DGHtTSnFVnw9FXeqjS1RPPVVvyMqj37ifpIx0j xDSE86kfaDy9MhYmtTZU4wYpBlPf6r4l2WPHPLZgkbTaX3SkDcWr4Mr4ApsfFi8xJajz sf7fejJ4Pn1DS8XjWfhIieccZw6pw1pb4UG/vN7+GSsEuZyo14eER95OYpiNlB9S7110 anF3RqfRFE0BJqMIU0IBYjI/ahn60vdDn09diMmsqI3O9S0P2+qILJIkWurPAXzPZBv8 XO/A== 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 p2si1721795pga.143.2018.02.23.08.41.11; Fri, 23 Feb 2018 08:41:26 -0800 (PST) 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 S1751985AbeBWQkd convert rfc822-to-8bit (ORCPT + 99 others); Fri, 23 Feb 2018 11:40:33 -0500 Received: from smtp-out6.electric.net ([192.162.217.188]:60429 "EHLO smtp-out6.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751836AbeBWQkb (ORCPT ); Fri, 23 Feb 2018 11:40:31 -0500 Received: from 1epGOY-0001L7-UI by out6c.electric.net with emc1-ok (Exim 4.87) (envelope-from ) id 1epGOa-0001SG-TZ; Fri, 23 Feb 2018 08:40:28 -0800 Received: by emcmailer; Fri, 23 Feb 2018 08:40:28 -0800 Received: from [156.67.243.126] (helo=AcuMS.aculab.com) by out6c.electric.net with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) (Exim 4.87) (envelope-from ) id 1epGOY-0001L7-UI; Fri, 23 Feb 2018 08:40:26 -0800 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) by AcuMS.aculab.com (fd9f:af1c:a25b:0:43c:695e:880f:8750) with Microsoft SMTP Server (TLS) id 15.0.1347.2; Fri, 23 Feb 2018 16:41:21 +0000 Received: from AcuMS.Aculab.com ([fe80::43c:695e:880f:8750]) by AcuMS.aculab.com ([fe80::43c:695e:880f:8750%12]) with mapi id 15.00.1347.000; Fri, 23 Feb 2018 16:41:21 +0000 From: David Laight To: 'Arnd Bergmann' , James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" CC: Hannes Reinecke , Johannes Thumshirn , "linux-scsi@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: RE: [PATCH] scsi: lpfc: use memcpy_toio instead of writeq Thread-Topic: [PATCH] scsi: lpfc: use memcpy_toio instead of writeq Thread-Index: AQHTrLxWasgki/emY0WMcZzOZHZDm6OyLxeA Date: Fri, 23 Feb 2018 16:41:21 +0000 Message-ID: References: <20180223153700.2186058-1-arnd@arndb.de> In-Reply-To: <20180223153700.2186058-1-arnd@arndb.de> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.33] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-Outbound-IP: 156.67.243.126 X-Env-From: David.Laight@ACULAB.COM X-Proto: esmtps X-Revdns: X-HELO: AcuMS.aculab.com X-TLS: TLSv1.2:ECDHE-RSA-AES256-SHA384:256 X-Authenticated_ID: X-PolicySMART: 3396946, 3397078 X-Virus-Status: Scanned by VirusSMART (c) X-Virus-Status: Scanned by VirusSMART (s) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann > Sent: 23 February 2018 15:37 > > 32-bit architectures generally cannot use writeq(), so we now get a build > failure for the lpfc driver: > > drivers/scsi/lpfc/lpfc_sli.c: In function 'lpfc_sli4_wq_put': > drivers/scsi/lpfc/lpfc_sli.c:145:4: error: implicit declaration of function 'writeq'; did you mean > 'writeb'? [-Werror=implicit-function-declaration] > > Another problem here is that writing out actual data (unlike accessing > mmio registers) means we must write the data with the same endianess > that we have read from memory, but writeq() will perform byte swaps > and add barriers inbetween accesses as we do for registers. > > Using memcpy_toio() should do the right thing here, using register > sized stores with correct endianess conversion and barriers (i.e. none), > but on some architectures might fall back to byte-size access. ... Have you looked at the performance impact of this on x86? Last time I looked memcpy_toio() aliased directly to memcpy(). memcpy() is run-time patched between several different algorithms. On recent Intel cpus memcpy() is implemented as 'rep movsb' relying on the hardware to DTRT. For uncached accesses (typical for io) the 'RT' has to be byte transfers. So instead of the 8 byte transfers (on 64 bit) you get single bytes. This won't be what is intended! memcpy_toio() should probably use 'rep movsd' for the bulk of the transfer. David