Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8B213C2D0E8 for ; Thu, 26 Mar 2020 07:02:46 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6B42620719 for ; Thu, 26 Mar 2020 07:02:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6B42620719 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jHMX4-00021V-RJ; Thu, 26 Mar 2020 07:02:26 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jHMX3-00021P-5S for xen-devel@lists.xenproject.org; Thu, 26 Mar 2020 07:02:25 +0000 X-Inumbo-ID: beb6cd78-6f2f-11ea-bec1-bc764e2007e4 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id beb6cd78-6f2f-11ea-bec1-bc764e2007e4; Thu, 26 Mar 2020 07:02:24 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 671CAAD06; Thu, 26 Mar 2020 07:02:23 +0000 (UTC) To: =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= References: <20200325154702.GD28601@Air-de-Roger> <20200325165444.GF28601@Air-de-Roger> From: Jan Beulich Message-ID: Date: Thu, 26 Mar 2020 08:02:22 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <20200325165444.GF28601@Air-de-Roger> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Subject: Re: [Xen-devel] [PATCH v12 1/3] xen/mem_sharing: VM forking X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Tamas K Lengyel , Tamas K Lengyel , Wei Liu , Andrew Cooper , Ian Jackson , George Dunlap , Stefano Stabellini , Xen-devel , Julien Grall Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On 25.03.2020 17:54, Roger Pau Monné wrote: > On Wed, Mar 25, 2020 at 04:42:07PM +0000, Julien Grall wrote: >> On 25/03/2020 16:34, Tamas K Lengyel wrote: >>>>> --- a/xen/common/domain.c >>>>> +++ b/xen/common/domain.c >>>>> @@ -1270,6 +1270,9 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) >>>>> >>>>> v->vcpu_info = new_info; >>>>> v->vcpu_info_mfn = page_to_mfn(page); >>>>> +#ifdef CONFIG_MEM_SHARING >>>>> + v->vcpu_info_offset = offset; >>>> >>>> There's no need to introduce this field, you can just use v->vcpu_info >>>> & ~PAGE_MASK AFAICT. >>> >>> Just doing what you suggest above results in: >>> >>> mem_sharing.c:1603:55: error: invalid operands to binary & (have >>> ‘vcpu_info_t * const’ {aka ‘union * const’} and ‘long >>> int’) >>> d_vcpu->vcpu_info & ~PAGE_MASK); >>> >>> I can of course cast the vcpu_info pointer to (long int), it's just a >>> bit ugly. Thoughts? >> >> FWIW, I will also need the offset for liveupdate. I have used (unsigned >> long)v->vcpu_info & ~PAGE_MASK so far but this is not really pretty. > > I think using: > > (vaddr_t)v->vcpu_info & ~PAGE_MASK > > is acceptable, but that would require adding a vaddr_t typedef to x86. I don't think vaddr_t is necessary given that all over the place we assume conversions between pointers and unsigned long to be fine. Jan