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=-0.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 E533AC43331 for ; Thu, 26 Mar 2020 08:43:34 +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 B20CE20719 for ; Thu, 26 Mar 2020 08:43:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=citrix.com header.i=@citrix.com header.b="cqqXD9Jq" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B20CE20719 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=citrix.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 1jHO6U-0002MB-Rx; Thu, 26 Mar 2020 08:43:06 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jHO6S-0002M6-Ug for xen-devel@lists.xenproject.org; Thu, 26 Mar 2020 08:43:04 +0000 X-Inumbo-ID: cc9c7e0c-6f3d-11ea-8776-12813bfff9fa Received: from esa3.hc3370-68.iphmx.com (unknown [216.71.145.155]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id cc9c7e0c-6f3d-11ea-8776-12813bfff9fa; Thu, 26 Mar 2020 08:43:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1585212181; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=kCaUVrjU8cJ/V48DnC1tNTmeEiNtZ0OKK4BBirTkpBg=; b=cqqXD9JqbpEKTgS2uLgfj0+bk97OZ8muULLQObep9R+ngO1aMu3uNmRD hUnIlxsVDUk73KDeSThpP5d/bcxzcqYDanDf8k4Dqgh4olV/sNtgb9VAo 3Qpx9iurf5oUwlT8SttJO50FvnChP9u+ediMt49hMYZH+Xd2ZxS+Gsz77 c=; Authentication-Results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none; spf=None smtp.pra=roger.pau@citrix.com; spf=Pass smtp.mailfrom=roger.pau@citrix.com; spf=None smtp.helo=postmaster@mail.citrix.com Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of roger.pau@citrix.com) identity=pra; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible Received-SPF: Pass (esa3.hc3370-68.iphmx.com: domain of roger.pau@citrix.com designates 162.221.158.21 as permitted sender) identity=mailfrom; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="roger.pau@citrix.com"; x-conformance=sidf_compatible; x-record-type="v=spf1"; x-record-text="v=spf1 ip4:209.167.231.154 ip4:178.63.86.133 ip4:195.66.111.40/30 ip4:85.115.9.32/28 ip4:199.102.83.4 ip4:192.28.146.160 ip4:192.28.146.107 ip4:216.52.6.88 ip4:216.52.6.188 ip4:162.221.158.21 ip4:162.221.156.83 ip4:168.245.78.127 ~all" Received-SPF: None (esa3.hc3370-68.iphmx.com: no sender authenticity information available from domain of postmaster@mail.citrix.com) identity=helo; client-ip=162.221.158.21; receiver=esa3.hc3370-68.iphmx.com; envelope-from="roger.pau@citrix.com"; x-sender="postmaster@mail.citrix.com"; x-conformance=sidf_compatible IronPort-SDR: r2HjN4gOGTct0Ooa+4Zh4bykVwC4TTAV7wmqB0bdu1i5L4W+e5Z3sZR4G1/HorwkisD1F3yi6b Y3CJDFmU0Yzmlcm6vlOGNaV+I3WebXjajUglDpV9PgF4lu0oYnCBUSsuvsfHwmRrb7HErCgdSs qJU/BrtH8vPiNnrZY+W1Xwv4bqWf+HaXlP1xadpF9dY3Iv+4CJ2SSTrAxa88xlWCHxr8M30Dkq 38odQAknCVuYphcTi7vOlQc53WNAOzsswpoCeLoYFsIStmeDqeoaFZfsinqBQDSlzrg2zItJfT 884= X-SBRS: 2.7 X-MesageID: 14649783 X-Ironport-Server: esa3.hc3370-68.iphmx.com X-Remote-IP: 162.221.158.21 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.72,307,1580792400"; d="scan'208";a="14649783" Date: Thu, 26 Mar 2020 09:42:50 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: Jan Beulich Message-ID: <20200326084250.GH28601@Air-de-Roger> References: <20200325154702.GD28601@Air-de-Roger> <20200325165444.GF28601@Air-de-Roger> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: AMSPEX02CAS01.citrite.net (10.69.22.112) To AMSPEX02CL02.citrite.net (10.69.22.126) 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 Thu, Mar 26, 2020 at 08:02:22AM +0100, Jan Beulich wrote: > 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. Right, using unsigned long is indeed fine, but I also agree with Tamas that it's slightly ugly and hence wanted to provide a 'cleaner' suggestion. Roger.