From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54240) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIZBK-0004Od-Ap for qemu-devel@nongnu.org; Tue, 03 Feb 2015 03:50:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YIZBH-0005BM-5a for qemu-devel@nongnu.org; Tue, 03 Feb 2015 03:50:02 -0500 Received: from mail-wi0-x236.google.com ([2a00:1450:400c:c05::236]:37709) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YIZBG-0005BE-UI for qemu-devel@nongnu.org; Tue, 03 Feb 2015 03:49:59 -0500 Received: by mail-wi0-f182.google.com with SMTP id n3so20087841wiv.3 for ; Tue, 03 Feb 2015 00:49:58 -0800 (PST) Sender: Paolo Bonzini Message-ID: <54D08BB2.1070400@redhat.com> Date: Tue, 03 Feb 2015 09:49:54 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <54D032FB.404@huawei.com> <54D038EB.9020508@huawei.com> In-Reply-To: <54D038EB.9020508@huawei.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [question] the patch which affect performance of virtio-scsi List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Wangting (Kathy)" Cc: qemu-devel On 03/02/2015 03:56, Wangting (Kathy) wrote: > Sorry, I find that the patch of "virtio-scsi: Optimize virtio_scsi_init_req" can slove this problem. Great that you could confirm that. :) > By the way, can you tell me the reason of the change about cdb and sense? cdb and sense are variable-size items. ANY_LAYOUT support changed VirtIOSCSIReq: instead of having a pointer to the request, it copies the request from guest memory into VirtIOSCSIReq. This is required because the request might not be contiguous in guest memory. And because the request and response headers (e.g. VirtIOSCSICmdReq and VirtIOSCSICmdResp) are included by value in VirtIOSCSIReq, the variable-sized fields have to be treated specially. Only one of them can remain in VirtIOSCSIReq, because you cannot have a flexible array member (e.g. "uint_8 sense[];") in the middle of a struct. cdb is always used, so it is chosen for the variable-sized part of VirtIOSCSIReq: cdb was simply moved from VirtIOSCSICmdReq to VirtIOSCSIReq. Instead, requests that complete with sense data are not a fast path. Hence sense is retrieved from the SCSIRequest, and virtio_scsi_command_complete copies it into the guest buffer via scsi_req_get_sense + qemu_iovec_from_buf. Paolo