From nobody Fri Apr 26 12:31:26 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1578494130; cv=none; d=zohomail.com; s=zohoarc; b=gtc3wGAj83roGLt48GZSNlvp7LpMjNHc9kD/+jIgPCoeXlyDpz0zbL7AOldSd1eDTlyGRHv2cd5H7lw3gWFVOCLunx1iJuppcRYNT5LyUx+kXR08i4akK5KEkdCw3FPNx/Is7AfFHTfv0S+Wnxz1iuc9RaNevl9J2aPrrVD2XOk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1578494130; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=DtLTihz/CMSoPwsqjbTAB3VT3nzLLGTrLCgk8WX1oQw=; b=b6MmOPe5BM+R40jRt3hOwTJJiu+sfp+m3mV4kpU/ZdmH/2D4iW6XfdpjNG4aNLN+LNfPPQyk6GcWtktvWp9aBgNvfQqjMCZLE38fUNooipQt1E49+dVE7Y8g6bJ4arHly2QYBgwsUrqD3FKDhenbVCdAqu7WrwXHWApBFc1qPzU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1578494130909610.0307090539642; Wed, 8 Jan 2020 06:35:30 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ipCQ0-00073S-1X; Wed, 08 Jan 2020 14:34:44 +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.89) (envelope-from ) id 1ipCPz-00073N-Co for xen-devel@lists.xenproject.org; Wed, 08 Jan 2020 14:34:43 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 0205a16a-3224-11ea-b80a-12813bfff9fa; Wed, 08 Jan 2020 14:34:42 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id BFF69AC45; Wed, 8 Jan 2020 14:34:41 +0000 (UTC) X-Inumbo-ID: 0205a16a-3224-11ea-b80a-12813bfff9fa X-Virus-Scanned: by amavisd-new at test-mx.suse.de From: Juergen Gross To: xen-devel@lists.xenproject.org Date: Wed, 8 Jan 2020 15:34:39 +0100 Message-Id: <20200108143439.25580-1-jgross@suse.com> X-Mailer: git-send-email 2.16.4 Subject: [Xen-devel] [PATCH v2] xen/x86: clear per cpu stub page information in cpu_smpboot_free() X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Juergen Gross , Andrew Cooper , Wei Liu , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" cpu_smpboot_free() removes the stubs for the cpu going offline, but it isn't clearing the related percpu variables. This will result in crashes when a stub page is released due to all related cpus gone offline and one of those cpus going online later. Fix that by clearing stubs.addr and stubs.mfn in order to allocate a new stub page when needed. Fixes: 2e6c8f182c9c50 ("x86: distinguish CPU offlining from CPU removal") Signed-off-by: Juergen Gross Reviewed-by: Wei Liu Tested-by: Tao Xu --- xen/arch/x86/smpboot.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xen/arch/x86/smpboot.c b/xen/arch/x86/smpboot.c index 7e29704080..46c0729214 100644 --- a/xen/arch/x86/smpboot.c +++ b/xen/arch/x86/smpboot.c @@ -945,6 +945,8 @@ static void cpu_smpboot_free(unsigned int cpu, bool rem= ove) (per_cpu(stubs.addr, cpu) | ~PAGE_MASK) + 1); if ( i =3D=3D STUBS_PER_PAGE ) free_domheap_page(mfn_to_page(mfn)); + per_cpu(stubs.addr, cpu) =3D 0; + per_cpu(stubs.mfn, cpu) =3D 0; } =20 FREE_XENHEAP_PAGE(per_cpu(compat_gdt, cpu)); --=20 2.16.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel