Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp6410563yba; Tue, 14 May 2019 07:09:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyuO1pzSJuZCrISeR0y7Tf9MuyeJWQpRnpReGu+76K7X90p1MMYdlNLAuatMyTqW9jkA6jf X-Received: by 2002:aa7:9a1d:: with SMTP id w29mr19788349pfj.81.1557842967145; Tue, 14 May 2019 07:09:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557842967; cv=none; d=google.com; s=arc-20160816; b=E+k5WTbxJitCYHkWWqp3h0ZQEsAeSd+IWOW14WOcrX5d1UPuMzaOJxn5eZaGt+mDif Du7MWNKovfITsxJLQjYnT0x/t/vB5cX1vTO11CovaXjY2L81J4/JhXafwhS/LXZcfcHC Wj5d14EQrYOfG35YQcc6AcpJKJ2b4bx2lfptk6vwFQniaiha+GjSPEaApt3tLvaesDdL 2VDs5zkNGHphaHwF4KnT7hfuy6ZjVgAeyZpLaHw3v7RgWxPHy69NAQvty54YsulzdGZm Hg1upfyq22gotQfKN1ks4GDkrXupW2II8Hu8rpOPtpRtSFLm7NtrqHr74my77k1+LrVM tULw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=Ks75yII4fjVXJ0Sia2+emZzY1vlPpVSSJvLLV+PDDdw=; b=jTm3Tw/LGBiSjp2778fWrFv67mpJHPJQkLB5kNHlDSaHjpfLG8OpsjqX1+6ad9bUCS yYepyjanOkVulTHvH01wMhYLDcZ/Q2gXOlQ71eOb9zcbCNIE+UKaYJb4THnaGt5U2UEi 5K79S2WG+XQzREwT3qDrq516tfM+z8dZsigFLdEXqbScIrAGdtyQ7Fx/frOPuiGQS3xo m8x9PeretAe/JR1Ck7/2PISmsSFasiV+fO4QKCu6qMYwt8Zms+8u/tPykCjgLExPl7/Z 3mdbL3D3frCYCcXuKIbo3anWPlH+1+A/I1/9nh+N1PZNLQGSbaLNASUIkc1NZFvaE/KE qbeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CpupEWon; 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 39si20242487pla.437.2019.05.14.07.09.09; Tue, 14 May 2019 07:09:27 -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=@gmail.com header.s=20161025 header.b=CpupEWon; 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 S1726332AbfENOGd (ORCPT + 99 others); Tue, 14 May 2019 10:06:33 -0400 Received: from mail-pl1-f195.google.com ([209.85.214.195]:43530 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725916AbfENOGd (ORCPT ); Tue, 14 May 2019 10:06:33 -0400 Received: by mail-pl1-f195.google.com with SMTP id n8so8329808plp.10 for ; Tue, 14 May 2019 07:06:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=Ks75yII4fjVXJ0Sia2+emZzY1vlPpVSSJvLLV+PDDdw=; b=CpupEWonGiNTCMxadJADqpuZsNmcH4qlx1iAzBahjQYoepVY6IB10WeFBmlzfx9gzk Ao8eTTo44fTCk1hSnOxivWcNggXZPbn6ncgdftQt/OVgZH6f0RB2QxUk9BZM3ShXz0mt 78bTc5XiYvg8UVfjnOdoX+kDsmKAt73tJeLWmTZ0xDKMwIf8bGXQBgsrOp601m3/lO51 shScBhiqorOcJ9fH0CIOoZbi59zdK1pE15PUMZg5KIHKgVsh8JKkiVLjn/i8DdxbxLWY qSg9qwcWCZIoEkIaj8NEJ4ZbSGMKshQWbtgtoFJoL3nP5+Jss1lu72tDD6Gsce38j+xi VHPw== 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:content-transfer-encoding; bh=Ks75yII4fjVXJ0Sia2+emZzY1vlPpVSSJvLLV+PDDdw=; b=Ww+zM1oiQ3rITAMdfgZPzoDb25lqcU14iTxwCdiMSefqt9MqLzoIW0TleWi0Vngc2R yd4CtDJtmalPlJ8gBt3gEF625auEWTbFdlBxDC2fYGkywfSt8daZh6zp3JowIaRc0wQf CmyIupwzyLQa+F9gtPZoDrrvp/3WsTiH9VknmqkJwsTOWAwqgUKXp9W8zRGoyQPBZUzM OikGXPT0Wwh8as2z/Va0A25Sk3tsZTYDT3yiqjkZyZognHtZlQZZ2V9RCNOttEKzf6Gk 1R/3EVVoMBOcpPGHsDnOVfaGf/yPdaERmXcSI5Q6rP2uHho+xSmmKNvu5jgV+0jkjxB2 3BdA== X-Gm-Message-State: APjAAAUHeoff1Y1GJnyzmk0zIvISdYiNrhxM4BGNGf1H6LzVoO+OWh1p KKDTaefAsSDdgnQaqnK2fYdy0eQ7fXEvqWI78m8= X-Received: by 2002:a17:902:7610:: with SMTP id k16mr2447988pll.177.1557842792829; Tue, 14 May 2019 07:06:32 -0700 (PDT) MIME-Version: 1.0 References: <1557676457-4195-6-git-send-email-akinobu.mita@gmail.com> <1557676457-4195-1-git-send-email-akinobu.mita@gmail.com> <20190513074601epcms2p12c0a32730a16be3b69b68e3c9d4d0b92@epcms2p1> In-Reply-To: From: Akinobu Mita Date: Tue, 14 May 2019 23:06:21 +0900 Message-ID: Subject: Re: [PATCH v3 5/7] nvme-pci: add device coredump infrastructure To: Chaitanya Kulkarni Cc: "minwoo.im@samsung.com" , "linux-nvme@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Keith Busch , Sagi Grimberg , Kenneth Heitke , Jens Axboe , Minwoo Im , Johannes Berg , Christoph Hellwig Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2019=E5=B9=B45=E6=9C=8814=E6=97=A5(=E7=81=AB) 0:23 Chaitanya Kulkarni : > > On 05/13/2019 12:46 AM, Minwoo Im wrote: > >> +static int nvme_get_telemetry_log_blocks(struct nvme_ctrl *ctrl, void= *buf, > >> + size_t bytes, loff_t offset) > >> +{ > >> + loff_t pos =3D 0; > >> + u32 chunk_size; > >> + > >> + if (check_mul_overflow(ctrl->max_hw_sectors, 512u, &chunk_size)) > >> + chunk_size =3D UINT_MAX; > >> + > >> + while (pos < bytes) { > >> + size_t size =3D min_t(size_t, bytes - pos, chunk_size); > >> + int ret; > >> + > >> + ret =3D nvme_get_log(ctrl, NVME_NSID_ALL, > >> NVME_LOG_TELEMETRY_CTRL, > >> + 0, buf + pos, size, offset + pos); > >> + if (ret) > >> + return ret; > >> + > >> + pos +=3D size; > >> + } > >> + > >> + return 0; > >> +} > >> + > >> +static int nvme_get_telemetry_log(struct nvme_ctrl *ctrl, > >> + struct sg_table *table, size_t bytes) > >> +{ > >> + int n =3D sg_nents(table->sgl); > >> + struct scatterlist *sg; > >> + size_t offset =3D 0; > >> + int i; > >> + > A little comment would be nice if you are using sg operations. > >> + for_each_sg(table->sgl, sg, n, i) { > >> + struct page *page =3D sg_page(sg); > >> + size_t size =3D min_t(int, bytes - offset, sg->length); > >> + int ret; > >> + > >> + ret =3D nvme_get_telemetry_log_blocks(ctrl, > >> page_address(page), > >> + size, offset); > >> + if (ret) > >> + return ret; > >> + > >> + offset +=3D size; > >> + } > >> + > >> + return 0; > >> +} > > > > Can we have those two in nvme-core module instead of being in pci modul= e? > > Since they are based on the controller they should be moved next to > nvme_get_log() in the ${KERN_DIR}/drivers/nvme/host/core.c. OK. But these functions will be changed to use bio_vec instead of sg in the next version.