From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <huawei.xie@intel.com>
Received: from mga03.intel.com (mga03.intel.com [134.134.136.65])
 by dpdk.org (Postfix) with ESMTP id 85B195683
 for <dev@dpdk.org>; Wed,  9 Dec 2015 06:44:15 +0100 (CET)
Received: from orsmga001.jf.intel.com ([10.7.209.18])
 by orsmga103.jf.intel.com with ESMTP; 08 Dec 2015 21:44:14 -0800
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.20,402,1444719600"; d="scan'208";a="837354143"
Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205])
 by orsmga001.jf.intel.com with ESMTP; 08 Dec 2015 21:44:14 -0800
Received: from fmsmsx123.amr.corp.intel.com (10.18.125.38) by
 fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS)
 id 14.3.248.2; Tue, 8 Dec 2015 21:44:14 -0800
Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by
 fmsmsx123.amr.corp.intel.com (10.18.125.38) with Microsoft SMTP Server (TLS)
 id 14.3.248.2; Tue, 8 Dec 2015 21:44:14 -0800
Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.138]) by
 SHSMSX152.ccr.corp.intel.com ([169.254.6.193]) with mapi id 14.03.0248.002;
 Wed, 9 Dec 2015 13:44:11 +0800
From: "Xie, Huawei" <huawei.xie@intel.com>
To: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Thread-Topic: [PATCH 2/4] vhost: introduce vhost_log_write
Thread-Index: AdEyMldEwGHDAPhjRAm0JwFAYWponA==
Date: Wed, 9 Dec 2015 05:44:11 +0000
Message-ID: <C37D651A908B024F974696C65296B57B4BB82FE6@SHSMSX103.ccr.corp.intel.com>
References: <1449027793-30975-1-git-send-email-yuanhan.liu@linux.intel.com>
 <1449027793-30975-3-git-send-email-yuanhan.liu@linux.intel.com>
 <20151202153050-mutt-send-email-victork@redhat.com>
 <C37D651A908B024F974696C65296B57B4BB82C2D@SHSMSX103.ccr.corp.intel.com>
 <20151209034251.GM29571@yliu-dev.sh.intel.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-originating-ip: [10.239.127.40]
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Cc: "dev@dpdk.org" <dev@dpdk.org>, Victor Kaplansky <victork@redhat.com>,
 "Michael S. Tsirkin" <mst@redhat.com>
Subject: Re: [dpdk-dev] [PATCH 2/4] vhost: introduce vhost_log_write
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Wed, 09 Dec 2015 05:44:15 -0000

On 12/9/2015 11:41 AM, Yuanhan Liu wrote:=0A=
> On Wed, Dec 09, 2015 at 03:33:16AM +0000, Xie, Huawei wrote:=0A=
> ...=0A=
>>>> +static inline void __attribute__((always_inline))=0A=
>>>> +vhost_log_write(struct virtio_net *dev, struct vhost_virtqueue *vq,=
=0A=
>>>> +		uint64_t offset, uint64_t len)=0A=
>>>> +{=0A=
>>>> +	uint64_t addr =3D vq->log_guest_addr;=0A=
>>>> +	uint64_t page;=0A=
>>>> +=0A=
>>>> +	if (unlikely(((dev->features & (1ULL << VHOST_F_LOG_ALL)) =3D=3D 0) =
||=0A=
>>>> +		     !dev->log_base || !len))=0A=
>>>> +		return;=0A=
>>> Isn't "likely" more appropriate in above, since the whole=0A=
>>> expression is expected to be true most of the time?=0A=
>> Victor:=0A=
>> So we are not always logging, what is the message that tells the backend=
=0A=
>> the migration is started?=0A=
> When log starts, VHOST_USER_SET_FEATURES request will be sent again,=0A=
> with VHOST_F_LOG_ALL feature bit set.=0A=
As the VHOST_USER_SET_FEATURES handling and rx/tx runs asynchronously,=0A=
we have to make sure we don't miss logging anything when this feature is=0A=
set. For example, I doubt like in virtio_dev_rx, is the dev->features=0A=
volatile?=0A=
> 	--yliu=0A=
>=0A=
=0A=