From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [119.145.14.65]) by dpdk.org (Postfix) with ESMTP id 1CEBA106A for ; Tue, 29 Nov 2016 14:17:35 +0100 (CET) Received: from 172.24.1.137 (EHLO szxeml433-hub.china.huawei.com) ([172.24.1.137]) by szxrg02-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DRL57449; Tue, 29 Nov 2016 21:17:32 +0800 (CST) Received: from [127.0.0.1] (10.177.20.223) by szxeml433-hub.china.huawei.com (10.82.67.210) with Microsoft SMTP Server id 14.3.235.1; Tue, 29 Nov 2016 21:17:28 +0800 To: References: <1474604007-5221-1-git-send-email-yuanhan.liu@linux.intel.com> <1475998080-4644-1-git-send-email-yuanhan.liu@linux.intel.com> <1475998080-4644-3-git-send-email-yuanhan.liu@linux.intel.com> From: linhaifeng Message-ID: <583D7F44.3050908@huawei.com> Date: Tue, 29 Nov 2016 21:14:44 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: <1475998080-4644-3-git-send-email-yuanhan.liu@linux.intel.com> Content-Type: text/plain; charset="gbk" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.177.20.223] X-CFilter-Loop: Reflected Subject: Re: [dpdk-dev] [PATCH v3 2/7] vhost: get guest/host physical address mappings X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 29 Nov 2016 13:17:38 -0000 ÔÚ 2016/10/9 15:27, Yuanhan Liu дµÀ: > +static void > +add_guest_pages(struct virtio_net *dev, struct virtio_memory_region *reg, > + uint64_t page_size) > +{ > + uint64_t reg_size = reg->size; > + uint64_t host_user_addr = reg->host_user_addr; > + uint64_t guest_phys_addr = reg->guest_phys_addr; > + uint64_t host_phys_addr; > + uint64_t size; > + > + host_phys_addr = rte_mem_virt2phy((void *)(uintptr_t)host_user_addr); > + size = page_size - (guest_phys_addr & (page_size - 1)); > + size = RTE_MIN(size, reg_size); Have you use 1G hugepage to create a VM with 25G memory? When I try, vhost crashed, use below code fixed: - size = page_size - (guest_phys_addr & (page_size - 1)); - size = RTE_MIN(size, reg_size); + size = reg_size % page_size;