From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752640AbcHLVQM (ORCPT ); Fri, 12 Aug 2016 17:16:12 -0400 Received: from mga09.intel.com ([134.134.136.24]:46333 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752250AbcHLVQK (ORCPT ); Fri, 12 Aug 2016 17:16:10 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.28,512,1464678000"; d="scan'208";a="864549355" Subject: Re: [RESEND PATCH v4] x86/hpet: Reduce HPET counter read contention To: Andy Lutomirski , Waiman Long References: <1470853770-37625-1-git-send-email-Waiman.Long@hpe.com> <57ACD2DE.6080306@intel.com> <57AD0898.7030506@hpe.com> <57AD18D1.1050107@intel.com> <57AE00EE.8070904@hpe.com> <57AE0469.10503@intel.com> <57AE1606.2010304@hpe.com> Cc: Thomas Gleixner , John Stultz , Ingo Molnar , "linux-kernel@vger.kernel.org" , Borislav Petkov , Jiang Liu , Randy Wright , Scott J Norton , Douglas Hatch , Prarit Bhargava , X86 ML , "H. Peter Anvin" From: Dave Hansen Message-ID: <57AE3C99.8070000@intel.com> Date: Fri, 12 Aug 2016 14:16:09 -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: Content-Type: text/plain; charset=utf-8 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 01:18 PM, Andy Lutomirski wrote: > I don't think this is right. If the HPET ever returns the same value > twice in a row (unlikely because it's generally too slow to read, but > it's plausible that someone will make a fast HPET some day), then this > could deadlock. True... I guess that means we've got to do some kind of sequence counter preferably in the same cacheline as the HPET value itself, or _something that we guarantee to change on each write to the cached value. > Also, does this code need to be NMI-safe? This implementation is > deadlocky if it's called from an NMI. Urg. Can't we just do if (in_nmi()) return read_real_hpet(); ? > The original code was wait-free, right? That was a nice property, too. You mean no spins? I don't think this one really spins ever either.