From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752503AbcHLVoM (ORCPT ); Fri, 12 Aug 2016 17:44:12 -0400 Received: from mga09.intel.com ([134.134.136.24]:40338 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751154AbcHLVoL (ORCPT ); Fri, 12 Aug 2016 17:44:11 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,512,1464678000"; d="scan'208";a="1013472004" Subject: Re: [PATCH v5] x86/hpet: Reduce HPET counter read contention To: Waiman Long , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" References: <1471037130-60583-1-git-send-email-Waiman.Long@hpe.com> Cc: linux-kernel@vger.kernel.org, x86@kernel.org, Borislav Petkov , Andy Lutomirski , Prarit Bhargava , Scott J Norton , Douglas Hatch , Randy Wright From: Dave Hansen Message-ID: <57AE432A.9010201@intel.com> Date: Fri, 12 Aug 2016 14:44:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: <1471037130-60583-1-git-send-email-Waiman.Long@hpe.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/12/2016 02:25 PM, Waiman Long wrote: > + do { > + cpu_relax(); > + new.lockval = READ_ONCE(hpet.lockval); > + } while ((new.value == old.value) && raw_spin_is_locked(&new.lock)); While it gets more far-fetched, this isn't guaranteed to make progress until the saved HPET value actually changes. You could have a constant stream of other CPUs going and doing hpet_readl() (and getting the same value back from a sloooow HPET). So each time through this loop, this processor sees (new.value == old.value), and sees the lock held.