Received: by 10.213.65.68 with SMTP id h4csp1704135imn; Thu, 29 Mar 2018 09:26:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/2YTCrXVG+W7oTltj/vMFVajbPbX/XE31lxpaYAhRJDFDBx5k2ek67TrfqfOuKepND7ZIs X-Received: by 2002:a17:902:8e86:: with SMTP id bg6-v6mr3806478plb.91.1522340771535; Thu, 29 Mar 2018 09:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522340771; cv=none; d=google.com; s=arc-20160816; b=VcsI3h+6tolxmPAS49/BjF2CcDNFgOFasdsL2ykRCd3qB1YNxhh6F0jfuM+hdRBYFJ wtbjqbuXqwdvoS64qfyFhBKHBi3AFYbO8I2P0i1Dw+De7qRg/k27hgxUtW+CcGyJzTSr NFIVW/GHzg8gAQnzgw1AAgov6biUqU9agRA5USRtGA7lxEn8wwpRNdusGhrOS2E9moGt WzO2HSBpFR54itdvZwFfTSexQ9w29NKACO6mgX883m5xwxx17ii15gOqHlLmb1oUezmT DNdrJVWpcGSjndtqQJk+3CJhA6EXgngjFb8DczzO6DrvfbNdYUyvXg0K2Y04udhyQyhj +4IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=zoCM3MLF6FdpHeeb0kdSgavWkFQKAeGXo2KmFUleE3U=; b=z1LssWM7PvFS3j2Rx/5hyZL2IL5XA70ib6uzJWbzQEG953iLzLIzyU4VBfslH+2A8T Qx8nCZXNf+MtfyA279958xOg+X29V9T2KwH6ohJsnqle6U8oy9WKoJJr7PuhqxMY1CW8 /NP7rd1ERU4m0TmojQv3O4c3DS9ZsxraWqdQebJS9A1grl6Whn6NRLuqRahkHGZuVjHj AXLLtZLnOoKL8HMEZ/HWbq4RRpbQhdUK8WZSGWwjRHM5jrwcKzXJtTs+GSLWOQ/wUH4F wg6JM4Mcp06N/T0Id/RzlewjNdvHnThsqQRoJ4bbgXnsZpGerzVMqacWB4KOSGzDTdDC j+4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=eXosBKGi; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u70si4693341pfj.341.2018.03.29.09.25.55; Thu, 29 Mar 2018 09:26:11 -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=@broadcom.com header.s=google header.b=eXosBKGi; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752145AbeC2QYm (ORCPT + 99 others); Thu, 29 Mar 2018 12:24:42 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:40516 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751859AbeC2QYk (ORCPT ); Thu, 29 Mar 2018 12:24:40 -0400 Received: by mail-qk0-f196.google.com with SMTP id o64so6550403qkl.7 for ; Thu, 29 Mar 2018 09:24:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=zoCM3MLF6FdpHeeb0kdSgavWkFQKAeGXo2KmFUleE3U=; b=eXosBKGi2vQQpi11gta5sMzQ7ZO8xf4K/NiOFQnhKJMXbLP5s3rE+TxPmXJYc/aj6V LKDuJrV4yOaEBGvZIfOxunNlsUOVqCXuaK9zR9x/oIqkwZjO4MX63OCYsUELsNyjLzYv gVdnEuWy+G9rLCvOrb9ax2VeJ5tZMlxUGgyMw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=zoCM3MLF6FdpHeeb0kdSgavWkFQKAeGXo2KmFUleE3U=; b=nlUtPJprODmpBwgflEBTz3wMwqJ5CbNjRlnz8ZCgocX6y2yNN4zMzMrrCM8PH0jy52 y2U3pQAMk8ihrVVvIndS2nO1xWxxim22c5JF4sKQhqcYjOZ+Z+1lPSuCluxSdXNpOBpH J/kGnR3qb6AkVTMiPT8aOLQAALaIANZbtfXBl5uSUaIujEWB4RUsUnGUPRjVgoWKTaM8 IeXskv6JviQnV5REIAkhUlAtfKC2+xYbotnXhCla07HC2249zehVGAaqy5SLzwa9YxIY MMM3j7kbWdJJTe828OUUCUx6YrUC5lS+wwcZfgCltsIySmVVK5vkdGPIM4QyRJEEnNXU QCyA== X-Gm-Message-State: ALQs6tC4QLP1g7PYOiBYXloaQtnMEv3z0oLWaqbuTmFzjoMYx4RPK5Zt kn5rvNUvHBk4YeYQNZ57PtCoNA== X-Received: by 10.55.24.15 with SMTP id j15mr11472564qkh.243.1522340679885; Thu, 29 Mar 2018 09:24:39 -0700 (PDT) Received: from [10.10.116.214] ([192.19.218.250]) by smtp.gmail.com with ESMTPSA id u37sm4385185qtj.79.2018.03.29.09.24.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Mar 2018 09:24:39 -0700 (PDT) Subject: Re: [PATCH 3/4] nvmet-fc: Don't use the count returned by the dma_map_sg call To: Logan Gunthorpe , linux-kernel@vger.kernel.org, linux-nvme@lists.infradead.org Cc: Christoph Hellwig , Sagi Grimberg References: <20180329160721.4691-1-logang@deltatee.com> <20180329160721.4691-4-logang@deltatee.com> From: James Smart Message-ID: <03cb3610-8ec7-9dc4-9e0a-82f4c30de578@broadcom.com> Date: Thu, 29 Mar 2018 09:24:36 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: <20180329160721.4691-4-logang@deltatee.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/29/2018 9:07 AM, Logan Gunthorpe wrote: > When allocating an SGL, the fibre channel target uses the number > of entities mapped as the number of entities in a given scatter > gather list. This is incorrect. > > The DMA-API-HOWTO document gives this note: > > The 'nents' argument to the dma_unmap_sg call must be > the _same_ one you passed into the dma_map_sg call, > it should _NOT_ be the 'count' value _returned_ from the > dma_map_sg call. > > The fc code only stores the count value returned form the dma_map_sg() > call and uses that value in the call to dma_unmap_sg(). > > The dma_map_sg() call will return a lower count than nents when multiple > SG entries were merged into one. This implies that there will be fewer > DMA address and length entries but the original number of page entries > in the SGL. So if this occurs, when the SGL reaches nvmet_execute_rw(), > a bio would be created with fewer than the total number of entries. > > As odd as it sounds, and as far as I can tell, the number of SG entries > mapped does not appear to be used anywhere in the fc driver and therefore > there's no current need to store it. > > Signed-off-by: Logan Gunthorpe > Cc: James Smart > Cc: Christoph Hellwig > Cc: Sagi Grimberg > Fixes: c53432030d8642 ("nvme-fabrics: Add target support for FC transport") > --- Signed-off-by: James SmartĀ  Patch looks fine. As for "not used anywhere", be careful as the structure being prepped is passed from the nvme-fc transport to an underlying lldd. So the references would likely be in the lldd. -- james