From patchwork Mon Sep 5 19:03:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 9315071 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 592C2600CA for ; Mon, 5 Sep 2016 19:05:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4CD2F288A5 for ; Mon, 5 Sep 2016 19:05:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 412AD289DB; Mon, 5 Sep 2016 19:05:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 243A6288A5 for ; Mon, 5 Sep 2016 19:05:20 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgzAm-0003tS-TN; Mon, 05 Sep 2016 19:03:12 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bgzAl-0003tD-QA for xen-devel@lists.xenproject.org; Mon, 05 Sep 2016 19:03:11 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id BD/03-29022-F61CDC75; Mon, 05 Sep 2016 19:03:11 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNLMWRWlGSWpSXmKPExsVybKJsh27ewbP hBmceyVp83zKZyYHR4/CHKywBjFGsmXlJ+RUJrBmnFyxmKujnr7h2YCp7A+N6ni5GLg4hgamM Ep23ZrFAOJOZJCa3TgRyODnYBAwl/j7ZxAZiiwjISHReWsQIYjMLlErcPPiYHcQWFnCReHT0H 1gNi4CqRMPTl2BxXgFXiTm/doHFJQTkJE4em8wKYnMKeEsce3wHLC4k4CWx8dxhRoiaDIl5PX NYIWwviUU3LkHZahJXz21insDIt4CRYRWjRnFqUVlqka6hmV5SUWZ6RkluYmaOrqGBqV5uanF xYnpqTmJSsV5yfu4mRmCgMADBDsbzpz0PMUpyMCmJ8haong0X4kvKT6nMSCzOiC8qzUktPsQo w8GhJMG7fz9QTrAoNT21Ii0zBxiyMGkJDh4lEd4SkDRvcUFibnFmOkTqFKOilDhvK0hCACSRU ZoH1waLk0uMslLCvIxAhwjxFKQW5WaWoMq/YhTnYFQS5u0GmcKTmVcCN/0V0GImoMXrdp8GWV ySiJCSamAsnNJYwcaYszlRZf2m7xO+X6t69Mtm24XoazUdfczqRcf/FMzfzr/l9NlZGy/lpTm 8PH9ny+RtPSvqi4paFU3rF0vOvabS9GVryKxNfGFnYuwve7tL2P4pO7L50+kDDzUYJy2a737g 9BnRBMHtwoaLp7Kf5VfcOi3PUd+YwzGu2eRXwepT6h+ylViKMxINtZiLihMBocLg6Y4CAAA= X-Env-Sender: sstabellini@kernel.org X-Msg-Ref: server-7.tower-206.messagelabs.com!1473102189!57765105!1 X-Originating-IP: [198.145.29.136] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.84; banners=-,-,- X-VirusChecked: Checked Received: (qmail 34572 invoked from network); 5 Sep 2016 19:03:10 -0000 Received: from mail.kernel.org (HELO mail.kernel.org) (198.145.29.136) by server-7.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Sep 2016 19:03:10 -0000 Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CBFD520204; Mon, 5 Sep 2016 19:03:07 +0000 (UTC) Received: from sstabellini-ThinkPad-X260.hsd1.ca.comcast.net (unknown [96.82.76.110]) (using TLSv1.2 with cipher AES128-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 49DD4203E1; Mon, 5 Sep 2016 19:03:06 +0000 (UTC) From: Stefano Stabellini To: peter.maydell@linaro.org Date: Mon, 5 Sep 2016 12:03:03 -0700 Message-Id: <1473102183-5179-1-git-send-email-sstabellini@kernel.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: X-Virus-Scanned: ClamAV using ClamSMTP Cc: Juergen Gross , xen-devel@lists.xenproject.org, sstabellini@kernel.org, qemu-devel@nongnu.org Subject: [Xen-devel] [PULL 1/1] xen: use native disk xenbus protocol if possible X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Juergen Gross The qdisk implementation is using the native xenbus protocol only in case of no protocol specified at all. As using the explicit 32- or 64-bit protocol is slower than the native one due to copying requests not by memcpy but element for element, this is not optimal. Correct this by using the native protocol in case word sizes of frontend and backend match. Signed-off-by: Juergen Gross Reviewed-by: Anthony PERARD Signed-off-by: Stefano Stabellini --- hw/block/xen_disk.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 3b8ad33..3428689 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -976,14 +976,16 @@ static int blk_connect(struct XenDevice *xendev) blkdev->feature_persistent = !!pers; } - blkdev->protocol = BLKIF_PROTOCOL_NATIVE; - if (blkdev->xendev.protocol) { - if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) { - blkdev->protocol = BLKIF_PROTOCOL_X86_32; - } - if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) { - blkdev->protocol = BLKIF_PROTOCOL_X86_64; - } + if (!blkdev->xendev.protocol) { + blkdev->protocol = BLKIF_PROTOCOL_NATIVE; + } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_NATIVE) == 0) { + blkdev->protocol = BLKIF_PROTOCOL_NATIVE; + } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_32) == 0) { + blkdev->protocol = BLKIF_PROTOCOL_X86_32; + } else if (strcmp(blkdev->xendev.protocol, XEN_IO_PROTO_ABI_X86_64) == 0) { + blkdev->protocol = BLKIF_PROTOCOL_X86_64; + } else { + blkdev->protocol = BLKIF_PROTOCOL_NATIVE; } blkdev->sring = xengnttab_map_grant_ref(blkdev->xendev.gnttabdev,