Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp258438pxb; Wed, 11 Nov 2020 03:01:26 -0800 (PST) X-Google-Smtp-Source: ABdhPJwpBcb24bMKwkzwgdyVvop5UFflPI2FayTO6IoBFoDJPuPoV/K7R6RC3Q/2wfPA3ACXGEC3 X-Received: by 2002:a17:906:80ca:: with SMTP id a10mr23815940ejx.351.1605092485852; Wed, 11 Nov 2020 03:01:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605092485; cv=none; d=google.com; s=arc-20160816; b=FEQSsB/n72JsVXjZeLFhdXlCAv0+go/eIU4tMQL8uLrH0PkUEOKZFjU0suvhJv0LVf koTlq4qt/xrO7n6u1a/LGaXSckqqCHPXShfYLU/aMD4sSI4B3VpJeaNstHAk0nuurkgi G62dBTjth915lkXWdXEAq41uEBSTGtAVwiEjLjBe8fbg3nllodzAvBJkHYC7Oas6qeB/ MrffIeKLQWAMwO+kAgZ9ichT/mF5Mb442vy5V4+bGtT90WcuU4d7pGtbXgCVxKc8Ep0d bGWthEclnZX4S0S3BfDg4cdNWqNLrQjphDJrqEr5g5rz6JslZ70T99M3HkgH6sQW7ZzP AkXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=6XQWFODdSo0naMCVtSFLByNNU8KoljLbxE0JRj0+kP0=; b=btin/fE2bXtDbDIkdL5UIOCjjHSoaX6mTJUSAqev4f3YOMbPclhhjzN/p/n3pcTzzU AJcEHaGTScUa3xmZHWRgPqGwViS9Ej50E3e0DBjOj2exnvTbOj+kvwMwmSJqzBiAf5wZ rDM8DFQxAiqVjIZzdg/fRtzGtn4G4zvMOLAwxGspWiuo1KIBE/6m00Tu03XPL/W1U86x OGolkjiPgx2n0fzMeHXdnG8jKeCN+LHETSs26SJRiPQIJEZ5TOQBaKXNhuzARkF/+jjC kRONCFbCeZBRpKfJCzqIUTMVTwVGqbcszAWd0jreScnzhH9gllN8zKaN0CmIsATgLkv+ sp0g== ARC-Authentication-Results: i=1; mx.google.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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o22si983263ejb.569.2020.11.11.03.00.58; Wed, 11 Nov 2020 03:01:25 -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; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725966AbgKKK7Y (ORCPT + 99 others); Wed, 11 Nov 2020 05:59:24 -0500 Received: from mail-wr1-f67.google.com ([209.85.221.67]:46455 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725830AbgKKK7W (ORCPT ); Wed, 11 Nov 2020 05:59:22 -0500 Received: by mail-wr1-f67.google.com with SMTP id d12so2048930wrr.13; Wed, 11 Nov 2020 02:59:21 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=6XQWFODdSo0naMCVtSFLByNNU8KoljLbxE0JRj0+kP0=; b=QJ7TEBdQE++HS3CzcfyoOEVtiGxS4f1Z1T70p2oeeSGmZo5737LcE1o2WjuY3kw/2V AnzyvBCiH8UZdfgnRNBk9avAbyA4pWqQzrsh8Ct8MDkYq/hW4Q+TLzVEaU6VASECSs8W /GOgI9QD1IIPDfJ1As4a/Be1y8Fe3vraEAQf+OwI7/hzCCoTmJDEyIob5x9ZE53WFcEK HNIYJoemk0mwNpYLHh8ZfKuFH0HqlnAXrav375wRMkxt1BihMe9ZFSU6Pj3id7ebmkQx aP1ZEMJa+MeBW/loRsmrXfHfDopX0kmfDXxWwPcKLQHXN6lJQFSGtiyvYMP0fAXSival zcCg== X-Gm-Message-State: AOAM531AvjAVOysMOFDqH8iW8v3XUj+0sfPPnJyuDIzDydU4cWUzq+uV wpUwidK2noHwxx4D1e2W5WA= X-Received: by 2002:adf:8143:: with SMTP id 61mr21154700wrm.318.1605092360414; Wed, 11 Nov 2020 02:59:20 -0800 (PST) Received: from liuwe-devbox-debian-v2 ([51.145.34.42]) by smtp.gmail.com with ESMTPSA id c62sm2140186wme.22.2020.11.11.02.59.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Nov 2020 02:59:19 -0800 (PST) Date: Wed, 11 Nov 2020 10:59:18 +0000 From: Wei Liu To: Andrea Parri Cc: Chris Co , linux-hyperv@vger.kernel.org, kys@microsoft.com, haiyangz@microsoft.com, sthemmin@microsoft.com, wei.liu@kernel.org, chrco@microsoft.com, mikelley@microsoft.com, andrea.parri@microsoft.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Drivers: hv: vmbus: Allow cleanup of VMBUS_CONNECT_CPU if disconnected Message-ID: <20201111105918.veq42r7oj45hhjv3@liuwe-devbox-debian-v2> References: <20201110190118.15596-1-chrco@linux.microsoft.com> <20201110201833.GA3550@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201110201833.GA3550@andrea> User-Agent: NeoMutt/20180716 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 10, 2020 at 09:18:33PM +0100, Andrea Parri wrote: > On Tue, Nov 10, 2020 at 07:01:18PM +0000, Chris Co wrote: > > From: Chris Co > > > > When invoking kexec() on a Linux guest running on a Hyper-V host, the > > kernel panics. > > > > RIP: 0010:cpuhp_issue_call+0x137/0x140 > > Call Trace: > > __cpuhp_remove_state_cpuslocked+0x99/0x100 > > __cpuhp_remove_state+0x1c/0x30 > > hv_kexec_handler+0x23/0x30 [hv_vmbus] > > hv_machine_shutdown+0x1e/0x30 > > machine_shutdown+0x10/0x20 > > kernel_kexec+0x6d/0x96 > > __do_sys_reboot+0x1ef/0x230 > > __x64_sys_reboot+0x1d/0x20 > > do_syscall_64+0x6b/0x3d8 > > entry_SYSCALL_64_after_hwframe+0x44/0xa9 > > > > This was due to hv_synic_cleanup() callback returning -EBUSY to > > cpuhp_issue_call() when tearing down the VMBUS_CONNECT_CPU, even > > if the vmbus_connection.conn_state = DISCONNECTED. hv_synic_cleanup() > > should succeed in the case where vmbus_connection.conn_state > > is DISCONNECTED. > > > > Fix is to add an extra condition to test for > > vmbus_connection.conn_state == CONNECTED on the VMBUS_CONNECT_CPU and > > only return early if true. This way the kexec() path can still shut > > everything down while preserving the initial behavior of preventing > > CPU offlining on the VMBUS_CONNECT_CPU while the VM is running. > > > > Fixes: 8a857c55420f29 ("Drivers: hv: vmbus: Always handle the VMBus messages on CPU0") > > Signed-off-by: Chris Co > > Cc: stable@vger.kernel.org > > Reviewed-by: Andrea Parri (Microsoft) Applied to hyperv-fixes. Thanks Chris and Andrea. Wei.