From nobody Sat May 4 17:50:18 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1630659002; cv=none; d=zohomail.com; s=zohoarc; b=JWHQDefu7j5w+3BPYxQcUn/66y3glRR0sGc1qsXGczOBRwc78JGc2NRjOxS/AnHOGXwLLNDxIGTw5IlRpkjcDXV3tiTIo5DjmsKoz8u4St6ZfErAWq9tzHhAWqIs3dd2G/yfmm1dHP26NLbwY/Mhz8+4KDPBOxqIggoGhTtMBZs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630659002; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2A79ijv44MFRRI4yP9IKOdGZLkyzD6D8f46U5bOTMG8=; b=bfghosaf+jvXWDSENAbApzqErJhrLAJw3kgXqlwXnQFwAAUHA/kWXGF9o4gSrQ+7QZgC1EbLnKI8pBl/cMbSLg0CO9TtZQnB8JFZsjYObzCHEClCdz58g7IMaNEWUbeWObmXzZcbODyekYLd5LgLgUdOUsJiO6pfr7Wb2TwUk8g= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1630659002604260.7442658338281; Fri, 3 Sep 2021 01:50:02 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177913.323698 (Exim 4.92) (envelope-from ) id 1mM4tP-0007MH-VH; Fri, 03 Sep 2021 08:49:47 +0000 Received: by outflank-mailman (output) from mailman id 177913.323698; Fri, 03 Sep 2021 08:49:47 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4tP-0007M5-Ru; Fri, 03 Sep 2021 08:49:47 +0000 Received: by outflank-mailman (input) for mailman id 177913; Fri, 03 Sep 2021 08:49:47 +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.92) (envelope-from ) id 1mM4tP-0006nG-Gh for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:49:47 +0000 Received: from smtp-out1.suse.de (unknown [195.135.220.28]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e0641dec-0c93-11ec-aefe-12813bfff9fa; Fri, 03 Sep 2021 08:49:41 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 67AF722666; Fri, 3 Sep 2021 08:49:40 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 1527913754; Fri, 3 Sep 2021 08:49:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id SD+dA6ThMWFjdAAAGKfGzw (envelope-from ); Fri, 03 Sep 2021 08:49:40 +0000 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: e0641dec-0c93-11ec-aefe-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1630658980; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=2A79ijv44MFRRI4yP9IKOdGZLkyzD6D8f46U5bOTMG8=; b=YaUyhefWzsHHkhY9meNyZ+nn5OZODEbPW68xXVIYL/Z3GsIY0wJ6ADl0f1uKxP/ao0IOzf 7tkHLaKoHp2ra3Mq30rV0xmgUe0Zvl3BHYlchwLyMW2aH5QnXmYyUenSuhEv6x4NLizQQM xQiOoW4Iv3P3Ud7OZuNeMHRCHmstlzk= From: Juergen Gross To: xen-devel@lists.xenproject.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , "Rafael J. Wysocki" , Len Brown , Pavel Machek , Greg Kroah-Hartman , "Rafael J. Wysocki" , stable@vger.kernel.org Subject: [PATCH 1/2] PM: base: power: don't try to use non-existing RTC for storing data Date: Fri, 3 Sep 2021 10:49:36 +0200 Message-Id: <20210903084937.19392-2-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210903084937.19392-1-jgross@suse.com> References: <20210903084937.19392-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1630659003585100003 Content-Type: text/plain; charset="utf-8" In there is no legacy RTC device, don't try to use it for storing trace data across suspend/resume. Cc: Signed-off-by: Juergen Gross Reviewed-by: Rafael J. Wysocki --- drivers/base/power/trace.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c index a97f33d0c59f..b7c80849455c 100644 --- a/drivers/base/power/trace.c +++ b/drivers/base/power/trace.c @@ -13,6 +13,7 @@ #include #include #include +#include =20 #include =20 @@ -165,6 +166,9 @@ void generate_pm_trace(const void *tracedata, unsigned = int user) const char *file =3D *(const char **)(tracedata + 2); unsigned int user_hash_value, file_hash_value; =20 + if (!x86_platform.legacy.rtc) + return 0; + user_hash_value =3D user % USERHASH; file_hash_value =3D hash_string(lineno, file, FILEHASH); set_magic_time(user_hash_value, file_hash_value, dev_hash_value); @@ -267,6 +271,9 @@ static struct notifier_block pm_trace_nb =3D { =20 static int __init early_resume_init(void) { + if (!x86_platform.legacy.rtc) + return 0; + hash_value_early_read =3D read_magic_time(); register_pm_notifier(&pm_trace_nb); return 0; @@ -277,6 +284,9 @@ static int __init late_resume_init(void) unsigned int val =3D hash_value_early_read; unsigned int user, file, dev; =20 + if (!x86_platform.legacy.rtc) + return 0; + user =3D val % USERHASH; val =3D val / USERHASH; file =3D val % FILEHASH; --=20 2.26.2 From nobody Sat May 4 17:50:18 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1630659001; cv=none; d=zohomail.com; s=zohoarc; b=m60Epvnkw20/9u3Q+p4VMJL6IlsduFpNWne0UAPWh3p9DOEW3pk+FaaqSNESL9Z1bdm7Tm3nUEPDbFxYo+wEkYYICqd7/3ElgcrSULSNJvjVfTnONzAVI9Af18GjR4ebypSpsbBdb24/LPVgNgm+BD3/bfzpZ1WJ5WkZuoXUR/0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1630659001; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=cDxNZDOT6mQUMNCs/5bHO5A+JEd2XgxBAJXhmBdSbbw=; b=dzbbyGn/69ID/eXvDhoPjSOYjmJy6wXHCN23zoraflQCDGzO2z7Bk+kkJfgfeoQrOvGwrWmIgu4LRUausayxxJCcw9t5vdogypdl41pOBiTy+AsclmQqLwXlEJHkvZ/TvY8YWFjMAVwzklEFto8mNqP8us9yCQLXInljvAXfAjI= 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=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1630659001759460.3607283568181; Fri, 3 Sep 2021 01:50:01 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.177912.323687 (Exim 4.92) (envelope-from ) id 1mM4tM-00073S-MJ; Fri, 03 Sep 2021 08:49:44 +0000 Received: by outflank-mailman (output) from mailman id 177912.323687; Fri, 03 Sep 2021 08:49:44 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mM4tM-00073L-Ir; Fri, 03 Sep 2021 08:49:44 +0000 Received: by outflank-mailman (input) for mailman id 177912; Fri, 03 Sep 2021 08:49:42 +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.92) (envelope-from ) id 1mM4tK-0006nG-Mc for xen-devel@lists.xenproject.org; Fri, 03 Sep 2021 08:49:42 +0000 Received: from smtp-out2.suse.de (unknown [195.135.220.29]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id e0641ded-0c93-11ec-aefe-12813bfff9fa; Fri, 03 Sep 2021 08:49:41 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id C9E082001B; Fri, 3 Sep 2021 08:49:40 +0000 (UTC) Received: from imap1.suse-dmz.suse.de (imap1.suse-dmz.suse.de [192.168.254.73]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap1.suse-dmz.suse.de (Postfix) with ESMTPS id 71D981374A; Fri, 3 Sep 2021 08:49:40 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap1.suse-dmz.suse.de with ESMTPSA id eKY/GqThMWFjdAAAGKfGzw (envelope-from ); Fri, 03 Sep 2021 08:49:40 +0000 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: e0641ded-0c93-11ec-aefe-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1630658980; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cDxNZDOT6mQUMNCs/5bHO5A+JEd2XgxBAJXhmBdSbbw=; b=VbpC8r2iK1pOQ9eNi1TouFnvGAEG3Q2l//bLETrWhVa1Mvebnw9WTw+3fU42jh0vUotgsp luWP3rWesmgxuuRQkhvF72sZKVDy7LzQ6MpzomsIjNTl9HKI+OUwVrQXGEPTWdiRmsnWai o6EzteyS0M7u3UJpASPIGqLHXQUgGIo= From: Juergen Gross To: xen-devel@lists.xenproject.org, x86@kernel.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Boris Ostrovsky , Stefano Stabellini , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , stable@vger.kernel.org Subject: [PATCH 2/2] xen: reset legacy rtc flag for PV domU Date: Fri, 3 Sep 2021 10:49:37 +0200 Message-Id: <20210903084937.19392-3-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210903084937.19392-1-jgross@suse.com> References: <20210903084937.19392-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1630659003350100001 Content-Type: text/plain; charset="utf-8" A Xen PV guest doesn't have a legacy RTC device, so reset the legacy RTC flag. Otherwise the following WARN splat will occur at boot: [ 1.333404] WARNING: CPU: 1 PID: 1 at /home/gross/linux/head/drivers/rtc= /rtc-mc146818-lib.c:25 mc146818_get_time+0x1be/0x210 [ 1.333404] Modules linked in: [ 1.333404] CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 5.= 14.0-rc7-default+ #282 [ 1.333404] RIP: e030:mc146818_get_time+0x1be/0x210 [ 1.333404] Code: c0 64 01 c5 83 fd 45 89 6b 14 7f 06 83 c5 64 89 6b 14 = 41 83 ec 01 b8 02 00 00 00 44 89 63 10 5b 5d 41 5c 41 5d 41 5e 41 5f c3 <0f= > 0b 48 c7 c7 30 0e ef 82 4c 89 e6 e8 71 2a 24 00 48 c7 c0 ff ff [ 1.333404] RSP: e02b:ffffc90040093df8 EFLAGS: 00010002 [ 1.333404] RAX: 00000000000000ff RBX: ffffc90040093e34 RCX: 00000000000= 00000 [ 1.333404] RDX: 0000000000000001 RSI: 0000000000000000 RDI: 00000000000= 0000d [ 1.333404] RBP: ffffffff82ef0e30 R08: ffff888005013e60 R09: 00000000000= 00000 [ 1.333404] R10: ffffffff82373e9b R11: 0000000000033080 R12: 00000000000= 00200 [ 1.333404] R13: 0000000000000000 R14: 0000000000000002 R15: ffffffff82c= dc6d4 [ 1.333404] FS: 0000000000000000(0000) GS:ffff88807d440000(0000) knlGS:= 0000000000000000 [ 1.333404] CS: 10000e030 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1.333404] CR2: 0000000000000000 CR3: 000000000260a000 CR4: 00000000000= 50660 [ 1.333404] Call Trace: [ 1.333404] ? wakeup_sources_sysfs_init+0x30/0x30 [ 1.333404] ? rdinit_setup+0x2b/0x2b [ 1.333404] early_resume_init+0x23/0xa4 [ 1.333404] ? cn_proc_init+0x36/0x36 [ 1.333404] do_one_initcall+0x3e/0x200 [ 1.333404] kernel_init_freeable+0x232/0x28e [ 1.333404] ? rest_init+0xd0/0xd0 [ 1.333404] kernel_init+0x16/0x120 [ 1.333404] ret_from_fork+0x1f/0x30 Cc: Signed-off-by: Juergen Gross Reviewed-by: Boris Ostrovsky --- arch/x86/xen/enlighten_pv.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arch/x86/xen/enlighten_pv.c b/arch/x86/xen/enlighten_pv.c index 753f63734c13..349f780a1567 100644 --- a/arch/x86/xen/enlighten_pv.c +++ b/arch/x86/xen/enlighten_pv.c @@ -1214,6 +1214,11 @@ static void __init xen_dom0_set_legacy_features(void) x86_platform.legacy.rtc =3D 1; } =20 +static void __init xen_domu_set_legacy_features(void) +{ + x86_platform.legacy.rtc =3D 0; +} + /* First C function to be called on Xen boot */ asmlinkage __visible void __init xen_start_kernel(void) { @@ -1359,6 +1364,8 @@ asmlinkage __visible void __init xen_start_kernel(voi= d) add_preferred_console("xenboot", 0, NULL); if (pci_xen) x86_init.pci.arch_init =3D pci_xen_init; + x86_platform.set_legacy_features =3D + xen_domu_set_legacy_features; } else { const struct dom0_vga_console_info *info =3D (void *)((char *)xen_start_info + --=20 2.26.2