From mboxrd@z Thu Jan 1 00:00:00 1970 Received: by 2002:a17:504:9188:b0:1be9:327d:8ee3 with SMTP id i8csp1398725njf; Fri, 16 Aug 2024 17:45:58 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUngINMNCLw/J00UL0uLCEeH+F23EmtFsaOd069pDQzgWtuiXC38tp5KqYw/gGe+1/wVYksYyPs52XDtA==@linaro.org X-Google-Smtp-Source: AGHT+IEFRng9NzxujHzT/Z/fDTKLQszBHAek5yxgXUSaZ5RiCJWPXymg4s5QSQZaMA48gEpR/Xa+ X-Received: by 2002:a05:6808:18a1:b0:3da:a032:24c5 with SMTP id 5614622812f47-3dd3ad2f9c6mr4956101b6e.22.1723855558788; Fri, 16 Aug 2024 17:45:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1723855558; cv=pass; d=google.com; s=arc-20160816; b=INI1d+NIDJlX82TRQx9ke3er34nPWchvxKz7AiMzMhYvJfenwktCX4nVO/hxIN+ZR+ eZ/he03f0ntH5NchKel7/1jtoFmXY7byO/r0VI6YGVEFZI2czUpN59BIiq4q9puhQ2Sw FT5jOuWzM0hByliPgZOoMpc1e1PHWK4qezfD6vWCF7ylEsIzTnIOZ4PfnuKBHrvgJQdc SfVL4IXHQsfnjG471i/pn0ExBU48akX1mUq7IIYCrPO7Y3oavDKoCrocYWrkXEekQG9J TjEWRbis/7G8h7hBfZ6GJMfIM+gWNCz4VYkT1kOsiQz5SzpC/Nx77McWfmg8YAmHj4ii DIiw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :dkim-signature; bh=m4SVgnne9erkuAhrAeM3VCVOKRFMY2Is89F35hd+2Sk=; fh=l5QszxWMWNP+ZFnHgaGYNhEtT9hb7KqcJ85KXFuefz8=; b=kBo0/fFAiHSUW5a/egjEwQkcGmVuK8N+QWs9Oc/+bJ5Oa4ReQpvDsY9XJbBq9zabB3 hbBpJW26eDbfsVbNd7gjS0UIYUt0J7QKzIqJV2mQTrdUJEy2zx4Ug869OrfdfaP3KQM6 niP8GBjZl2RS+gz/u/3nFJo/gNRYW/eoa9HDPVbx20k6yVXwgaTFQ6Aqqt8N0mQ3xKFf cpHM1zfCLqPVYZ+9gMGCGLFEewtm4ogqn2fDMLgDOEV0J8LIBduXqy1RUp+PaxRUmWSc qOBxC+y35Y5DY3etYU+4osz8tz9n/iHuCd1IBtRRMxi4VFQXarlr/HIpJ9XH5HWSD71L 0PZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=yyKe+f4O; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of jason.andryuk@amd.com designates 2a01:111:f403:2414::614 as permitted sender) smtp.mailfrom=Jason.Andryuk@amd.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on20614.outbound.protection.outlook.com. [2a01:111:f403:2414::614]) by mx.google.com with ESMTPS id 41be03b00d2f7-7c6b61a8a1csi4566033a12.82.2024.08.16.17.45.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2024 17:45:58 -0700 (PDT) Received-SPF: pass (google.com: domain of jason.andryuk@amd.com designates 2a01:111:f403:2414::614 as permitted sender) client-ip=2a01:111:f403:2414::614; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b=yyKe+f4O; arc=pass (i=1 spf=pass spfdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of jason.andryuk@amd.com designates 2a01:111:f403:2414::614 as permitted sender) smtp.mailfrom=Jason.Andryuk@amd.com; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F8vrRC7roj99wmz41J6BY5Y2/SHa85GIugxghpM64KHak6LADmf7INUNpMCe0ntQU//bLG19qT8j/deMG0cHAphj6uDeUxpTY9LkJCWugau/WYukJ6JlEWQcGNDhHyw6Eb3XZ6eV8fgv7OcF7OCZZYy42Y4+p27qwGHO7FlY7EzqHtTtajvuxZwl8nunpPGmekS006W+RsgybZnkHsL7R6ABraH4Quw5T5jMufNDz4GJHXrHjHey71PdakVd1yIB6R3lTbdH7lDWt+tRVqirmCwu2scYzmaghJpZOfwFTiUVtrrtf+AV6uYwYRkeF93sGOXDCagXwD/2WP0OOHRoXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=m4SVgnne9erkuAhrAeM3VCVOKRFMY2Is89F35hd+2Sk=; b=cPfOm+jmZ25g1hPXYcCsoWQGD7wSYrL6ypUPgO0k/Pb+1acw4OVQaMn4ViQxVVkpoMXZ54T5JeQlHP1Lmcrjasvuo+7jsaWKQCGQjQrlsBdKnlWUo8JPUNiw1+cm1JHFL4dVndkqTue87rJsKEwwQPoXgJ+hwXNSV/JMl10K1ERpjx0oWQvfSOShYm49cBSrqWKM8qR/HbvlBSzwuRJmkhG7GseIXWxOF/3AyVQcUyRJm3Fq57c0BasdNPa6w+SlqU9yzPiOUbOZEEzplbRk1/kBryBRdCLijKqROJ3nbTELfGxly9kWm9VN/TKaDnliDtq1vAsprzYW44TomNNjhQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=kernel.org smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=m4SVgnne9erkuAhrAeM3VCVOKRFMY2Is89F35hd+2Sk=; b=yyKe+f4OwTp3AbVgJbDKlFsVXBIeDFU4JTkfv34I+I96d0YRfxFOc6iQzyqW5B02vYhnbBJ6dBXjoSWqWgwADYjYkg0BokTQmOYEwgpspcB0YXITk4Guv8N9T4keFnmdBDRZiBKLZO1r5U4YfdiiI9vg0F1FVvbetqx0wo6IgXE= Received: from BN9PR03CA0709.namprd03.prod.outlook.com (2603:10b6:408:ef::24) by LV3PR12MB9412.namprd12.prod.outlook.com (2603:10b6:408:211::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.20; Sat, 17 Aug 2024 00:45:53 +0000 Received: from BL6PEPF00020E63.namprd04.prod.outlook.com (2603:10b6:408:ef:cafe::3c) by BN9PR03CA0709.outlook.office365.com (2603:10b6:408:ef::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.19 via Frontend Transport; Sat, 17 Aug 2024 00:45:53 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB03.amd.com; pr=C Received: from SATLEXMB03.amd.com (165.204.84.17) by BL6PEPF00020E63.mail.protection.outlook.com (10.167.249.24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7849.8 via Frontend Transport; Sat, 17 Aug 2024 00:45:53 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 16 Aug 2024 19:45:48 -0500 Received: from SATLEXMB04.amd.com (10.181.40.145) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Fri, 16 Aug 2024 19:45:45 -0500 Received: from [172.24.94.179] (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Fri, 16 Aug 2024 19:45:45 -0500 Message-ID: <93de8d6d-6123-4038-a566-d134206ba608@amd.com> Date: Fri, 16 Aug 2024 18:58:26 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 04/10] hw/arm: xenpvh: Add support for SMP guests To: Stefano Stabellini , "Edgar E. Iglesias" CC: , , , , , , , , , References: <20240812130606.90410-1-edgar.iglesias@gmail.com> <20240812130606.90410-5-edgar.iglesias@gmail.com> Content-Language: en-US From: Jason Andryuk In-Reply-To: Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit Return-Path: Jason.Andryuk@amd.com X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF00020E63:EE_|LV3PR12MB9412:EE_ X-MS-Office365-Filtering-Correlation-Id: ba8e23ee-e94c-44f2-3cd6-08dcbe55f2a5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|1800799024|7416014|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?OXBSTWZPd2lwZ3FaZWh2Tk9UZXo3VnVSeXkvMWl5cngwNWZOZXErQSt4Nmo5?= =?utf-8?B?Q0ozNXhaM1VoT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XZsams2MVM1RlBEUWxmMWwyV21YbzVOOER0RHFGRXZaN0gvZVRq?= =?utf-8?Q?20ss47yP/frVMvZbzfb+u/lvoXVO/JWk?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB03.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(1800799024)(7416014)(36860700013)(376014);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Aug 2024 00:45:53.1399 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ba8e23ee-e94c-44f2-3cd6-08dcbe55f2a5 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB03.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF00020E63.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9412 X-TUID: KB++6juHwgK9 On 2024-08-16 12:53, Stefano Stabellini wrote: > On Fri, 16 Aug 2024, Edgar E. Iglesias wrote: >> On Thu, Aug 15, 2024 at 2:30 AM Stefano Stabellini wrote: >> On Wed, 14 Aug 2024, Edgar E. Iglesias wrote: >> > On Tue, Aug 13, 2024 at 03:52:32PM -0700, Stefano Stabellini wrote: >> > > On Tue, 13 Aug 2024, Edgar E. Iglesias wrote: >> > > > On Mon, Aug 12, 2024 at 06:47:17PM -0700, Stefano Stabellini wrote: >> > > > > On Mon, 12 Aug 2024, Edgar E. Iglesias wrote: >> > > > > > From: "Edgar E. Iglesias" >> > > > > > >> > > > > > Add SMP support for Xen PVH ARM guests. Create max_cpus ioreq >> > > > > > servers to handle hotplug. >> > > > > > >> > > > > > Signed-off-by: Edgar E. Iglesias >> > > > > > --- >> > > > > >  hw/arm/xen_arm.c | 5 +++-- >> > > > > >  1 file changed, 3 insertions(+), 2 deletions(-) >> > > > > > >> > > > > > diff --git a/hw/arm/xen_arm.c b/hw/arm/xen_arm.c >> > > > > > index 5f75cc3779..ef8315969c 100644 >> > > > > > --- a/hw/arm/xen_arm.c >> > > > > > +++ b/hw/arm/xen_arm.c >> > > > > > @@ -173,7 +173,7 @@ static void xen_arm_init(MachineState *machine) >> > > > > > >> > > > > >      xen_init_ram(machine); >> > > > > > >> > > > > > -    xen_register_ioreq(xam->state, machine->smp.cpus, &xen_memory_listener); >> > > > > > +    xen_register_ioreq(xam->state, machine->smp.max_cpus, &xen_memory_listener); >> > > > > > >> > > > > >      xen_create_virtio_mmio_devices(xam); >> > > > > > >> > > > > > @@ -218,7 +218,8 @@ static void xen_arm_machine_class_init(ObjectClass *oc, void *data) >> > > > > >      MachineClass *mc = MACHINE_CLASS(oc); >> > > > > >      mc->desc = "Xen PVH ARM machine"; >> > > > > >      mc->init = xen_arm_init; >> > > > > > -    mc->max_cpus = 1; >> > > > > > +    /* MAX number of vcpus supported by Xen.  */ >> > > > > > +    mc->max_cpus = GUEST_MAX_VCPUS; >> > > > > >> > > > > Will this cause allocations of data structures with 128 elements? >> > > > > Looking at hw/xen/xen-hvm-common.c:xen_do_ioreq_register it seems >> > > > > possible? Or hw/xen/xen-hvm-common.c:xen_do_ioreq_register is called >> > > > >> > > > Yes, in theory there's probably overhead with this but as you correctly >> > > > noted below, a PVH aware xl will set the max_cpus option to a lower value. >> > > > >> > > > With a non-pvh aware xl, I was a little worried about the overhead >> > > > but I couldn't see any visible slow-down on ARM neither in boot or in network >> > > > performance (I didn't run very sophisticated benchmarks). >> > > >> > > What do you mean by "non-pvh aware xl"? All useful versions of xl >> > > support pvh? >> > >> > >> > I mean an xl without our PVH patches merged. >> > xl in upstream doesn't know much about PVH yet. >> > Even for ARM, we're still carrying significant patches in our tree. >> >> Oh I see. In that case, I don't think we need to support "non-pvh aware xl". >> >> >> > > > > later on with the precise vCPU value which should be provided to QEMU >> > > > > via the -smp command line option >> > > > > (tools/libs/light/libxl_dm.c:libxl__build_device_model_args_new)? >> > > > >> > > > Yes, a pvh aware xl will for example pass -smp 2,maxcpus=4 based on >> > > > values from the xl.cfg. If the user doesn't set maxvcpus in xl.cfg, xl >> > > > will set maxvcpus to the same value as vcpus. >> > > >> > > OK good. In that case if this is just an initial value meant to be >> > > overwritten, I think it is best to keep it as 1. >> > >> > Sorry but that won't work. I think the confusion here may be that >> > it's easy to mix up mc->max_cpus and machine->smp.max_cpus, these are >> > not the same. They have different purposes. >> > >> > I'll try to clarify the 3 values in play. >> > >> > machine-smp.cpus: >> > Number of guest vcpus active at boot. >> > Passed to QEMU via the -smp command-line option. >> > We don't use this value in QEMU's ARM PVH machines. >> > >> > machine->smp.max_cpus: >> > Max number of vcpus that the guest can use (equal or larger than machine-smp.cpus). >> > Will be set by xl via the "-smp X,maxcpus=Y" command-line option to QEMU. >> > Taken from maxvcpus from xl.cfg, same as XEN_DMOP_nr_vcpus. >> > This is what we use for xen_register_ioreq(). >> > >> > mc->max_cpus: >> > Absolute MAX in QEMU used to cap the -smp command-line options. >> > If xl tries to set -smp (machine->smp.max_cpus) larger than this, QEMU will bail out. >> > Used to setup xen_register_ioreq() ONLY if -smp maxcpus was NOT set (i.e by a non PVH aware xl). >> > Cannot be 1 because that would limit QEMU to MAX 1 vcpu. >> > >> > I guess we could set mc->max_cpus to what XEN_DMOP_nr_vcpus returns but I'll >> > have to check if we can even issue that hypercall this early in QEMU since >> > mc->max_cpus is setup before we even parse the machine options. We may >> > not yet know what domid we're attaching to yet. >> >> If mc->max_cpus is the absolute max and it will not be used if -smp is >> passed to QEMU, then I think it is OK to use GUEST_MAX_VCPUS >> >> Looking at this a little more. If users (xl) don't pass an -smp option we actually default to smp.max_cpus=1. >> So, another option is to simply remove the upper limit in QEMU (e.g we can set mc->max_cpus to something very large like UINT32_MAX). >> That would avoid early hypercalls, avoid using GUEST_MAX_VCPUS and always let xl dictate the max_cpus value using the -smp cmdline option. > > As the expectation is that there will be always a smp.max_cpus option > passed to QEMU, I would avoid an extra early hypercall. > > For the initial value, I would use something static and large, but not > unreasonably large as UINT32_MAX to be more resilient in (erroneous) > cases where smp.max_cpus is not passed. > > So I would initialize it to GUEST_MAX_VCPUS, or if we don't want to use > GUEST_MAX_VCPUS, something equivalent in the 64-256 range. > > Alternative we can have a runtime check and exit with a warning if > smp.max_cpus is not set. FYI, xl only passes a -smp option when the domU has more than 1 vcpu. Though that implies only a single vcpu. Regards, Jason