Received: by 2002:a05:7412:d8a:b0:e2:908c:2ebd with SMTP id b10csp3371272rdg; Tue, 17 Oct 2023 12:31:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGMnEbk4Kab4XrYoUuiE+H6Essv8KAyCezixNn/iAdxu87gyIYAs+hb/uI6GLvJc2sQFPCU X-Received: by 2002:a05:6a21:3984:b0:17b:1ab9:5790 with SMTP id ad4-20020a056a21398400b0017b1ab95790mr1479096pzc.50.1697571095595; Tue, 17 Oct 2023 12:31:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1697571095; cv=none; d=google.com; s=arc-20160816; b=Z8lm0gB5Z34jUWw1NrmW9na+CySGzW0Ob+TB3D+6IvAzS9cmNUnRwvQHNj893o0rh5 L26CR3pSjM5VxH493nsAkCaPsuAXXV3Bkojtc0Jk1l4nzN6oF/DNRYKpW05pCXi98TKo V7Gkho9rqcCHHggHv4CQyaWaqL6TOaoN/jO/3HI85q+z3U89Nmluy7AjgSBQVDqSXO1Y ZVLaGgsA+o7SuH7ozrTIn9CmeoeXBPyk1H0k1V7Zp0tyx05Op5mMAPoWz55poq3DycBd 8vN22aZg8GqtzNXbWlcTRCntGzgBxqjABQUm5ZB2G80iWFbonBB8XkNwdvNDWF/qIB9c 9V3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=C/BDofzE4Or/7ySerAf5AsywpyZJIdw+bPNUdrWopVA=; fh=NRu8hFAbNhwwaxfkQLurrsyg+J/jz/JBAqnAKnOUwys=; b=NmsFzDwS5zixpNsQL/e/Ku+2k8fwLcl0pjiFGM19SZVO2JHnkw5udOvMsUzzrPsqRk WI/ZbRcJkscQGG5717mg9wbxHx/2r16FhF5O4Sco3kCYd6Y9PCWY7QIemP0vECJH4WYm gYNktuqnnAg1BpBszKBDOtUZ8Iuqo6NOxuhaD+lmujyBNWC0fYiH6FhV8MhIUTD5G7t5 No+EBrefH2z+JKr2oaBtzohGUjVVZa6XTUN8V2cZMNIkxpQZKdF3u3EGlLav2pJpuRCh KDJYhg1ZdR27zQHzbyeLPzGOKJ6YmAF1qi/L9lkPgkk3RbmVLdBFpxu3GF4OG37aPvBa g5fg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RclkpbU6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id j63-20020a638042000000b00537c6c285a0si443401pgd.167.2023.10.17.12.31.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:31:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RclkpbU6; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3FBD9807C64A; Tue, 17 Oct 2023 12:30:34 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235013AbjJQTaY (ORCPT + 99 others); Tue, 17 Oct 2023 15:30:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35588 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235034AbjJQTaW (ORCPT ); Tue, 17 Oct 2023 15:30:22 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 132A4ED for ; Tue, 17 Oct 2023 12:30:21 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50435ad51bbso7949752e87.2 for ; Tue, 17 Oct 2023 12:30:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697571019; x=1698175819; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=C/BDofzE4Or/7ySerAf5AsywpyZJIdw+bPNUdrWopVA=; b=RclkpbU6pGb/dbYGBaf4Qf8cNdZ7WTIKzjQkZu0e/o16Oi/SMxSFL7jE02X7d1XYc+ E9/H+lSzqxGznZcA6t4VfjxoG2K3RHoDbMUmj3Vlaa70u0Fn4NWTCfcF6hNZA/hav7Ix gqumiry0/HW3Puejr4kpG70Kx01MLoRJL+v7bevEonaG6Gie75PCDlZjZMy3sBHuvq/t uotvn/mQyPXEqGuGhqkmWdwG9akJ2UNjViODZtPNDx4LwtSsIdYb2yPk1NscZ8HPRKMz HLGAhY/SZn270CgCEvQzTiEiW5dMdJE4Wd2jKIk86bCngoYa4qmrFHGJL6s0toCdSum0 t9uA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697571019; x=1698175819; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=C/BDofzE4Or/7ySerAf5AsywpyZJIdw+bPNUdrWopVA=; b=oaYTtnBeKHJjGG6EG0lrBikYOIySXI+Sd5LrI3STM+kQS5XVL2g1WgPjUpFdB+KeGB xdnsMGYdT7dfd9gLPf3UmPwBQ/Qrg2d8URB9karq8uXpIvVuFQ+eKKp8aMQO433c3qBC giPjPyDr2xTVA/flK7ecC/kt87mD7eSlRmcYlM0FKqJtsoDDND9Nd7m5eEbimmcUabWK fI+CoOa5YZTL3J/7y6GAfZpdTHkN+25XJ4Y1eWXQSav4ispXZKyCe1i6gXe8ktfmKKP0 xlYVTznGV1hFJSlBxfYEd64gMa9bQPj2tY8IWFNVNSKUpq2Bb6JIcsoonzt/e5hJhb9W KyWQ== X-Gm-Message-State: AOJu0YyrwARQP4u7rYORFyJuajjTnwuvQozelu3VNYJ7OMvGrhXQT4jt iGq8MAWvaDbcSumpLkcPuPPXYik0lFI= X-Received: by 2002:a19:500d:0:b0:500:9a29:bcb8 with SMTP id e13-20020a19500d000000b005009a29bcb8mr2571559lfb.4.1697571019023; Tue, 17 Oct 2023 12:30:19 -0700 (PDT) Received: from shift.daheim (p200300d5ff3cda00aaa159fffeeb01f1.dip0.t-ipconnect.de. [2003:d5:ff3c:da00:aaa1:59ff:feeb:1f1]) by smtp.gmail.com with ESMTPSA id f17-20020a50a6d1000000b0052ffc2e82f1sm1728909edc.4.2023.10.17.12.30.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Oct 2023 12:30:18 -0700 (PDT) Received: from localhost.daheim ([127.0.0.1] helo=shift.localnet) by shift.daheim with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.97-RC2) (envelope-from ) id 1qspli-000000009ct-0VOa; Tue, 17 Oct 2023 21:30:18 +0200 From: Christian Lamparter To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, seanjc@google.com, klaus.espenlaub@oracle.com, bp@alien8.de, glx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, hpa@zytor.com Subject: Re: [PATCH v1] x86/cpu/cacheinfo: fix panic on Ryzen Mobile 7x40 series in VBox VM Date: Tue, 17 Oct 2023 21:30:17 +0200 Message-ID: <4550917.LvFx2qVVIh@shift> In-Reply-To: <652989ad8a7f110bad16cf1244c4c68a823f0afe.1693606609.git.chunkeey@gmail.com> References: <652989ad8a7f110bad16cf1244c4c68a823f0afe.1693606609.git.chunkeey@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Spam-Status: No, score=-0.6 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 17 Oct 2023 12:30:34 -0700 (PDT) Heads up! Oracle addressed this with their virtualbox 7.0.12 release. If you are affected, try it! On Saturday, September 2, 2023 12:19:11 AM CEST Christian Lamparter wrote: > Ryzen Mobile 7x40 chips experience an early kernel fault > (division by zero) due to nonexistent input validation > from CPUID data in amd_cpuid4(). > > This error was first reported on reddit [0] for a > "AMD Ryzen 9 7940HS w/ Radeon 780M Graphics", but since then > the bug has been reproduced on a "AMD Ryzen 7 7840HS" Laptop > too. > > [...] > > The reason why this is happening is because the Ryzen CPU reports in its > CPUID 80000006 edx register (which contains the L3 Cache Information) > the value "00009000". This magic value means according to AMD's > "AMD64 Architecture Programmer's Manual Volume 3" Table E-4. > "L2/L3 Cache and TLB Associativity Field Encoding": > > | Value for all fields should be determinded from Fn8000_001D. > > (This means to look in cpuid(0x8000001D,...) instead.) > > So, amd_cpuid4() is missing this special case. A case which has been > present - according to this AMD Community post [1] - since > Zen 2/Ryzen 3000 Series. > > But wait, why is this only happening with Linux' when running under > VirtualBox with these Ryzen Mobile CPUs and not when running natively? > [...]