From nobody Thu Nov 21 17:19:45 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725289249; cv=none; d=zohomail.com; s=zohoarc; b=Sbl3YvXMmgKKUK+Zkt7aSPXZsAPRT3PQvCMVQ1J0qT4Kpk41l9GV9tui90iTyFk4yq/yxcDLDMvWh41Hr6Hy3gJSioLK6tLtfw3MJ/EI2qE+WQR8cZUNGRUHPeF524wdw6KoklTORg7QU4rqdfcxuRuF+3EFxilaxUSJlZblbe0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725289249; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=xk9nXu+h1O9Dru8CYrgj4B4uMbFkV5LNUyNmt/AckII=; b=iZ76MmYIuXFY2xAEt+gFDb6fGxM/s3lt+jSXMy15aLbyXh6Ad2DMZgbRpEjaACBeogBpzLtkJJFaKhQeuzP5p7U79xUxJjVsezchgiYtfvDNQ7dEUW0qHbnaVJRp2bA+UB72i5u4LiiNmTm7G6pKQ6XQkwaDpCWAmwyeEaqt7Fs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725289249268534.3954763868002; Mon, 2 Sep 2024 08:00:49 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.788085.1197514 (Exim 4.92) (envelope-from ) id 1sl8Xf-00018R-LM; Mon, 02 Sep 2024 15:00:31 +0000 Received: by outflank-mailman (output) from mailman id 788085.1197514; Mon, 02 Sep 2024 15:00:31 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sl8Xf-00018K-Fo; Mon, 02 Sep 2024 15:00:31 +0000 Received: by outflank-mailman (input) for mailman id 788085; Mon, 02 Sep 2024 15:00:30 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sl8Xd-00018E-UU for xen-devel@lists.xenproject.org; Mon, 02 Sep 2024 15:00:29 +0000 Received: from mail-lj1-x235.google.com (mail-lj1-x235.google.com [2a00:1450:4864:20::235]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 17187f20-693c-11ef-99a1-01e77a169b0f; Mon, 02 Sep 2024 17:00:27 +0200 (CEST) Received: by mail-lj1-x235.google.com with SMTP id 38308e7fff4ca-2f50966c469so49122151fa.3 for ; Mon, 02 Sep 2024 08:00:28 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c24f762f8dsm2437379a12.61.2024.09.02.08.00.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Sep 2024 08:00:26 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 17187f20-693c-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725289227; x=1725894027; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xk9nXu+h1O9Dru8CYrgj4B4uMbFkV5LNUyNmt/AckII=; b=UYJDr6ByqkvKWw/c9Bz82X2uMeBgm/iPQFxgG44T/TAuSHbxaxxQLZYxYEX5UVY29o H+gfCbVIdtFlN2GQCSP8XNLxM8AjK+J3NJoZP0ac6iUfhL0rrRQ7eoSXVEVgZWFtmBhw 3e7P1k9PALXjcFrFtSRHeMsQnK0OKy2+0cVlY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725289227; x=1725894027; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xk9nXu+h1O9Dru8CYrgj4B4uMbFkV5LNUyNmt/AckII=; b=Nk0XR480hWEJo5ydnppsfXHcLMRObRQyyaJ9rsk4HlUSXj5ieHo47MD39RCwdwmtLr dsEhe4kB8mtUSu17TSZQHLhcV6NArCMk3prNMsYh4Ow/gSIVX0nfP7MsIpAIVdRaufFw n+f/ylPhVjZ7i0Q4Lv1cGuo/+dpoyLhJ7YjYbrmOJrr/2P2W4qO7T0nyoMK52l8dlzep Qjr6VHbXWqn7dFEcuQTjaq96sH2cESHhRSuXOjnXt2GyjeSlmBXWv48favt4J3WCVe5i TrdAI7nOzYcxjsUdvzZYoJzU4Mhd3JoDPhIv1T+c3BswI1ndVRXa+/PlkWQmqrMOfCHL 3UVQ== X-Gm-Message-State: AOJu0Yy8y8aC9d9QI5TcOaq/M7+TGTPhV5J6k1Dw2u4xgvWi5ndAo7wc SQZqRU//RDgiVAjjweNkyEy1e/8OcF9G0i5ZrjeiSeXMOLmrsSQln9Gy0F2be2PsRZaE1XAhCY5 C X-Google-Smtp-Source: AGHT+IHfnQoWDIEilWhTNa2Suo9mAr1UlJQtCwalzPphBZNo8NWXfI/XyzlnAzXmUUY8gDwefeX1Cg== X-Received: by 2002:a05:651c:b0c:b0:2f3:cabc:6158 with SMTP id 38308e7fff4ca-2f62903f7efmr52389461fa.11.1725289226521; Mon, 02 Sep 2024 08:00:26 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH] x86/cpu: revert opt_allow_unsafe from __ro_after_init to __read_mostly Date: Mon, 2 Sep 2024 17:00:16 +0200 Message-ID: <20240902150016.63072-1-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725289249923116600 Making opt_allow_unsafe read only after init requires changes to the logic = in init_amd(), otherwise the following #PF happens on CPU hotplug: Reported-by: Andrew Cooper Reviewed-by: Jan Beulich ----[ Xen-4.20.0-1-d x86_64 debug=3Dy Tainted: H ]---- CPU: 1 RIP: e008:[] arch/x86/cpu/amd.c#init_amd+0x37f/0x993 [...] Xen call trace: [] R arch/x86/cpu/amd.c#init_amd+0x37f/0x993 [] F identify_cpu+0x2d4/0x4db [] F start_secondary+0x22e/0x3cf [] F __high_start+0x87/0xa0 Pagetable walk from ffff82d0404011ea: L4[0x105] =3D 000000006fc2e063 ffffffffffffffff L3[0x141] =3D 000000006fc2b063 ffffffffffffffff L2[0x002] =3D 000000807c7ca063 ffffffffffffffff L1[0x001] =3D 800000006f801121 ffffffffffffffff **************************************** Panic on CPU 1: FATAL PAGE FAULT [error_code=3D0003] Faulting linear address: ffff82d0404011ea **************************************** For the time being revert opt_allow_unsafe to be __read_mostly. Reported-by: Andrew Cooper Fixes: bfcb0abb191f ('types: replace remaining uses of s8') Signed-off-by: Roger Pau Monn=C3=A9 --- xen/arch/x86/cpu/amd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/x86/cpu/amd.c b/xen/arch/x86/cpu/amd.c index 903be14af4b9..7da04230393a 100644 --- a/xen/arch/x86/cpu/amd.c +++ b/xen/arch/x86/cpu/amd.c @@ -46,7 +46,7 @@ static unsigned int __initdata opt_cpuid_mask_thermal_ecx= =3D ~0u; integer_param("cpuid_mask_thermal_ecx", opt_cpuid_mask_thermal_ecx); =20 /* 1 =3D allow, 0 =3D don't allow guest creation, -1 =3D don't allow boot = */ -int8_t __ro_after_init opt_allow_unsafe; +int8_t __read_mostly opt_allow_unsafe; boolean_param("allow_unsafe", opt_allow_unsafe); =20 /* Signal whether the ACPI C1E quirk is required. */ --=20 2.46.0