Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5142740yba; Wed, 8 May 2019 08:31:33 -0700 (PDT) X-Google-Smtp-Source: APXvYqy77P2j6IXnDiuEhrFYEqS2d+7OdJA8BjOYAP5uQXY7jY47cLhzgQQ6nNz3a1KVJZiYAHL3 X-Received: by 2002:a65:5687:: with SMTP id v7mr47485322pgs.299.1557329493638; Wed, 08 May 2019 08:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557329493; cv=none; d=google.com; s=arc-20160816; b=v3HgcjbK24CquNFC2Ldq/C2dZFgOtChTgJvbYHaRtJJ/QmrYlJTwIWvhxm0aLZrrN/ JDaPm5yezi7xpDx74VCJt3LukBHJQrOSlhBXo4RkkK7df2HOEaMLIutl/f9uNKdIpftx a2mb2MKkiZZ6EJ0ByfZL4WuW2KEitSFlcemtqmz/0AL2InO1jDah5TNT45hCXHE0kiKm XwgUQNpVfZBemsiAJavJfZaSmEpE4ARC2CaC2UzXtmGVab21lvRBVp/EOSNhA5NkznAN DWtxxMBodsOAYnaswEEpbnkKm4q0/tydkmwS18i0ot8RTMiFcor8a7NETtoyr++iMZiS Z6YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:thread-index:thread-topic :content-transfer-encoding:mime-version:subject:references :in-reply-to:message-id:cc:to:from:date; bh=1NSD0Z7VnHeLEN/QcEE9OGz+RjXfjt4Eqb95YjiuOls=; b=nhTz572dkF/PGdbqPdrkdFwk7MC+ac86lo8cBDiApN2lStGIH+/OAwmpoECnXIIEh3 Jyv8BQ/VIH0cl3OwIGGWT8ZJWxH01pyndTQBzEkLke/l2ocOoTZqWhjtJCk6VdmDx49w KFCrEidPc9Rcp9JYcVXLtirO4pe3U3FWCTUpnjMhOeyMsgX5z+Bc1hn+4m5DGqM7IzWX 38jdLs5k2RNMODl0dkX66yMT5sWoct0FUH94gS+A/cg69hpRLKlqZmOa5mRlH/UkeRRA CVhSJuJWBofCPki/tK3xAuNwLR53hlPd7qhyosZPQTC3RK22ScdKHpK3aiE9SyjDwZ7R 2F2Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t9si8719409plq.396.2019.05.08.08.31.17; Wed, 08 May 2019 08:31:33 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728272AbfEHPXg (ORCPT + 99 others); Wed, 8 May 2019 11:23:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39216 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726842AbfEHPXe (ORCPT ); Wed, 8 May 2019 11:23:34 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 924EB3007149; Wed, 8 May 2019 15:23:33 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BE972E09B; Wed, 8 May 2019 15:23:33 +0000 (UTC) Received: from zmail21.collab.prod.int.phx2.redhat.com (zmail21.collab.prod.int.phx2.redhat.com [10.5.83.24]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id B6B4B41F56; Wed, 8 May 2019 15:23:32 +0000 (UTC) Date: Wed, 8 May 2019 11:23:32 -0400 (EDT) From: Pankaj Gupta To: Jakub =?utf-8?Q?Staro=C5=84?= Cc: linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org, kvm@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-acpi@vger.kernel.org, qemu-devel@nongnu.org, linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org, jack@suse.cz, mst@redhat.com, jasowang@redhat.com, david@fromorbit.com, lcapitulino@redhat.com, adilger kernel , zwisler@kernel.org, aarcange@redhat.com, dave jiang , darrick wong , vishal l verma , david@redhat.com, willy@infradead.org, hch@infradead.org, jmoyer@redhat.com, nilal@redhat.com, lenb@kernel.org, kilobyte@angband.pl, riel@surriel.com, yuval shaia , stefanha@redhat.com, pbonzini@redhat.com, dan j williams , kwolf@redhat.com, tytso@mit.edu, xiaoguangrong eric , cohuck@redhat.com, rjw@rjwysocki.net, imammedo@redhat.com, smbarber@google.com Message-ID: <1482604497.27348783.1557329012320.JavaMail.zimbra@redhat.com> In-Reply-To: <1555943483.27247564.1557313967518.JavaMail.zimbra@redhat.com> References: <20190426050039.17460-1-pagupta@redhat.com> <20190426050039.17460-3-pagupta@redhat.com> <3d6479ae-6c39-d614-f1d9-aa1978e2e438@google.com> <1555943483.27247564.1557313967518.JavaMail.zimbra@redhat.com> Subject: Re: [Qemu-devel] [PATCH v7 2/6] virtio-pmem: Add virtio pmem driver MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Originating-IP: [10.67.116.32, 10.4.195.26] Thread-Topic: virtio-pmem: Add virtio pmem driver Thread-Index: PGqRBxt7ac04jwyhY+CEFoY6aRdKvNGTIbxd X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 08 May 2019 15:23:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > > > > +int virtio_pmem_flush(struct nd_region *nd_region) > > > +{ > > > + int err; > > > + unsigned long flags; > > > + struct scatterlist *sgs[2], sg, ret; > > > + struct virtio_device *vdev = nd_region->provider_data; > > > + struct virtio_pmem *vpmem = vdev->priv; > > > + struct virtio_pmem_request *req; > > > + > > > + might_sleep(); > > > + req = kmalloc(sizeof(*req), GFP_KERNEL); > > > + if (!req) > > > + return -ENOMEM; > > > + > > > + req->done = req->wq_buf_avail = false; > > > + strcpy(req->name, "FLUSH"); > > > + init_waitqueue_head(&req->host_acked); > > > + init_waitqueue_head(&req->wq_buf); > > > + sg_init_one(&sg, req->name, strlen(req->name)); > > > + sgs[0] = &sg; > > > + sg_init_one(&ret, &req->ret, sizeof(req->ret)); > > > + sgs[1] = &ret; > > > + > > > + spin_lock_irqsave(&vpmem->pmem_lock, flags); > > > + err = virtqueue_add_sgs(vpmem->req_vq, sgs, 1, 1, req, GFP_ATOMIC); > > > + if (err) { > > > + dev_err(&vdev->dev, "failed to send command to virtio pmem device\n"); > > > + > > > + list_add_tail(&vpmem->req_list, &req->list); > > > + spin_unlock_irqrestore(&vpmem->pmem_lock, flags); > > > + > > > + /* When host has read buffer, this completes via host_ack */ > > > + wait_event(req->wq_buf, req->wq_buf_avail); > > > + spin_lock_irqsave(&vpmem->pmem_lock, flags); > > > + } > > > > Aren't the arguments in `list_add_tail` swapped? The element we are adding > Yes, arguments for 'list_add_tail' should be swapped. list_add_tail(&req->list, &vpmem->req_list); Thank you, Pankaj