Received: by 10.223.185.116 with SMTP id b49csp946542wrg; Fri, 23 Feb 2018 09:13:45 -0800 (PST) X-Google-Smtp-Source: AH8x224UykNEibBA7kbnSoPCh+h8cbAKvRd4L5iFOGXjQUTS/He0eOa0j/U0vEhTxzkV82QtuvFi X-Received: by 10.99.106.71 with SMTP id f68mr1986034pgc.262.1519406025207; Fri, 23 Feb 2018 09:13:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519406025; cv=none; d=google.com; s=arc-20160816; b=NK2ER+ckJBMyhEkBedqYx9ajrQUFO7WK0xs0dMemz+ZL6/X5G7rIMzjUPVW4ht4qMF NVvTuq+mOy05f1LPGU4qZV30NAcBGsxEQOhqqhfy574W7Uphb2xOBElmnw1RizOgFQlG kJrvE8sNuYJftMFVjzevOTPiuTMwSvo4huQbtEbjNs13tiRRRY6o+vhUtbgpV/+qQ6Vr kY9evFT9Ysryy/6GM2gXQN0/2JewBT8Jw6T51G37bBk+NIwh/Wg+8FsC+QkByh2jiqD+ zR3znQOs5vWv37FDPD6i0ZQtpguWQtWWB27TTJoVtx1cHXPRSCD9USUVQb/II4aEHvvk Qnww== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ma1pf7aaXmZgHO3MoQVz34eNVEGoJzHPL03QX7wYyEA=; b=mfoaligeJqWM+7QiZDfKHOUBzmatzHGavtu7ZETk/hD9HL51v+u87XuPggLUdSLIrZ bo3ii9sQAMfuF50yLv6qiTNKl1TfC/wogKY/OdfXSoC/dx3ROda65W60WcM4rNFY290d c0+LW+XtG1UicIVqcMloiLmjiL15RX0jEVeBfy34p4y+H+4L09HZI5ZZszwwIf+g4h3t vmc47b9dJ0omJ0q41l5TdHNDFcKuMGkj6WxJmN4KuxsVrN9Xw2SIEj5yKV7Gnp7yKPxe X1xHiFr4Xe1wsZAmvbeT6x7YzTLSj1nzvTx/cKnrX5xM6PxB5ERM/cihTM0mbhif3iSy HWeg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Aqw2aOAW; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l131si1732313pga.536.2018.02.23.09.13.29; Fri, 23 Feb 2018 09:13:45 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Aqw2aOAW; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751610AbeBWRMr (ORCPT + 99 others); Fri, 23 Feb 2018 12:12:47 -0500 Received: from mail-qt0-f182.google.com ([209.85.216.182]:43135 "EHLO mail-qt0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751351AbeBWRMp (ORCPT ); Fri, 23 Feb 2018 12:12:45 -0500 Received: by mail-qt0-f182.google.com with SMTP id d26so11361301qtk.10; Fri, 23 Feb 2018 09:12:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ma1pf7aaXmZgHO3MoQVz34eNVEGoJzHPL03QX7wYyEA=; b=Aqw2aOAWm1patUC/wEY58CDyjuMtuiQr38UG9QqMB6b1hTjkdBk+DXoWUcXeOwosjr 7ylSYtRpBEukjZVshREtJleaWECbeX6YanViCKOvGzNFE6IbrhEJl6uhDPYjC/DNpfWj D7AL4CPryipUmeItWU4xY8cdkJd2L7vp/xTrc+2YRRMOC+v1xunB4OOyj71TwIlEHNWN vU8L9l+41151vha9TI2Xu4rNPagIkiNw2AedD9KMIhuoPjOw8jGmQmV8zFg5SoS8iA9j yXXAttpE6FYEGUO/nbLsDp3eJS4tBBk3Fz9MdEGXPDxPG9zJUBPDNR8iq0NTIelm9uDt PZWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ma1pf7aaXmZgHO3MoQVz34eNVEGoJzHPL03QX7wYyEA=; b=Cek2AQQoi7svdIMVnGqQiuT3ITJg46kDkTlugLG2mxIuDiaO/75yEAfyvuBD1+53v6 WA4xap1ttrzPt0necO7bGEBVZViImlZ9bAJuiA5tBivotYgEhErZcri6Fffx0yZrJ0vv QuzC38le+Qs92wH6U3mEcgD0g1TdYGtwPAfar2+q8bHvlUisjIgiZiCmK8XPrkut82JS O1QOpVrVjga+Ypbu6htFfWtrWOeTmvxCxxAbV7qQaiYklSXPF7Ub/1x+39Gj7uz98qCw Br55x+3jaLjanZP3DwPwdbT7CiBRfoQaEghQG+Y0z6wc5/T1SDUyoS9BbppOBIBQ/tLw 318A== X-Gm-Message-State: APf1xPCq69QLNT9/3Fc+YoOJtLxp+hf22FuOcRxlmWA1mU4IwGP59xhQ uTcbN9/G5KaevsECruRLqLviRrsT+pUVFNZbIRk= X-Received: by 10.200.39.217 with SMTP id x25mr3562694qtx.266.1519405964704; Fri, 23 Feb 2018 09:12:44 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Fri, 23 Feb 2018 09:12:44 -0800 (PST) In-Reply-To: <04b6c673208b4680b7d6cf41ccdfd3f0@AcuMS.aculab.com> References: <20180223153700.2186058-1-arnd@arndb.de> <04b6c673208b4680b7d6cf41ccdfd3f0@AcuMS.aculab.com> From: Andy Shevchenko Date: Fri, 23 Feb 2018 19:12:44 +0200 Message-ID: Subject: Re: [PATCH] scsi: lpfc: use memcpy_toio instead of writeq To: David Laight Cc: Arnd Bergmann , James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Johannes Thumshirn , "linux-scsi@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 Fri, Feb 23, 2018 at 7:09 PM, David Laight wrote: > From: Andy Shevchenko >> Sent: 23 February 2018 16:51 >> On Fri, Feb 23, 2018 at 6:41 PM, David Laight wrote: >> The side-effect I referred previously is about tails, i.e. unaligned >> bytes are transferred in portions >> like >> 7 on 64-bit will be 4 + 2 + 1, >> 5 = 4 + 1 > > on 64bit memcpy() is allowed to do: > (long *)(tgt+len)[-1] = (long *)(src+len)[-1]; > rep_movsq(tgt, src, len >> 3); > provided the length is at least 8. > > The misaligned PCIe transfer generates a single TLP covering 12 bytes with the > relevant byte enables set for the first and last 32bit words. But is it guaranteed on any type of bus? memcpy_toio() is a generic helper, so, first of all we need to be sure what CPU on its side does, this is I think is pretty straight forward since it's all written in asm for 64-bit case. So, what about buses? -- With Best Regards, Andy Shevchenko