Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp717078ybl; Fri, 9 Aug 2019 12:41:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwuBrCwDX/D/yyuz1p8ukA1tZjYlh53lY1cIKAc6qgwQD0EG58oGExrO5vVN3Paai2XfG9P X-Received: by 2002:a63:e610:: with SMTP id g16mr18469357pgh.392.1565379704073; Fri, 09 Aug 2019 12:41:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565379704; cv=none; d=google.com; s=arc-20160816; b=01TejS4bzwZds19/jZBhxbjuAH+xAOOicyhPwvV9BhPgqThauFbcvUqeUm2fOGU3d4 G/NV9GQhk4iQTfIm+m8kJUvPaCRu+H53TXohvHai7Rt64wAO1xMwM0ICX2L5nhG8QE/z 4FqCeerIpB0m17G3ISb95+7ti8JuGX1bZMXM0/tlN0PJRcIo26I5GEzBPblFMRfJrbDW gdoD9C34T4bCD/ipOOVHj0RgGfzGnkMvjImrgCV4iQyfA6nLct7cl1ylQIafTTqhxhIe vaAzCb4JZdkMtvD0ftSSgAqO2WTY5hwbZ2EDM3LxAS3ei8+6VOV+/AxdBgVoawElTTKq mmZA== 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; bh=6erdfhGkEsAxmz1vFYrK5/2OyoXc1pZL/UL/rBFiYSQ=; b=ngeEtkMO2mu75Fwv7hqOk/5mxdZb1D+F94ltVii/4lgG2yx5sod51ykVMbVtypS9Kh KUVy7ldXFEjmdG+CnWHJ018DwPI0GxBo+dm0V1AiaZUyZKs/gPOnyb6uV/Kef3bzhwJ5 UJyOy8DwWC9KioBaha02MK6G97SSe1vZivPwZ9i5HuZDknJBvUZxf8Il9wkOJq7hRwhE 7goHtohmz7ZUsKvBVIFbca5CHjqkxh5pBuBK4j72WTAUw8kaTlz+2I9MrxxHu2NhGX0y zU5+XEXfV82ewGM3qS4NHItK7hCfDl2c8+S30q7FDIXmZLFL6zgjE09VtmY7jr2iXw4D Loiw== 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 69si13877327pgc.40.2019.08.09.12.41.28; Fri, 09 Aug 2019 12:41:44 -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 S1726263AbfHITko (ORCPT + 99 others); Fri, 9 Aug 2019 15:40:44 -0400 Received: from Galois.linutronix.de ([193.142.43.55]:57634 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725825AbfHITkn (ORCPT ); Fri, 9 Aug 2019 15:40:43 -0400 Received: from p200300ddd71876457e7a91fffec98e25.dip0.t-ipconnect.de ([2003:dd:d718:7645:7e7a:91ff:fec9:8e25]) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1hwAkZ-000558-T9; Fri, 09 Aug 2019 21:40:31 +0200 Date: Fri, 9 Aug 2019 21:40:26 +0200 (CEST) From: Thomas Gleixner To: "Lendacky, Thomas" cc: "Li, Aubrey" , Daniel Drake , "x86@kernel.org" , "H . Peter Anvin" , Linux Kernel , Endless Linux Upstreaming Team , Jiri Slaby Subject: Re: [PATCH] x86/apic: Handle missing global clockevent gracefully In-Reply-To: Message-ID: References: <81666b28-d029-56c3-8978-90abc219d1b7@linux.intel.com> <3d14b0cc-3cca-1874-3521-4ee2ec52141d@amd.com> <5bf28ba4-b7c1-51de-88ae-feebae2a28db@amd.com> <75e59ac6-5165-bd0a-aec9-be16d662ece9@amd.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 Fri, 9 Aug 2019, Lendacky, Thomas wrote: > On 8/9/19 7:54 AM, Thomas Gleixner wrote: > > + local_irq_disable(); > > /* > > * Setup the APIC counter to maximum. There is no way the lapic > > * can underflow in the 100ms detection time frame > > */ > > __setup_APIC_LVTT(0xffffffff, 0, 0); > > > > - /* Let the interrupts run */ > > - local_irq_enable(); > > + /* > > + * Methods to terminate the calibration loop: > > + * 1) Global clockevent if available (jiffies) > > + * 2) TSC if available and frequency is known > > + */ > > + jif_start = READ_ONCE(jiffies); > > + > > + if (tsc_khz) { > > + tsc_start = rdtsc(); > > + tsc_perj = div_u64((u64)tsc_khz * 1000, HZ); > > + } > > + > > + while (lapic_cal_loops <= LAPIC_CAL_LOOPS) { > > + /* > > + * Enable interrupts so the tick can fire, if a global > > + * clockevent device is available > > + */ > > + local_irq_enable(); > > Just a nit, but you end up doing this at the bottom of the loop, so you > could move this invocation to just before the loop and avoid doing two > local_irq_enable() calls in succession after the first iteration. Indeed. Lets see how the reports go. That change is a nobrainer. Thanks, tglx