From patchwork Tue Jun 20 13:47:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paul Durrant X-Patchwork-Id: 9799583 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 E6B4B60329 for ; Tue, 20 Jun 2017 13:50:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B885E282E8 for ; Tue, 20 Jun 2017 13:50:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AC88C284B0; Tue, 20 Jun 2017 13:50: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 12EC328477 for ; Tue, 20 Jun 2017 13:50:22 +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 1dNJVk-0007Mm-L4; Tue, 20 Jun 2017 13:48:04 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dNJVk-0007MU-0J for xen-devel@lists.xenproject.org; Tue, 20 Jun 2017 13:48:04 +0000 Received: from [193.109.254.147] by server-4.bemta-6.messagelabs.com id 4B/AD-02956-39729495; Tue, 20 Jun 2017 13:48:03 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprIIsWRWlGSWpSXmKPExsXitHSDve4kdc9 Ig/6z5hbft0xmcmD0OPzhCksAYxRrZl5SfkUCa8acnsXMBQsEKk5c4Wtg7OHtYuTkkBDwl+j4 0cYGYrMJ6EhMfXqJFcQWEQiXeNx2iqmLkYuDWeAwo0TP/k4WkISwQLzEgc4jzCA2i4CqRNv5b YwgNq+AtcSWhgmMEEPlJXa1XQQbxClgI3Fj2XwmEFsIqObCrs9sELaKxPqps9ggegUlTs58Aj afWUBC4uCLF8wTGHlnIUnNQpJawMi0ilGjOLWoLLVI18hYL6koMz2jJDcxM0fX0MBMLze1uDg xPTUnMalYLzk/dxMjMHgYgGAH45/5gYcYJTmYlER5vZU9I4X4kvJTKjMSizPii0pzUosPMWpw cAj0rVl9gVGKJS8/L1VJgveRGlCdYFFqempFWmYOMLxhSiU4eJREeO+DpHmLCxJzizPTIVKnG BWlxHk5gVEhJACSyCjNg2uDxdQlRlkpYV5GoKOEeApSi3IzS1DlXzGKczAqCfMWgYznycwrgZ v+CmgxE9DiF0c8QBaXJCKkpBoYowp2br8t2XBGcJqQjFpbikSPXMcEhw0iah2yGj3hgl99tD7 LS3DcFS/7POfXJ+nHL5///8udueoZpxTngqkTXrzpWWw79fvBLZGL2RtvdFR9YX903nLia0Vx 0a5ny5by7PDonmLqpfFPptv53s25RWvFdrnvVVok/8Tw+ROew8qip698u1jXrMRSnJFoqMVcV JwIAKEZppWkAgAA X-Env-Sender: prvs=3370d2115=Paul.Durrant@citrix.com X-Msg-Ref: server-10.tower-27.messagelabs.com!1497966479!85381685!2 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 9.4.19; banners=-,-,- X-VirusChecked: Checked Received: (qmail 53159 invoked from network); 20 Jun 2017 13:48:02 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-10.tower-27.messagelabs.com with RC4-SHA encrypted SMTP; 20 Jun 2017 13:48:02 -0000 X-IronPort-AV: E=Sophos;i="5.39,364,1493683200"; d="scan'208";a="437138721" From: Paul Durrant To: , , Date: Tue, 20 Jun 2017 09:47:54 -0400 Message-ID: <20170620134756.9632-2-paul.durrant@citrix.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170620134756.9632-1-paul.durrant@citrix.com> References: <20170620134756.9632-1-paul.durrant@citrix.com> MIME-Version: 1.0 Cc: Anthony Perard , Kevin Wolf , Paul Durrant , Stefano Stabellini , Max Reitz Subject: [Xen-devel] [PATCH 1/3] xen-disk: only advertize feature-persistent if grant copy is not available 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: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP If grant copy is available then it will always be used in preference to persistent maps. In this case feature-persistent should not be advertized to the frontend, otherwise it may needlessly copy data into persistently granted buffers. Signed-off-by: Paul Durrant --- Cc: Stefano Stabellini Cc: Anthony Perard Cc: Kevin Wolf Cc: Max Reitz --- hw/block/xen_disk.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/hw/block/xen_disk.c b/hw/block/xen_disk.c index 3a22805fbc..9b06e3aa81 100644 --- a/hw/block/xen_disk.c +++ b/hw/block/xen_disk.c @@ -1023,11 +1023,18 @@ static int blk_init(struct XenDevice *xendev) blkdev->file_blk = BLOCK_SIZE; + blkdev->feature_grant_copy = + (xengnttab_grant_copy(blkdev->xendev.gnttabdev, 0, NULL) == 0); + + xen_pv_printf(&blkdev->xendev, 3, "grant copy operation %s\n", + blkdev->feature_grant_copy ? "enabled" : "disabled"); + /* fill info * blk_connect supplies sector-size and sectors */ xenstore_write_be_int(&blkdev->xendev, "feature-flush-cache", 1); - xenstore_write_be_int(&blkdev->xendev, "feature-persistent", 1); + xenstore_write_be_int(&blkdev->xendev, "feature-persistent", + !blkdev->feature_grant_copy); xenstore_write_be_int(&blkdev->xendev, "info", info); blk_parse_discard(blkdev); @@ -1202,12 +1209,6 @@ static int blk_connect(struct XenDevice *xendev) xen_be_bind_evtchn(&blkdev->xendev); - blkdev->feature_grant_copy = - (xengnttab_grant_copy(blkdev->xendev.gnttabdev, 0, NULL) == 0); - - xen_pv_printf(&blkdev->xendev, 3, "grant copy operation %s\n", - blkdev->feature_grant_copy ? "enabled" : "disabled"); - xen_pv_printf(&blkdev->xendev, 1, "ok: proto %s, ring-ref %d, " "remote port %d, local port %d\n", blkdev->xendev.protocol, blkdev->ring_ref,