Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp4342502imm; Mon, 30 Jul 2018 12:51:46 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfuWgJeVoALMijm3Gcy3QyaXQc5usK3D+Cw9yIBqqM1pR05INbZZ2Qy04qrQ/op5Ncka8LV X-Received: by 2002:a17:902:46e:: with SMTP id 101-v6mr17866910ple.39.1532980306691; Mon, 30 Jul 2018 12:51:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532980306; cv=none; d=google.com; s=arc-20160816; b=ERYjlGsesxd/ojClZ3t9OdXyGveOUx0R3I9fDNmLxGyvL5Noix0fmoAOd1c6qeJ28K NIcxOW0XxhIjSRL1DbFpYJxTGBaBdKFDwpYkvcFOv8JD1slp2K+PuVk1EOys5M1whf7+ bPhdl5FqFlWY8a6O4qxhjxjWKbbY/il0XmbWA+2Er+bTxFwaNDB7nCSaAXmtXI0tjyen dwb6Lj4caCZfnuak0+sjxeYw64ITlEH62SSYqc1pZ408qFMsa6u2ohHgSQoRCadMivlU Qso3vjLbNuNAfSjN43Uo0VqDGBnxM+70usCSsSsL8Rb1FSW3DfwJKajfnnk5Sy2BJAer Erdw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=AJNXIQW5i21sV++Ml3uISN0lds0WSXXQ7OGSXUvMCKs=; b=GGNz03x3OYseLzgHz0ZAb91OvvGHT+s9bq5izvuNM+cnKHph8HTX0nDQnXls5YRQxs +YJE+XMbdnIOKWcFV46200hzARhDjZQB3N8GukDHify1X4o5rmmaZbRqgFFw+h3nuRkj nVU2oWscpA0KfX7a0LvzmoMwlw/CYwtveJrDtknR/Ni0P+dvjfjL7fAQEsZDEv0Ux3qL Mwr0VkbsV9f4STlgUeEeVdVNH6Q4tdElAwmdsL2e6dmRkr73S97KwOvriqmyJ4UL5gHF d/gAk/Xv05FHUHj0dfzR/Jnc8Vs5c54pTVR8iYRNIfmRcFxZgtNLWpcFkiwSTLTk+cjF 8p3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a20-v6si11935756pgi.184.2018.07.30.12.51.32; Mon, 30 Jul 2018 12:51:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732042AbeG3V07 (ORCPT + 99 others); Mon, 30 Jul 2018 17:26:59 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:57355 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728769AbeG3V06 (ORCPT ); Mon, 30 Jul 2018 17:26:58 -0400 Received: from p4fea5a5a.dip0.t-ipconnect.de ([79.234.90.90] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1fkEAu-0006AY-Sw; Mon, 30 Jul 2018 21:49:49 +0200 Date: Mon, 30 Jul 2018 21:49:48 +0200 (CEST) From: Thomas Gleixner To: Eduardo Valentin cc: Peter Zijlstra , "Rafael J . Wysocki" , Ingo Molnar , "H. Peter Anvin" , Dou Liyang , Len Brown , "Rafael J. Wysocki" , "mike.travis@hpe.com" , Rajvi Jingar , Pavel Tatashin , Philippe Ombredanne , Kate Stewart , Greg Kroah-Hartman , x86@kernel.org, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org Subject: Re: [PATCH RESEND 1/1] x86: tsc: avoid system instability in hibernation In-Reply-To: <20180730164100.GD15414@u40b0340c692b58f6553c.ant.amazon.com> Message-ID: References: <20180726155656.14873-1-eduval@amazon.com> <20180730085354.GA2494@hirez.programming.kicks-ass.net> <20180730164100.GD15414@u40b0340c692b58f6553c.ant.amazon.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 30 Jul 2018, Eduardo Valentin wrote: > On Mon, Jul 30, 2018 at 10:53:54AM +0200, Peter Zijlstra wrote: > > On Thu, Jul 26, 2018 at 08:56:56AM -0700, Eduardo Valentin wrote: > > > System instability are seen during resume from hibernation when system > > > is under heavy CPU load. This is due to the lack of update of sched > > > clock data > > > > Which would suggest you're already running with unstable sched clock. > > Otherwise nobody would care about the scd stuff. > > Yes. I doubt that... > > > > What kind of machine are you running? What does: > > > > dmesg | grep -i tsc > > > > say? > > Here: > [ 0.000000] tsc: Fast TSC calibration using PIT > [ 0.004005] tsc: Detected 3000.000 MHz processor > [ 0.066796] TSC deadline timer enabled > [ 3.904269] clocksource: tsc: mask: 0xffffffffffffffff max_cycles: 0x2b3e459bf4c, max_idle_ns: 440795289890 ns > ... because if the sched clock would be unstable then you'd have something like 'TSC unstable' in dmesg, which you obviously do not. 'sched_clock: Marking unstable' is the other message which would be emitted. > > > The fix for this situation is to mark the sched clock as unstable > > > as early as possible in the resume path, leaving it unstable > > > for the duration of the resume process. This will force the > > > scheduler to attempt to align the sched clock across CPUs using > > > the delta with time of day, updating sched clock data. In a post > > > hibernation event, we can then mark the sched clock as stable > > > again, avoiding unnecessary syncs with time of day on systems > > > in which TSC is reliable. > > > > None of this makes any sense. Either you were already unstable and it > > should already have worked and them marking it stable is an outright > > bug, or your sched clock was stable but then your initial diagnosis of > > lack of scd updates is complete garbage. > > > > I see, or it is just a workaround for the underling issue. I, for sure, see no > lockups anymore after forcing the scd updates. The other thing which are not > super clear is that this happens during the unfreezing of tasks. If I get a > set of cpu hog tasks while unfreezing, I see the system throwing worqueue lockup > detectors in hibernation restore. Yes, it pretty much papers over something else. Can you please provide a full dmesg from boot to failure case? Another question: Does the system recover after issuing the lockup messages or is it hosed completely? Thanks, tglx