Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3660653imu; Sun, 11 Nov 2018 20:48:59 -0800 (PST) X-Google-Smtp-Source: AJdET5fzldaJDlmezGvsMTCHrgIjBq2t9P8Vn+9J+GEPORvz4C43ib8Ef2K1gCgeZ9AI4kWQQIBm X-Received: by 2002:a65:4946:: with SMTP id q6mr8948312pgs.201.1541998139790; Sun, 11 Nov 2018 20:48:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541998139; cv=none; d=google.com; s=arc-20160816; b=S5oi90gYqnoUzkbFAscFXWAi9nuPT0iH+U8aG7ZLoFyPli9QNRtqO6UMp5ALxmv6Eq RzDOUZRJ5s5A9OateH6vqTwopBj6Bh/GgDyn5Eg515HK8NiSseRW+Xr4gFEVnfDptT8Z owTNt4koiXsybQ2bNpWeqj5gUpMMuXujrMVWIVDnp8OtBQueOHb1Q0+sj+UN34bazHxH mLBm+62vZs4iO6IqWy0wl2tuKfBHhfv0iVxV53QoE21gc+zNt4IeV03PSkmv/klzDUus bDjePq+rZOToAgvx5e9z8e5ePHJmNjYcbbXtdnnIDh/fpVaSzPkOPwLR98YSF93+RfmB CCpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:subject:from:references:in-reply-to :message-id:cc:to; bh=knFLxFndB5uwvkRvkOlOqI5gihPaOHO/Bi96zV/qzpA=; b=GOxrK5B/wZs3s47wkortuyagKlVKbMxbwOuN4C8EFt89CTAlqepboznt4/HsMKp/q+ NrGAw9pNCJ5rpFwrEtDKORkXLqRdygiAbvgB2ZGPgn2yQ2mFDTKvmgrZcikl/Xcym207 h18alAyr0UdV8wD04d/+/BzjM/vO0SetOwJ/4OSnNANh3kyec5Q67p1WbvstMRcKHpt0 G9WoDVPOTcE4Ze0NX4wqhyJFUqhubp3ki3ePrTA8NJ1tqBeA5jfjKAjWemRuMcdnvnau LRlNZ+mh0a4eqt6pStxhiPVooCQhQZSArnmwe2uir2sqvbNyZp46KkLFFEx5dym4zbCy HR9A== 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 a21-v6si6662028pls.13.2018.11.11.20.48.45; Sun, 11 Nov 2018 20:48:59 -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 S1730779AbeKLOiX (ORCPT + 99 others); Mon, 12 Nov 2018 09:38:23 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:48554 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727665AbeKLOiW (ORCPT ); Mon, 12 Nov 2018 09:38:22 -0500 Received: by kvm5.telegraphics.com.au (Postfix, from userid 502) id 75868297D8; Sun, 11 Nov 2018 23:46:55 -0500 (EST) To: Geert Uytterhoeven , Russell King Cc: Arnd Bergmann , Stephen N Chivers , Thomas Gleixner , Daniel Lezcano , John Stultz , linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Message-Id: In-Reply-To: References: From: Finn Thain Subject: [RFC PATCH 01/13] arm: Fix mutual exclusion in arch_gettimeoffset Date: Mon, 12 Nov 2018 15:12:39 +1100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Implementations of arch_gettimeoffset are generally not re-entrant and assume that interrupts have been disabled. Unfortunately this pre-condition got broken in v2.6.32. Fixes: 5cfc8ee0bb51 ("ARM: convert arm to arch_gettimeoffset()") Signed-off-by: Finn Thain --- arch/arm/mach-ebsa110/core.c | 5 +++++ arch/arm/mach-rpc/time.c | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm/mach-ebsa110/core.c b/arch/arm/mach-ebsa110/core.c index 688e5fed49a7..479f89a1accf 100644 --- a/arch/arm/mach-ebsa110/core.c +++ b/arch/arm/mach-ebsa110/core.c @@ -160,12 +160,17 @@ static void __init ebsa110_init_early(void) */ static u32 ebsa110_gettimeoffset(void) { + unsigned long flags; unsigned long offset, count; + local_irq_save(flags); + __raw_writeb(0x40, PIT_CTRL); count = __raw_readb(PIT_T1); count |= __raw_readb(PIT_T1) << 8; + local_irq_restore(flags); + /* * If count > COUNT, make the number negative. */ diff --git a/arch/arm/mach-rpc/time.c b/arch/arm/mach-rpc/time.c index 2689771c1d38..852bb3801638 100644 --- a/arch/arm/mach-rpc/time.c +++ b/arch/arm/mach-rpc/time.c @@ -29,9 +29,12 @@ static u32 ioc_timer_gettimeoffset(void) { + unsigned long flags; unsigned int count1, count2, status; long offset; + local_irq_save(flags); + ioc_writeb (0, IOC_T0LATCH); barrier (); count1 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8); @@ -42,6 +45,8 @@ static u32 ioc_timer_gettimeoffset(void) barrier (); count2 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8); + local_irq_restore(flags); + offset = count2; if (count2 < count1) { /* -- 2.18.1