Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7244880ybl; Wed, 15 Jan 2020 18:36:46 -0800 (PST) X-Google-Smtp-Source: APXvYqwV0ZPFrCGEVxDM/zp7XbivEDOmnV9Ly/1kpy4iozUniKuG/2u97lqrqTZFVTfArcbcdBdf X-Received: by 2002:aca:5bd6:: with SMTP id p205mr2588584oib.132.1579142206167; Wed, 15 Jan 2020 18:36:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579142206; cv=none; d=google.com; s=arc-20160816; b=RAkO7XEtYqGUro7YGgiK05f4IxfNA21fNne5GqD9/jAYxvZxygS+ZQJ1e9cCDK3bCg TrQh1xv4sC2c2TD6sE6iSEm93E93bfCEcWizaRmpgoVODoeFiFWVKm9D5YXysHV1UGrd NNmhg7Qp7TYjLpGWSuo3uf7ajn24i8qGkYgVBVJJpTHGkBRmgB91tywGb0jNrMDxab2P 8jPuRGvN6tqXZwTorg72+6LLeYU1ZjLf+MlnnfJzD2H155Tke2PscqbFkY5YIQh8VEC1 znuaOW+nCvrbf6Xq9tYQWiNxb4cFAjYA9YqaQWCCbR7G/7AO+rDczvV6HndZqOPEnnCB 8DAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:references :in-reply-to:subject:cc:to:from; bh=7/Q6mTWPZmA1Z+xUp0nL18KfYPeW/7fva1J/0Kbwlyk=; b=d+yoPhHsuIWmmgSOkLLPqBmlx++G8m4V+dT5YKrl3mseLcdC8cogp/pzu56DKYJYDx lW9k19UeWn4nZMN4mIDr8gQR4c4qoY1tNzKpS9HM7LQfvE/pvn2vjWH53dtQ02Z8uNGr NAqY0ETNR/7MYhrhFY/LKCln4OUhbaSNOLdz06E+f1zzD0PzdiaMqX9nymXZBf+A9Mbm CBAKUmY5/l9n+F7G2gVPIDvqI9tKA+cLZm053PWK5fgLnoRkkFFSnAzBdGnm71zf9tMe nzsnbs95xOCu/uNVxJEm3LNgPvyaBkRJGzouPXDGFOxNlXtH1sQpUe6k25creAq/Wp8W EzmA== 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 k8si13456243otf.66.2020.01.15.18.36.33; Wed, 15 Jan 2020 18:36:46 -0800 (PST) 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 S1730665AbgAPCGR (ORCPT + 99 others); Wed, 15 Jan 2020 21:06:17 -0500 Received: from Galois.linutronix.de ([193.142.43.55]:49858 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728905AbgAPCGQ (ORCPT ); Wed, 15 Jan 2020 21:06:16 -0500 Received: from p5b06da22.dip0.t-ipconnect.de ([91.6.218.34] helo=nanos.tec.linutronix.de) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1iruXy-0005Iv-BX; Thu, 16 Jan 2020 03:06:10 +0100 Received: by nanos.tec.linutronix.de (Postfix, from userid 1000) id CFB4910121C; Thu, 16 Jan 2020 03:06:09 +0100 (CET) From: Thomas Gleixner To: Waiman Long , Andrew Morton , Ingo Molnar Cc: linux-kernel@vger.kernel.org, Mike Rapoport , Kees Cook , Waiman Long Subject: Re: [PATCH v2] watchdog: Fix possible soft lockup warning at bootup In-Reply-To: <20200103151032.19590-1-longman@redhat.com> References: <20200103151032.19590-1-longman@redhat.com> Date: Thu, 16 Jan 2020 03:06:09 +0100 Message-ID: <87sgkgw3xq.fsf@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain 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 Waiman Long writes: > [ 25.496379] watchdog: BUG: soft lockup - CPU#14 stuck for 22s! [swapper/14:0] > > Further analysis of the situation revealed that the smp_init() call > itself took more than 20s for that 2-socket 56-core and 224-thread > server. > > [ 0.115632] CPU1: Booted secondary processor 0x0000000100 [0x431f0af1] > : > [ 27.177282] CPU223: Booted secondary processor 0x0000011b03 [0x431f0af1] So what? > By adding some instrumentation code, it was found that for cpu 14, > watchdog_enable() was called early with a timestamp of 1. That activates > the watchdog time checking logic. It was also found that the monotonic > time measured during the smp_init() phase runs much slower than the > real elapsed time as shown by the below debug printf output: > > [ 1.138522] run_queues, watchdog_timer_fn: now = 170000000 > [ 25.519391] run_queues, watchdog_timer_fn: now = 4170000000 > > In this particular case, it took about 24.4s of elapsed time for the > clock to advance 4s which is the soft expiration time that is required > to trigger the calling of watchdog_timer_fn(). That clock slowdown > stopped once the smp_init() call was done and the clock time ran at > the same rate as the elapsed time afterward. So the consequence is that you defer the soft lockup detector initialization instead of figuring out WHY this time difference happens. There is no clock slowdown. The clock keeps ticking at the same frequency so there must be something else which causes this deviation. > On a comparable CN9980 system from HPE, there was also a bit of clock > slowdown but not as much as the Cavium system: > > [ 1.177068] run_queues, watchdog_timer_fn: now = 1010000000 > [ 5.577925] run_queues, watchdog_timer_fn: now = 5010000000 > > Similar clock slowdown was not obseved on x86-64 systems. > > The clock slowdown in arm64 systems seems to be hardware specific. Maybe, but that's not a reasonable explanation. > Given the fact that the clock is less reliable during the smp_init() Which fact? An observation is not a fact. > call and that call can take a rather long time, one simple workaround > to avoid this soft lockup problem is to move lockup_detector_init() > call after smp_init() when the clock is reliable. This does fix the > soft lockup problem for that Cavium system and does not seem to affect > the operation of the watchdog. This is much easier than trying to fix > the clock slowdown problem in smp_init() as the watchdog timer is the > only timer function that can be active at such early boot stage anyway. Sure, it's much easier to weaken debug features instead of actually analyzing why there is a deviation between clocks which should not have any deviation in the first place. Root cause analysis is overrrated and just a pet pieve of grumpy old greybeards, right? Andrew, please drop this hackery. Thanks, tglx