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=-17.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham 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 1879DC433E0 for ; Thu, 25 Feb 2021 17:30:59 +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 9EE5D64F20 for ; Thu, 25 Feb 2021 17:30:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9EE5D64F20 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=citrix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.89881.169742 (Exim 4.92) (envelope-from ) id 1lFKTA-0004nF-G3; Thu, 25 Feb 2021 17:30:32 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 89881.169742; Thu, 25 Feb 2021 17:30:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lFKTA-0004n8-D4; Thu, 25 Feb 2021 17:30:32 +0000 Received: by outflank-mailman (input) for mailman id 89881; Thu, 25 Feb 2021 17:30:31 +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.92) (envelope-from ) id 1lFKT9-0004n3-96 for xen-devel@lists.xenproject.org; Thu, 25 Feb 2021 17:30:31 +0000 Received: from esa4.hc3370-68.iphmx.com (unknown [216.71.155.144]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 4b4cc6a0-968e-4a6d-846e-ab33cdf14b86; Thu, 25 Feb 2021 17:30:30 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 4b4cc6a0-968e-4a6d-846e-ab33cdf14b86 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=citrix.com; s=securemail; t=1614274230; h=subject:to:cc:references:from:message-id:date: in-reply-to:content-transfer-encoding:mime-version; bh=zTXBL6wvcVLi1sVQaiP/6gIyNSA3VsLUSxgimK5THA0=; b=Teecy4+Djr4jY0V+TDDoPQGULhrI8RcvrM5j9hxoew2w788BtA7c7od3 x02Ee4+/eeKTdCpl1Kzh2RMi60KyqUj37HG2qt7UDJeH52GUfwbgrohvn kOuQyqBF5kpX3ziEkAzTyheg/E8m8LihJQvFAkF8igvn3Cp0nDRvXYfv8 k=; Authentication-Results: esa4.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com IronPort-SDR: gSIKiFCzRJmIea7cXePnFdofIoLVGidRly/gCaC4OlEvU1qi0R9BDQYqxUJiORYvbxbRRljVTq YmRpDoa93P3Q1G2SlATkF04ERHD75trrptGuDSvEJlIwZ1AcUzV3zqXPMTSUTuWZ0D4hrhY2kR xtQ2FYG6El97yygKqVlvXSQQbQq5h6qYiiwRfdcuQH7G6ADgjRiEA4uUnIPx8ioEwisOWUTMFX GFpZvq9BaeZXA+CTzWChQoaGyyqA7/ikln92tJeSAHVf50ZNfE71w5hcoAe0IYJ6cka2laKJzQ auA= X-SBRS: 5.2 X-MesageID: 39434610 X-Ironport-Server: esa4.hc3370-68.iphmx.com X-Remote-IP: 162.221.156.83 X-Policy: $RELAYED X-IronPort-AV: E=Sophos;i="5.81,206,1610427600"; d="scan'208";a="39434610" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gn2yVX9MGqcWvT12cxG6paRC2mcjWd04qpzDltIRH4Wd9hS7cly58Wh97X6AqNUB1Mdw/6pE/cOl+7phkCdB9GJxZNRNtQCf7DNh18TogZ7WhkKf97KMsJnTC6PhZJchoqN4sU+pu6OJ2woqLgtdR6Ufhf/oEbVhz4oqK1Ps/MJ656l9kJFAT9OQIzYB2q4PltFe7+RSgxfxWoK3VEJxB9vKvqRuXjpZRQFwWD90FD4/PInasozaSs7VblVj5TSZCgKQxwFVboG3nwHTgndmafkpeCa+cehyZk6HxmNkJh5I7fZacpApMkcPp+D4EBtq14YWyT3mAKohlrk4/97H0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GJMxrc93AYfTb0W2zQjsUvm/jjcfAHB6Z4+rCGsFggo=; b=d5AoX1Q7nAeaxquOzSm19FDGjoCd2tbFtfT/pk5DzHwn1WW3vMUt7qaigWp7HbJX9P9ZkBYQvG4NeEVV3JAFwP78x5ugkSBMr0FRiVZxaOlwADahEn5wUjpsUq5AIrK6Jx7dgFX9X4BubVDjwOPADEI8myWyHE2tGAtOcBXJkFdGELEQAa6WtQ/rHTyWhrrqiT7dWaOyn/tzf1OFds1oyCA3LqmKxGO6P1NYE9Zb0Q3/Osn0PsjLIchR8N5U36kGrnbyLAWm0UNzpVa9ld0Dz/6kRAPjQF7SCKivxdGUBgrI3zcJ9vc9aNamBJzgLqESC3A5dTplmoUw5DtQ+wxxJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.onmicrosoft.com; s=selector2-citrix-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=GJMxrc93AYfTb0W2zQjsUvm/jjcfAHB6Z4+rCGsFggo=; b=oD+8IfIhN7D3x9N14vxBPAclVw6tWqo6gJQBu89oIEoXvemZ0g310x8MwZ/fhmKsZYIOp7sj771UDiIfIJz8US2TWv72/Iuuen6DBsP8zewuf351AO2hPWxbKCUjcFaELeNTER+n/F0Ex6y1MKbGsrm0ONz/MAGtpuPP9x/VfyE= Subject: Re: [PATCH for-4.15] dmop: Add XEN_DMOP_nr_vcpus To: Ian Jackson CC: Xen-devel , Jan Beulich , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Wei Liu , Paul Durrant , Stefano Stabellini , Julien Grall , Volodymyr Babchuk References: <20210225170946.4297-1-andrew.cooper3@citrix.com> <24631.56478.814418.802877@mariner.uk.xensource.com> From: Andrew Cooper Message-ID: <12e99519-201a-89c2-eb4e-b67e1d1d3849@citrix.com> Date: Thu, 25 Feb 2021 17:30:18 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 In-Reply-To: <24631.56478.814418.802877@mariner.uk.xensource.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Content-Language: en-GB X-ClientProxiedBy: LO2P265CA0349.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:d::25) To BYAPR03MB3623.namprd03.prod.outlook.com (2603:10b6:a02:aa::12) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: a7fd6819-730f-4c27-a33b-08d8d9b30a3c X-MS-TrafficTypeDiagnostic: BYAPR03MB4808: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 062pv/7wlOnHGKOrkI/7hO/8HVPx8L0ThWx3Lcstm15eKuF3TGSOicg3C1rxtTQ07m7D0A9vHBMuLXLwmC34US19Zhr+B7mwPBIBfj+mMrHqdEOO50VbOVw19ChvkATgbGVyadtOse+LxkRSjy5XxPyud8jMmbE3FTBEn1aDHx0/DyFFPAu6cNG4dGU27EUcPJGlJg+C8mQEM2Us7+9OdVEfYguFB5PEGr5i5T37Qt4Kqfbs6P408eE8fXbwdGzUIRjBRzr1Se9qspjauSBy4SOXiynaJ1g9wae5Jc9o9WGvrO1HOtBIjdmAoduT3ZSDC99OsIUgAgBwEHYdxv30XKjlT0BUV1oTML9PSz2S2CpZ1COv6d0mvtCWcKNS/46D8ykOY9FHuZT1rEasIaZjdN05BWHFymQZghgOC4X80VkGxzRMkqUz3usiee+Cg/EKg9Z6CeJx8c50hnLobb2lyWGYob0BS7u6KOEvVZwmNLWbXtlPnQBu1WeUyeJlIT+SgG3v+QCaFMkGAohlrfM8ddVpfRE+73gcIeGnUolFzs9WxdCeYGHrnQ5NKEEXC/E/hBrFHNjgomijhWJgNYZWoynlyPfexk9bHQGXY9VFREM= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR03MB3623.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(366004)(376002)(136003)(346002)(39860400002)(2616005)(6666004)(36756003)(31696002)(31686004)(6916009)(6486002)(26005)(83380400001)(86362001)(4326008)(16576012)(478600001)(66556008)(956004)(5660300002)(8936002)(53546011)(66476007)(2906002)(54906003)(66946007)(186003)(8676002)(16526019)(316002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-Anti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o7yyFw+Xvr3TJ5O?= X-MS-Exchange-CrossTenant-Network-Message-Id: a7fd6819-730f-4c27-a33b-08d8d9b30a3c X-MS-Exchange-CrossTenant-AuthSource: BYAPR03MB3623.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Feb 2021 17:30:26.8423 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335836de-42ef-43a2-b145-348c2ee9ca5b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: eBAHpfu2YAkNhtTlhA7O+lQtqihX0zdI4eOp0EGU2TgtDzNuAN9a3hfxxEZGdOK0Ag6oyMyKDLlm6m9K+OU+l2FUQ2yKZMh08gistzH0/mM= X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR03MB4808 X-OriginatorOrg: citrix.com On 25/02/2021 17:21, Ian Jackson wrote: > Andrew Cooper writes ("[PATCH for-4.15] dmop: Add XEN_DMOP_nr_vcpus"): >> Curiously absent from the stable API/ABIs is an ability to query the number of >> vcpus which a domain has. Emulators need to know this information in >> particular to know how many stuct ioreq's live in the ioreq server mappings. >> >> In practice, this forces all userspace to link against libxenctrl to use >> xc_domain_getinfo(), which rather defeats the purpose of the stable libraries. > Wat Yeah...  My reaction was similar. > >> For 4.15. This was a surprise discovery in the massive ABI untangling effort >> I'm currently doing for XenServer's new build system. > Given that this is a new feature at a late stage I am going to say > this: > > I will R-A it subject to it getting *two* independent Reviewed-by. > > I will try to one of them myself :-). > > ... > >> +/* >> + * XEN_DMOP_nr_vcpus: Query the number of vCPUs a domain has. >> + * >> + * The number of vcpus a domain has is fixed from creation time. This bound >> + * is applicable to e.g. the vcpuid parameter of XEN_DMOP_inject_event, or >> + * number of struct ioreq objects mapped via XENMEM_acquire_resource. > AIUI from the code, the value is the maximum number of vcpus, in the > sense that they are not necessarily all online. In which case I think > maybe you want to mention that here ? Yeah - there is no guarantee that they're all online, or running. Emulators tend to attach before the domain starts executing anyway.  The important thing they need to do is loop through each struct ioreq in the ioreq_server mapping to read the domid and bind the per-vcpu event channel for notification of work to do. The totally gross way of not needing this API is to scan through the mapping and identify the first struct ioreq which has 0 listed for an event channel, which is not a construct I wish to promote. > >> diff --git a/xen/include/xlat.lst b/xen/include/xlat.lst >> index 398993d5f4..cbbd20c958 100644 >> --- a/xen/include/xlat.lst >> +++ b/xen/include/xlat.lst >> @@ -107,6 +107,7 @@ >> ? dm_op_set_pci_intx_level hvm/dm_op.h >> ? dm_op_set_pci_link_route hvm/dm_op.h >> ? dm_op_track_dirty_vram hvm/dm_op.h >> +? dm_op_nr_vcpus hvm/dm_op.h >> ! hvm_altp2m_set_mem_access_multi hvm/hvm_op.h >> ? vcpu_hvm_context hvm/hvm_vcpu.h >> ? vcpu_hvm_x86_32 hvm/hvm_vcpu.h >> -- > I have no idea what even. I read the comment at the top of the file. > > So for *everything except the xlat.lst change* > Reviewed-by: Ian Jackson Thanks. This is the magic to make this hunk: @@ -641,6 +651,7 @@ CHECK_dm_op_map_mem_type_to_ioreq_server;  CHECK_dm_op_remote_shutdown;  CHECK_dm_op_relocate_memory;  CHECK_dm_op_pin_memory_cacheattr; +CHECK_dm_op_nr_vcpus;    int compat_dm_op(domid_t domid,                   unsigned int nr_bufs, work, to do a build time check that the structure is identical between 32bit and 64bit builds. ~Andrew