Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp20811pxb; Fri, 5 Mar 2021 13:11:03 -0800 (PST) X-Google-Smtp-Source: ABdhPJy12yr22iKV9NyP5gq5oYYvGsYfNB+9xQu6aoIfH1XEyYremBKkCQkJCRM1KjE0tcqSuuLE X-Received: by 2002:a17:906:72d1:: with SMTP id m17mr4213179ejl.118.1614978663531; Fri, 05 Mar 2021 13:11:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1614978663; cv=pass; d=google.com; s=arc-20160816; b=FM2T2nB3YRDeiU6tKW3q4jEPUdRd+KhcMryjAXXKgOxrrJyAr2i35ajFi4qmsIF52g 9WKJCgvEKjX8DtrIHxvziaknyZb1ACZDAVrVJjlHEevxxm5OnBrm2EcAPTR+vGL36ZhG c+INS49yjFWOUfRwm2+/O7C8bgfZGjsVmGvEIxs4T3SUnJ25VXWHL6HpwXgth0utiJWi M6DsN+L0K/rC69WBwcjwCBULWEJZsWqAgK7kdw279MZ81EHioUgSyS6+k4PKApAUe7Hx pe/AAnD5R5QHovli3ZzSJQ4ohU5dYoR5hNYXXQZIdW0w6OPVrgqiZ4+Vs97L8B1UX8Nd SrRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :msip_labels:content-language:accept-language:in-reply-to:references :message-id:date:thread-index:thread-topic:subject:cc:to:from :dkim-signature; bh=lxxWjXajWEYtomimjQoOXyEzgjSQs0cgrygbINE42yk=; b=XcBJOgzeQdT4FNVd9S2a6n/tJrg+w5urrLtJF/6vJ10BGay+J0TjpHnl5nq+o+dEjI Y86Q/qJGUArDfasW8VB5/P9KiFwMJ1V4O7AR98Mnncls+N0tsfX3FFYpmzXF6t8HHcuH N7fM1t+8BRqLW+UA4vp7WT+S9ldf2aXpO53geJHETw7iPyHGhFnxT4pbWByL0QBHcYkb iOVgMfIbl5s+X5dqnbFms/JQGFaSh20fhIs0hElynkY1xRliSnTjJFLXCPb27W+GsnjF YcmgfT7zTHdlkmB+bbgye8vVyDnThtHYE7kUouBow5pDq4N4TAKAZyfcIeULJ6Iii8bm 13wA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=BXbiUb4L; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u5si2109866ejt.35.2021.03.05.13.10.40; Fri, 05 Mar 2021 13:11:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector2 header.b=BXbiUb4L; arc=pass (i=1 spf=pass spfdomain=microsoft.com dkim=pass dkdomain=microsoft.com dmarc=pass fromdomain=microsoft.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230070AbhCEVDg (ORCPT + 99 others); Fri, 5 Mar 2021 16:03:36 -0500 Received: from mail-bn7nam10on2092.outbound.protection.outlook.com ([40.107.92.92]:4577 "EHLO NAM10-BN7-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S229629AbhCEVD0 (ORCPT ); Fri, 5 Mar 2021 16:03:26 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=F06CAXJPZ69K95xi6cfKydJGSeJOJSZyObQ5iaQSAl/pGEw+cqXwJcAWzLr9kb0aHHYC/nSIfaFheTcYgcNcVQ7N9pHL7bmPTPxHmwPRCIHBS9up8GQpoXoL7xFjJHLV851NU2wPKXHilEi1mBpS7aBFkEqe0/BUpWp0Brc/RjCTqQGhWLLK9sVHy341C0Y/JiV6u92aI8AJTBeXQEfEVK7HGN/WFau05AgqzwJ1Xe2FgkJRXO2/FuX44whKKMdgy2YGAJVvZUWIA30WIuLtxO7g/VFdP0sOftGPTaS1epol3tI7ibu96FcHFNAI4Yj/6OfiutKrkS2FhFVx3SFdXw== 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=lxxWjXajWEYtomimjQoOXyEzgjSQs0cgrygbINE42yk=; b=jS2+WqBQ57008ZdJ+asMEM0UAloKKfpDKd8iAzSxqRit87POBUcpaGDkXhJ9eADj7LC+Yo1QOB0kGVsn+Yr2A9PTzEMrpYagHgfK7cW/Wxgp0YAftccbz6VpE92avl2SoEdzpaa4FDvrUZCq2ypowri7n+JROmNHFwJARMWE1VQpqZl1SBGbqmGZlfOFhvYP4+3XQYloEZpmHPCAz2mKYO2q6oS0lsv1Gs2S+svhZ8VL4X7cm0kTaP0J8REJVk+vo3nYJSFxd+ILQTluZjeTYaegceiEM2ijYtCf3QN5IL9VsLDg5mjb+sSUUTBeUW9V38Em00iTIE//qofMZ2f4jw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=microsoft.com; dmarc=pass action=none header.from=microsoft.com; dkim=pass header.d=microsoft.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=lxxWjXajWEYtomimjQoOXyEzgjSQs0cgrygbINE42yk=; b=BXbiUb4LIQcVDEGeGdCr/6h1Xh4zcFPiA+Kj6kIZoshm/d+pMTKVa9e/elO97fgv2QfpoItOLYfSTJ9DSlbXpklRGDTSXzccOgr5p9GKvBnf2iJpdRVcpTiRnFTcBrXV9eG1ehKtPk/da8El/kqMXSQwPKQhjzpFUcegKIzK5rg= Received: from MWHPR21MB1593.namprd21.prod.outlook.com (2603:10b6:301:7c::11) by MW4PR21MB1953.namprd21.prod.outlook.com (2603:10b6:303:74::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3933.17; Fri, 5 Mar 2021 21:03:24 +0000 Received: from MWHPR21MB1593.namprd21.prod.outlook.com ([fe80::9c8:94c9:faf1:17c2]) by MWHPR21MB1593.namprd21.prod.outlook.com ([fe80::9c8:94c9:faf1:17c2%9]) with mapi id 15.20.3912.025; Fri, 5 Mar 2021 21:03:24 +0000 From: Michael Kelley To: Sunil Muthuswamy CC: "will@kernel.org" , "catalin.marinas@arm.com" , Mark Rutland , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "linux-hyperv@vger.kernel.org" , "linux-efi@vger.kernel.org" , "arnd@arndb.de" , "wei.liu@kernel.org" , "ardb@kernel.org" , "daniel.lezcano@linaro.org" , KY Srinivasan Subject: RE: [PATCH v8 4/6] arm64: hyperv: Initialize hypervisor on boot Thread-Topic: [PATCH v8 4/6] arm64: hyperv: Initialize hypervisor on boot Thread-Index: AQHXDwVnaTIwkoHCmke0wnq+tNhy8KpytJGggAMyJ3A= Date: Fri, 5 Mar 2021 21:03:24 +0000 Message-ID: References: <1614649360-5087-1-git-send-email-mikelley@microsoft.com> <1614649360-5087-5-git-send-email-mikelley@microsoft.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Enabled=true; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SetDate=2021-03-05T21:03:22Z; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Method=Standard; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_Name=Internal; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_SiteId=72f988bf-86f1-41af-91ab-2d7cd011db47; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ActionId=d6ecbce3-e220-4772-a618-44ae319e7742; MSIP_Label_f42aa342-8706-4288-bd11-ebb85995028c_ContentBits=0 authentication-results: microsoft.com; dkim=none (message not signed) header.d=none;microsoft.com; dmarc=none action=none header.from=microsoft.com; x-originating-ip: [24.22.167.197] x-ms-publictraffictype: Email x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: a4a23980-403c-4b17-4841-08d8e01a1db1 x-ms-traffictypediagnostic: MW4PR21MB1953: x-ms-exchange-transport-forked: True x-ld-processed: 72f988bf-86f1-41af-91ab-2d7cd011db47,ExtAddr x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:8273; x-ms-exchange-senderadcheck: 1 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: KJZsoi04VuuD5H9kbGLRd3gvPvZ54c0B1EsAQMJkYrlr7tCeHQmCdV2H1ofytGS7vn2OI/QuB6xUSVFQBrl+FRtDy/y2GwovNPmR2WyEqw0UG/AAxEzdHLzuKnyNYQ6c9lup41/5EylGI59mTQAsq/N9q5/nMngoACQTscFuGd90A95M5BUnSGqeZ06C8LVumgburumBUc1oSAWmhIEiWNhvkikRHUXeVdpzUFJpv2UnvHdwCXWEsyAxTZrSLSpVLRS9I4JRiWILjpOqRvf/O56G6BGLDoqbMcKLbGWvCUtxnPKr6kdDxPcYB1AeUZxoUHGVBxJu+KAsVnam3PrpMaAty2IEaxnZNmDKdkC1zZ0FoAXFnWmeVZ+HZMji4EZLPNAZ7RrE32M6A9nYLX7xSEq2FJFv1LDVNvZba3AVO90ipeXYWuBvh2CPuErhFAQIw+hx6XXgr1HdGtKj2JU2VE/Ly+XpGhnLoM8/wT4puTfsjARJJXw52xh7kilzRPFbNFSkrpntkm37qjT//L2jxqfm5HByoBBIZ3sO9er2YKDEDxiAZ/EVtk1z+XPG6Ztb x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MWHPR21MB1593.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(396003)(346002)(376002)(39860400002)(366004)(136003)(86362001)(186003)(478600001)(26005)(82960400001)(82950400001)(316002)(71200400001)(54906003)(5660300002)(55016002)(64756008)(76116006)(52536014)(66476007)(4326008)(6862004)(8676002)(66946007)(10290500003)(6506007)(8936002)(66446008)(8990500004)(7416002)(66556008)(7696005)(2906002)(33656002)(6636002)(107886003)(9686003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata: =?us-ascii?Q?6ybKOnGCq8OSFxQMMGNCoDz86zNEvtltIvdGwoBIzlilcqcSVom9gnRTZ7eN?= =?us-ascii?Q?uoaLDKEMNgpdYDxuxw7IvCWm238nFgx2agKx4kvmkhSXfWTmD/C6e2fTHilB?= =?us-ascii?Q?WyMr8GEKP/lYY8NQPF/eb3oFtliOisanEKlVVPMJw/pAA0SgjpDueuTnz/MJ?= =?us-ascii?Q?dlOuFTr9W4zgL/kNxMaNbjJmIWnRdSBPSjJfuvTBuHkMefFBFF/7k/c9+4pi?= =?us-ascii?Q?3KabVqHGXQLEllNU43S/n/d2g8ZC7WrIMf0BfZ+iTL9rhSfEWjpJaStuGQpT?= =?us-ascii?Q?/EJQ/5AdoM6r+Oyb72It8Ll7VybCvlwZCqsz808w2KoG76xdZ6biO562lhff?= =?us-ascii?Q?f/XZYe+88nmTmRxmgBfNVWaC4y1FAILvCgADukoxanD3/qXrbH7SjeK73jEO?= =?us-ascii?Q?3UIAx5viGYK7m3HfTt442r6Ldq9LsKYLr1LuaDHIK79IKjCbXq2InnQ8KntR?= =?us-asc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; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR21MB1593.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a4a23980-403c-4b17-4841-08d8e01a1db1 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Mar 2021 21:03:24.2555 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: Mzq+q/UEY/2L76ZIOfC+GaIhyMV0pbH4IwwlF1rFPAPC2Vaec0n/v9hz6pSlZDSG3znZCVetjnEpS7/4XYDf53kAXFzxH5Lnpyttn4c0XRw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR21MB1953 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sunil Muthuswamy Sent: Wednesday, March 3, 2= 021 12:21 PM >=20 > > +static u64 hypercall_output __initdata; > > + > > +static int __init hyperv_init(void) > > +{ > > + struct hv_get_vpindex_from_apicid_input *input; > > + u64 status; > > + int i; > nit: both, tabs & spaces are being used to indent variable names. Can we = stick > to one? >=20 Agreed. Will make this consistent in the next version. > > + > > + /* > > + * Hypercall inputs must not cross a page boundary, so allocate > > + * power of 2 size, which will be aligned to that size. > > + */ > > + input =3D kzalloc(roundup_pow_of_two(sizeof(input->header) + > > + sizeof(input->element[0])), GFP_KERNEL); > > + if (!input) > > + return -ENOMEM; > Similar to the comment on the other patch, can this be done through a > per-cpu hypercall input page? Per comments on other previous patch, these allocations can be eliminated and the problem avoided entirely. >=20 > > + if ((status & HV_HYPERCALL_RESULT_MASK) =3D=3D HV_STATUS_SUCCESS) > > + hv_vp_index[i] =3D hypercall_output; > > + else { > CNF suggests using braces even for single line 'if' statements if the 'el= se' is a multi-line > statement Will do. >=20 > > + pr_warn("Hyper-V: No VP index for CPU %d MPIDR %llx status > %llx\n", > > + i, cpu_logical_map(i), status); > > + hv_vp_index[i] =3D VP_INVAL; > > + } >=20 > > +bool hv_is_hyperv_initialized(void) > > +{ > > + return hyperv_initialized; > > +} > > +EXPORT_SYMBOL_GPL(hv_is_hyperv_initialized); >=20 > This to me seems like more of an indication that whether the hypervisor i= s Hyper-V or > something else, rather than if necessary Hyper-V pieces have been initial= ized. If that is > the case, suggest renaming. Maybe just call it 'hv_is_hyperv'? This function also exists on the x86/x64 side and is used in architecture i= ndependent code. It's meaning is somewhere between "is Hyper-V" and "is Hyper-V initi= alized". I'm not sure there's much value in changing the name everywhere. Michael