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.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,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 27416C2BA2B for ; Fri, 10 Apr 2020 16:19:33 +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 E57C620857 for ; Fri, 10 Apr 2020 16:19:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=xen.org header.i=@xen.org header.b="DCddFyGi" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E57C620857 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=xen.org 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 1jMwNA-0004Ku-9z; Fri, 10 Apr 2020 16:19:16 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jMwN8-0004Kp-LP for xen-devel@lists.xenproject.org; Fri, 10 Apr 2020 16:19:14 +0000 X-Inumbo-ID: 048c0340-7b47-11ea-83d8-bc764e2007e4 Received: from mail.xenproject.org (unknown [104.130.215.37]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 048c0340-7b47-11ea-83d8-bc764e2007e4; Fri, 10 Apr 2020 16:19:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=xen.org; s=20200302mail; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID :Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe :List-Post:List-Owner:List-Archive; bh=bDuCXj6Cx3wsUo3dxC/aTCJROiZb6qW1qvw0uxTljl8=; b=DCddFyGiPCcxL9xILYKo+2wVIM 8sR1umK3vMYWZqReEJObF4iuFuWZQCDRUB0YpsJdYvYhJ+5Y2u/VAAr/ca0E5dD7zy8wfWivAsLAl NHAZXj+gqaIzKhFCry8i8V5Xu4vuqelXn1TDMN9aQaknij+IV6m/25bZ7rFcvWbFVdvY=; Received: from xenbits.xenproject.org ([104.239.192.120]) by mail.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jMwN3-0002Kc-6J; Fri, 10 Apr 2020 16:19:09 +0000 Received: from 44.142.6.51.dyn.plus.net ([51.6.142.44] helo=debian) by xenbits.xenproject.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1jMwN2-00058T-Tf; Fri, 10 Apr 2020 16:19:09 +0000 Date: Fri, 10 Apr 2020 17:19:06 +0100 From: Wei Liu To: Tamas K Lengyel Subject: Re: [PATCH v14 3/3] xen/tools: VM forking toolstack side Message-ID: <20200410161906.tjonj2btem5nqkpp@debian> References: <6d63f89124c7445be3185ab6722992b707dab72b.1586186121.git.tamas.lengyel@intel.com> <20200409154243.6ouh7r37fwm32mjg@debian> <20200409162159.cb2h7a6tmkbaduay@debian> <20200409171113.cajvhjlftadqqq73@debian> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 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: Anthony PERARD , Xen-devel , Tamas K Lengyel , Ian Jackson , Wei Liu Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" On Fri, Apr 10, 2020 at 10:05:50AM -0600, Tamas K Lengyel wrote: > On Thu, Apr 9, 2020 at 11:30 AM Tamas K Lengyel > wrote: > > > > On Thu, Apr 9, 2020 at 11:11 AM Wei Liu wrote: > > > > > > On Thu, Apr 09, 2020 at 10:59:55AM -0600, Tamas K Lengyel wrote: > > > [...] > > > > > > > > > > > > > > > > > > > > > > > > > > > +/* > > > > > > > > + * The parent domain is expected to be created with default settings for > > > > > > > > + * - max_evtch_port > > > > > > > > + * - max_grant_frames > > > > > > > > + * - max_maptrack_frames > > > > > > > > + */ > > > > > > > > +int libxl_domain_fork_vm(libxl_ctx *ctx, uint32_t pdomid, uint32_t max_vcpus, uint32_t *domid) > > > > > > > > +{ > > > > > > > > + int rc; > > > > > > > > + struct xen_domctl_createdomain create = {0}; > > > > > > > > + create.flags |= XEN_DOMCTL_CDF_hvm; > > > > > > > > + create.flags |= XEN_DOMCTL_CDF_hap; > > > > > > > > + create.flags |= XEN_DOMCTL_CDF_oos_off; > > > > > > > > + create.arch.emulation_flags = (XEN_X86_EMU_ALL & ~XEN_X86_EMU_VPCI); > > > > > > > > + create.ssidref = SECINITSID_DOMU; > > > > > > > > + create.max_vcpus = max_vcpus; > > > > > > > > > > > > > > > > > > > > > Some questions: > > > > > > > > > > > > > > Why does the caller need to specify the number of vcpus? > > > > > > > > > > > > > > Since the parent (source) domain is around, can you retrieve its domain > > > > > > > configuration such that you know its max_vcpus and other information > > > > > > > including max_evtchn_port and maptrack frames? > > > > > > > > > > > > Because we want to avoid having to issue an extra hypercall for these. > > > > > > Normally these pieces of information will be available for the user > > > > > > and won't change, so we save time by not querying for it every time a > > > > > > fork is created. Remember, we might be creating thousands of forks in > > > > > > a very short time, so those extra hypercalls add up. > > > > > > > > > > I see. Speed is a big concern to you. > > > > > > > > > > What I was referring to doesn't require issuing hypercalls but requires > > > > > calling libxl_retrieve_domain_configuration. That's likely to be even > > > > > slower than making a hypercall. > > > > > > > > Right. We only want to parse the domain config if the device model is > > > > being launched. > > > > > > > > > > > > > > I'm afraid the current incarnation of libxl_domain_fork_vm cannot become > > > > > supported (as in Xen's support statement) going forward, because it is > > > > > leaky. > > > > > > > > What do you mean by leaky? > > > > > > It requires the caller to specify the number of max_vcpus. The reason > > > for doing that is because you want to avoid extra hypercall(s). There is > > > nothing that stops someone from coming along in the future claiming some > > > other parameters are required because of the same concern you have > > > today. It is an optimisation, not a must-have in terms of functionality. > > > > > > To me the number shouldn't be specified by the caller in the first > > > place. It is like forking a process somehow requires you to specify how > > > many threads it will have. > > > > I agree. It's not how I wanted to have the interface work but > > unfortunately this was the least "ugly" of the possible solutions > > given the circumstances. > > By the way, it would be trivial to query the parent in case max_vcpus > is not provided by the user. But I would still like to keep the option > available to skip that step if the number is known already. Let me > know if you would like me to add that. I'm still waiting for Ian and Anthony to chime in to see whether they agree to keep this interface unstable. At the end of the day, if it is unstable, I don't really care that much. I'm happy to let you (the developer and user) have more say in that case. I will instead divert my (limited) time to code that your patch touches which is also used by other stable functions. Wei. > > Thanks, > Tamas