From patchwork Fri May 19 14:33:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael Kelley (LINUX)" X-Patchwork-Id: 13248426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC46FC77B7A for ; Fri, 19 May 2023 14:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=lASgBVU/axxm2jHVWwfofxzWepMSFl2viIMRts42lUs=; b=oosluj1SvEU0C6 zXpawM8bTYLxjolDrqfs6g8glTQBp+KI8XIoea8CQkWB9Ho+T4355y3Jbfb8KMNva6v/ZAqLisRRP 0zyWSkZFcy7cIq3MQuuMMDEs6EGxflPArHfsIM4zXH1gk6MCdciVrQSLFBI+/RyMm1Waa1cjh5Zzv qgGJSSoyLDArqqZlELxKZObRY1D7SdJVuj9jOal/2IxVtwmSFSZNXyi3wanNSii8RyFPmuhw1BbcZ go0Rkd2IJqe8ed2XTUujFrFFVkfaNrioUySN+fBNb3nWI9V5RG4q9Ca0YKU+S8GUBk7pd4LNliUPk WR+jZ2BODezmwY8Ml4Og==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q01Bn-00GUs3-0f; Fri, 19 May 2023 14:34:39 +0000 Received: from mail-eastus2azlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c110::1] helo=BN3PR00CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q01Bj-00GUq8-2Q for linux-arm-kernel@lists.infradead.org; Fri, 19 May 2023 14:34:37 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=bMAjxdvqAZT+JVYdmDitrik+fgAEh6XPt87DiOd1KzoNym5M3otpg1qcFOZFoaOvpv4bldeZ4irwcEguPQPHwvhuEniWSf9vLg4SgOzDJrlWDDXp54bRiuMcOc6PgmQwqmDXAcPW+UlqbJZharPHu30KF1oGodZPdBYIAzi3fsFsdHoAglvFnmga4g6iruyFP+6cfdIVs9m9pzRxTcPcUzTJPO/UdEOo4qIPiIkYgx2Kncx7ZrW1Ry/z4HGK2Nxof8bcaQzFdY9ZZYjRTV49av/2mAFMpdVvWT17U1e/pm+jCjloDPLUSiALCLrn4EdbiK0iQ0FN2qV74Joq5P+jFA== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UqgElMciVeDds/LAccDEg4sclJTzWSIWS5TnClgbc4I=; b=DK9Mn6uzS5ZJP4tlNIN4sQYsTWvLbz1uF7IefASz0gGKfEamKhL6yrIs9Npd4COGh3snqzMDZ1Y/fqFmxFchnse7wuQRVYddOSOWVkSonPTKBWIz0v1IkVm4BrYsll2n6aUZ12KbuJ08Qf9IZBY3Jzhh7j8mRHPEfx72qjBuaNl39dARPiERhTSndGzxoQhjFwuMJYo3bHaEJGrfW6RIka57mqxScacN9RKdfSFGpcBcgO3Kl10oFMUVGMigXxzxHUB+OrpAdWDKjdsGCzxZaxTgonZY9lQwEo9jMewdOTJqgvAozyutrUVIoFH1XPJr/Jg5f9c/WgtmBMdIy+RQmA== 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=UqgElMciVeDds/LAccDEg4sclJTzWSIWS5TnClgbc4I=; b=N3/8H3Bbl7J6yTjYPvLKc+1FtpCoiRSxhqjN/swEEFFBvZ4HCvskGq9GTSiVroIAIVcpI03VWr7Bh9Qpxk5oWTXwIxZ3h1t1USs2BO7HkGS0M/GRF0XUySVPIH+m50f04zv4hQRjxtYNlp8u2FNhNG4wzquhsQxXPC0UsU3KfMs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1370.namprd21.prod.outlook.com (2603:10b6:5:16b::28) by DS7PR21MB3391.namprd21.prod.outlook.com (2603:10b6:8:83::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.7; Fri, 19 May 2023 14:34:27 +0000 Received: from DM6PR21MB1370.namprd21.prod.outlook.com ([fe80::b7e9:4da1:3c23:35f]) by DM6PR21MB1370.namprd21.prod.outlook.com ([fe80::b7e9:4da1:3c23:35f%6]) with mapi id 15.20.6433.007; Fri, 19 May 2023 14:34:27 +0000 From: Michael Kelley To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Cc: mikelley@microsoft.com Subject: [PATCH 1/2] x86/hyperv: Fix hyperv_pcpu_input_arg handling when CPUs go online/offline Date: Fri, 19 May 2023 07:33:51 -0700 Message-Id: <1684506832-41392-1-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 X-ClientProxiedBy: CY5PR15CA0166.namprd15.prod.outlook.com (2603:10b6:930:81::14) To DM6PR21MB1370.namprd21.prod.outlook.com (2603:10b6:5:16b::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR21MB1370:EE_|DS7PR21MB3391:EE_ X-MS-Office365-Filtering-Correlation-Id: 085c8534-0c9a-4331-e08b-08db587625fc X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: VJ81nDTqTeU+TjNiAf5qT8YE7mtV9vxYGhsMLCOlwxHf7exoTwOf/8I2HMC0FZs407RrK8KBZm5DbnXi6B2kviTUE2DB1npqQrpiF7KOG+hAmRdU0WnBfPDYVjLaW3zlBv9+K4f1XPN+SgjzLFSLLJ3k7h3/w/EN3X84/o5JX3ysU6cp2mFAHzSjF+k4p4zIvEvkAPP5NmtYTWhzbYnkmaaowwuE6oji3mPMz8C52Lnu9Bzmr6IqgUc1J4ortQt9WTpAA/4lKlcmEBY/ucNmAcIG4oxwsyE6pPDsCqD9wMluks/ttAjwUeE69r7egf1cBWQlWVtPxSjzZCZ0GejuZz1t2egxuP4g2anbmaAjtfYShUyrais9/OSUD7SqOtAGqS5M49U9d8LYlJSP3VUcsmn+CQBfb+QAmJfmie4o11Pe5rhaA7KxJhhKa2wApRqVpsLvosBDRhuNqKr7MvxjMcd3rzk+iabnqd6obS1ezlNbr5i2F3IeMEn+4fp/RlHzbZ2dPmJRa9/ma/XteNBuQpzqcaCqu++FfEkXged/o5LGDkeJptljVyCYII+hJtz3X+bmurh1rLLiaZekEmNCboPZ3d0TbMOXwKZEgBVyJYO//qomQauighq1XJd23UrS/pQlJr+HpB4mZEG2lLD2H/bm8TY7RYnY8Nje+giLqzcAq7jx/Hr55O51go4c6hxv X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR21MB1370.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(366004)(39860400002)(346002)(136003)(451199021)(2616005)(6506007)(2906002)(66476007)(6512007)(8936002)(7416002)(8676002)(83380400001)(107886003)(6666004)(26005)(186003)(41300700001)(5660300002)(66946007)(66556008)(316002)(786003)(4326008)(52116002)(6486002)(921005)(82960400001)(82950400001)(86362001)(38100700002)(478600001)(10290500003)(38350700002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: xQ2MoIbYFPBXcoLY6sUEsgwebA6vDwY0Az0LOmLVpyEkKRIIDHW8YE9ch0eTjODwlg5q3kzUXFbH4FCyWW0GtgYtv5xLXI3wH+wjqDNVkMXiWGW0dstquLfwCiRzanMfKEUaO1zoUaU9PUwCh0zJG+Cuq2JRXwrMqXNhHEqppr7mwehhRbwYs+X5sU1WX+gBTijasJfvyQSpDYrAyDPhvIXMqeA5G2kHS2+YKwKIxgJK/1Dg7VAuauNNyNQKmb2fBtxdjZTz22MNGINWAJ+Q69+cBNyWapdsIieRqAy3iVi+VJFMMExW2qggCk7C+qjhLTJsYnATdz0k8OgqhHXtmmDtVR1g+3zukDHFnYY0FzKoEnVZz/oXuhq+sdrhHatG91LAtCEvfFbcjwBkbcN7JcDEW2DpyWNGPdjKLEt+JinyT89ye6LJkXf+hbLm3UYevaXKcUSuE2qkRGxMUA8YsYeIlJf/Sw7vsMea0S1rkcoVXmNLbA0KcPPffQpvu8g9HLmvlWyepVy/hcA7O68U7P6cpOGqgA2KkP/KTqsA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-Network-Message-Id: 085c8534-0c9a-4331-e08b-08db587625fc X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1370.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 14:34:27.1406 (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: 9ARP6crs7+ytVRZkkshRoHz+nmAsOO17YVFbxl+swajPOIdeVIAnX/CjHePu0PaaKWiwin8KgsMSMPWtSIEdEA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR21MB3391 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230519_073435_817583_EC7164DD X-CRM114-Status: GOOD ( 21.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org These commits a494aef23dfc ("PCI: hv: Replace retarget_msi_interrupt_params with hyperv_pcpu_input_arg") 2c6ba4216844 ("PCI: hv: Enable PCI pass-thru devices in Confidential VMs") update the Hyper-V virtual PCI driver to use the hyperv_pcpu_input_arg because that memory will be correctly marked as decrypted or encrypted for all VM types (CoCo or normal). But problems ensue when CPUs in the VM go online or offline after virtual PCI devices have been configured. When a CPU is brought online, the hyperv_pcpu_input_arg for that CPU is initialized by hv_cpu_init() running under state CPUHP_AP_ONLINE_DYN. But this state occurs after state CPUHP_AP_IRQ_AFFINITY_ONLINE, which may call the virtual PCI driver and fault trying to use the as yet uninitialized hyperv_pcpu_input_arg. A similar problem occurs in a CoCo VM if the MMIO read and write hypercalls are used from state CPUHP_AP_IRQ_AFFINITY_ONLINE. When a CPU is taken offline, IRQs may be reassigned in state CPUHP_TEARDOWN_CPU. Again, the virtual PCI driver may fault trying to use the hyperv_pcpu_input_arg that has already been freed by a higher state. Fix the onlining problem by adding state CPUHP_AP_HYPERV_ONLINE immediately after CPUHP_AP_ONLINE_IDLE (similar to CPUHP_AP_KVM_ONLINE) and before CPUHP_AP_IRQ_AFFINITY_ONLINE. Use this new state for Hyper-V initialization so that hyperv_pcpu_input_arg is allocated early enough. Fix the offlining problem by not freeing hyperv_pcpu_input_arg when a CPU goes offline. Retain the allocated memory, and reuse it if the CPU comes back online later. Signed-off-by: Michael Kelley --- arch/x86/hyperv/hv_init.c | 2 +- drivers/hv/hv_common.c | 48 +++++++++++++++++++++++----------------------- include/linux/cpuhotplug.h | 1 + 3 files changed, 26 insertions(+), 25 deletions(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index a5f9474..6c04b52 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -416,7 +416,7 @@ void __init hyperv_init(void) goto free_vp_assist_page; } - cpuhp = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "x86/hyperv_init:online", + cpuhp = cpuhp_setup_state(CPUHP_AP_HYPERV_ONLINE, "x86/hyperv_init:online", hv_cpu_init, hv_cpu_die); if (cpuhp < 0) goto free_ghcb_page; diff --git a/drivers/hv/hv_common.c b/drivers/hv/hv_common.c index 64f9cec..4c5cee4 100644 --- a/drivers/hv/hv_common.c +++ b/drivers/hv/hv_common.c @@ -364,13 +364,20 @@ int hv_common_cpu_init(unsigned int cpu) flags = irqs_disabled() ? GFP_ATOMIC : GFP_KERNEL; inputarg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg); - *inputarg = kmalloc(pgcount * HV_HYP_PAGE_SIZE, flags); - if (!(*inputarg)) - return -ENOMEM; - if (hv_root_partition) { - outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg); - *outputarg = (char *)(*inputarg) + HV_HYP_PAGE_SIZE; + /* + * hyperv_pcpu_input_arg and hyperv_pcpu_output_arg memory is already + * allocated if this CPU was previously online and then taken offline + */ + if (!*inputarg) { + *inputarg = kmalloc(pgcount * HV_HYP_PAGE_SIZE, flags); + if (!(*inputarg)) + return -ENOMEM; + + if (hv_root_partition) { + outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg); + *outputarg = (char *)(*inputarg) + HV_HYP_PAGE_SIZE; + } } msr_vp_index = hv_get_register(HV_REGISTER_VP_INDEX); @@ -385,24 +392,17 @@ int hv_common_cpu_init(unsigned int cpu) int hv_common_cpu_die(unsigned int cpu) { - unsigned long flags; - void **inputarg, **outputarg; - void *mem; - - local_irq_save(flags); - - inputarg = (void **)this_cpu_ptr(hyperv_pcpu_input_arg); - mem = *inputarg; - *inputarg = NULL; - - if (hv_root_partition) { - outputarg = (void **)this_cpu_ptr(hyperv_pcpu_output_arg); - *outputarg = NULL; - } - - local_irq_restore(flags); - - kfree(mem); + /* + * The hyperv_pcpu_input_arg and hyperv_pcpu_output_arg memory + * is not freed when the CPU goes offline as the hyperv_pcpu_input_arg + * may be used by the Hyper-V vPCI driver in reassigning interrupts + * as part of the offlining process. The interrupt reassignment + * happens *after* the CPUHP_AP_HYPERV_ONLINE state has run and + * called this function. + * + * If a previously offlined CPU is brought back online again, the + * originally allocated memory is reused in hv_common_cpu_init(). + */ return 0; } diff --git a/include/linux/cpuhotplug.h b/include/linux/cpuhotplug.h index 0f1001d..696004a 100644 --- a/include/linux/cpuhotplug.h +++ b/include/linux/cpuhotplug.h @@ -201,6 +201,7 @@ enum cpuhp_state { /* Online section invoked on the hotplugged CPU from the hotplug thread */ CPUHP_AP_ONLINE_IDLE, CPUHP_AP_KVM_ONLINE, + CPUHP_AP_HYPERV_ONLINE, CPUHP_AP_SCHED_WAIT_EMPTY, CPUHP_AP_SMPBOOT_THREADS, CPUHP_AP_X86_VDSO_VMA_ONLINE, From patchwork Fri May 19 14:33:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Michael Kelley (LINUX)" X-Patchwork-Id: 13248427 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4B368C77B7A for ; Fri, 19 May 2023 14:35:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iOSfBecuVJAihMXtXEG+sJV4qwYBIJyVdYk4Y6CBcTE=; b=Dyu0bkBCITmWsH X5/4MjwU2pwPVY4qNLM7VrB++7o8VF7MY/dcYoIOuXPfyZZOX4kR0prijmsSI2C7LbMOFd3GmZjxS N6llLRDuQ+UKZIQ/KPt0DpE6reqLGj1gJhZL9fauxgFJG8DNlKBx/uc7sTH+5KeTawwa2hIRK+pox gVdbR+nuvpOGQpsCQ96h9PsFGFZ2xsLEujgjc21qqSEe8TazMtg5Rxs5YNLPdiEso0P2N8AtD6bJQ iE1K3rEW9q/1cwt1bIutTtx6UXdS6kjjJycC+49qFg3aSTlEgEruQuvWyeqJq7uypdxHobi07kLH/ ggGqNdMgow2jZWWiGUVQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q01Bt-00GUtX-1e; Fri, 19 May 2023 14:34:45 +0000 Received: from mail-eastus2azlp170100001.outbound.protection.outlook.com ([2a01:111:f403:c110::1] helo=BN3PR00CU001.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q01Bl-00GUq8-1P for linux-arm-kernel@lists.infradead.org; Fri, 19 May 2023 14:34:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=K6EnuYt1+2wh8cGH+ptqq1OuatRtWtLUXhqIRmP7X1x6O/l9PkcwyEkdv7ltDO/XufkrHY1v6L41J0LajtbkOyjS5mY6MDV3BynxWCmz2udpedLZAtvJK/pM+IkgZ7htKP9Zo1mlt80Q8Loc/5+znTbtQMTXSpN7lX8cflMhxE+0cBGbug5PN9mvqpapg8B5uWsOJ7wp3DcEBipgFNS5djjs2G2myBr1uo8lkiUGDLrkce+sPdGlHAXGwKpsIP+6rkXThTIo768zWZHRMmOiW1BZQgeAuz5av/HU56n1dXxGnXiReddaUkRqJF/ShRQXw2WfUu7xo+JQR61QKowacg== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=TVLCXaXFVSydw+sLVl3pn1lZjRPAvTpnNGR1Hbdmeqc=; b=OOhmprkkchT0W1wPHmK0zxri/IgEOWPFJoyKuqqJepN97iFbQbBbrwAireMKAmCvfTOPLQc0sE1pEnDinNuf4TGJVUxvwXZazMWAL29vTeizgtmr+nKD9VMHzLrDVwrGKu+fQC/n5ccO3QTIlBseX8i9HfAmqIW7/Ry2oesxJo5xIXckIxPE/JavQ9bb+hCSC+uKlYz+WwgPqHr2nTNQhcBCB7xCpStKK+tQYDAAJ9bxMA6XN6/DMQz+tgeX70eOV5P/93Y8PoR803FkrxCwO9kuxoYlMqmajGewW6p3BrIIiSpJO1a/cUIlRIDPjd9goI93GnE/50X+MLX9Ia3m/g== 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=TVLCXaXFVSydw+sLVl3pn1lZjRPAvTpnNGR1Hbdmeqc=; b=AkvEOUB6CDoGIDMbbA3E8KgQfzytcL+fCcSVwDOFaLGuSUZTX5h6JVmYrpyGxFzlUZ6nPu5siLSqG24Jdjyupn7YOrFbOxNVN1eFuw9tXJVhrvcWbuCGEDOC50QQP2jayPaxPt3wW64DOt63ms8T8lkAXfYAZqQRNY9XsiGcsnE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=microsoft.com; Received: from DM6PR21MB1370.namprd21.prod.outlook.com (2603:10b6:5:16b::28) by DS7PR21MB3391.namprd21.prod.outlook.com (2603:10b6:8:83::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6433.7; Fri, 19 May 2023 14:34:28 +0000 Received: from DM6PR21MB1370.namprd21.prod.outlook.com ([fe80::b7e9:4da1:3c23:35f]) by DM6PR21MB1370.namprd21.prod.outlook.com ([fe80::b7e9:4da1:3c23:35f%6]) with mapi id 15.20.6433.007; Fri, 19 May 2023 14:34:28 +0000 From: Michael Kelley To: kys@microsoft.com, haiyangz@microsoft.com, wei.liu@kernel.org, decui@microsoft.com, catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org Cc: mikelley@microsoft.com Subject: [PATCH 2/2] arm64/hyperv: Use CPUHP_AP_HYPERV_ONLINE state to fix CPU online sequencing Date: Fri, 19 May 2023 07:33:52 -0700 Message-Id: <1684506832-41392-2-git-send-email-mikelley@microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1684506832-41392-1-git-send-email-mikelley@microsoft.com> References: <1684506832-41392-1-git-send-email-mikelley@microsoft.com> X-ClientProxiedBy: CY5PR15CA0166.namprd15.prod.outlook.com (2603:10b6:930:81::14) To DM6PR21MB1370.namprd21.prod.outlook.com (2603:10b6:5:16b::28) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR21MB1370:EE_|DS7PR21MB3391:EE_ X-MS-Office365-Filtering-Correlation-Id: 3fb9cd1b-956e-40be-bcb1-08db58762700 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: B2SIFUBw6nI7D8qH2XbfJ6ZH5lbXsllcYVZuVsfRvWoBrzHH3Neawkm8gu2/4IXN/kEFjkcRR9iFGTVPsc8hZV32vBcNRizaLWJTfxwU2+YHCjqN0t2vAr95UwOFGw7zNwVganMc7wDGgcfZBJpHTUqUPt8bz0GnLBRwVybtuPEhZtrzjmheKSM5OpV0FOIwVqCrM/D2nOHYws+DMv0nHEgz3HLNIFPCM4AL4/dHr1A57SLOqCyNVBcgr51lwtqdhfRlIR3GilErWBeyZU+JlUn8RdB4dCYpshtaWSXhCNFBGH1I1Ndz0TBdhQ6kgldA5maAhYS1MNBSZP4CHonQtaNRWh7tbcyk8/T7BtJh+O/fkZW+bL71b47wxvYj2RPy2d2c6trXaLQxLHJTnD7yy65+VzqX22LkpOO5FEhPQdbBk6ZIxjE3+9moP+nHDhYYQlk1JEnY2H2Pvv4ERRjNuAZhLLudebJHZC07qVWAVTp655L+2qAzrkd0z/l0eWcWKXscZTgFN/feiKVfV5pkqNOp7Et16x5tlkovuWszaKX4hCuc0hNzP6YDEF8eOyfI4pP4x6Iai45DnzJAiqPnF4Pe5VBd3sfeUi4JRLAlcdXMvWzF01LNidfsS8+HJXVb3TwC1p51ddCZ/HPQb3pwVhxUHX96ZoHMg1Fav3Ze8J6Ti1l+S6QHW3jdIHuxTdkf X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR21MB1370.namprd21.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(396003)(376002)(366004)(39860400002)(346002)(136003)(451199021)(4744005)(2616005)(6506007)(2906002)(66476007)(6512007)(8936002)(7416002)(8676002)(83380400001)(107886003)(6666004)(26005)(186003)(41300700001)(5660300002)(66946007)(66556008)(316002)(786003)(4326008)(52116002)(6486002)(921005)(82960400001)(82950400001)(86362001)(38100700002)(478600001)(10290500003)(38350700002)(36756003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: IqvNu5PeLNbTFabk57k3lAS5nU05hYW2LZvwW2KIU7VB5U2r/xaDiAdCpUHEPT5tDpuzUBeRocmt2l1rudlDMelaDT/DoURwcNBJ+fBC//pK/1zfpXHepyn4/5JZuhoBU8G7nCqUmuBGMxB1Q9UwpHb5RVGdKOng/libfGJWlUmmYIAVUBv7CKV5RT/6GLRdrQ+YYufDilLlYV3//pOOQVp+neB606Bsa15ry9UkSkuya3y9x9cQWTpXWYILjCzIvL8dUiIbRRR0VKg3rVLcHLsb2WNAVLPRLf2zfZmJWJ1+Rzo3mNhPTe15jXXXVmi7BxXvHpYxeFZLDYuffUxu4F+zNdu88ydt+Z2+r7+eMCIokN0PnlE8Mnh1Ok91+AjESlqQmWFsZLFIul/1MOvTLPZMuXLpOrI1fRI2OqVx0ZUpBt8LiJSVUsNU862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JMlNMWcW07XSIl+6O48rBg/WORImH5zGofJJwgM3ubcmo/eHmI1i+8XtoTRgjQyeaeFGdUhz5k5+ X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3fb9cd1b-956e-40be-bcb1-08db58762700 X-MS-Exchange-CrossTenant-AuthSource: DM6PR21MB1370.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2023 14:34:28.8292 (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: HnWXTGuzQlc5THoeOnsUP3h2SMScKCuSEcZTXzZwis2QiJQ90MdqLM+/1SHty2SaMYeooNr9dM7zArOApG+9cQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS7PR21MB3391 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230519_073437_475111_D38268B7 X-CRM114-Status: GOOD ( 12.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org State CPUHP_AP_HYPERV_ONLINE has been introduced to correctly sequence the initialization of hyperv_pcpu_input_arg. Use this use new state for Hyper-V initialization so that hyperv_pcpu_input_arg is allocated early enough. Signed-off-by: Michael Kelley --- arch/arm64/hyperv/mshyperv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c index a406454..f1b8a04 100644 --- a/arch/arm64/hyperv/mshyperv.c +++ b/arch/arm64/hyperv/mshyperv.c @@ -67,7 +67,7 @@ static int __init hyperv_init(void) if (ret) return ret; - ret = cpuhp_setup_state(CPUHP_AP_ONLINE_DYN, "arm64/hyperv_init:online", + ret = cpuhp_setup_state(CPUHP_AP_HYPERV_ONLINE, "arm64/hyperv_init:online", hv_common_cpu_init, hv_common_cpu_die); if (ret < 0) { hv_common_free();