Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1295860imu; Tue, 20 Nov 2018 15:14:44 -0800 (PST) X-Google-Smtp-Source: AFSGD/WwXCn8F5+iPbM4U9VKVetrqzIQs9mwt8z2eEgmbcHDULV545YZJ2ryKq1a0vUzrQoWsVg5 X-Received: by 2002:a63:7f4f:: with SMTP id p15mr3751513pgn.296.1542755684260; Tue, 20 Nov 2018 15:14:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542755684; cv=none; d=google.com; s=arc-20160816; b=XcIWmYBs9QZxf9LLylWPAqSHSZ9QHaNavKb0oS0sFm9w7RNxQ3/jjdB2Hs6dC6URwM yBlevG5u6R20M2R4JA39eRblF0tdOC9h5A2NYQ5UnBjefP73EhAADTdFocapfGg1BG0i rRKE5f1Ll0Oyx2Cc4/Ot4D2pxdqn+6P4P1dLwlsA9N/JZBzrvLVQCIwKA5KhSjOaBeST yqbN0PPtMylDFWvhjmnzGi74tTw9THldA60u897bLCfOxUaNBesgyzkY34Wi/Qgvf2BB Q1ODNM/wZzJ7EF3X5oML/hDw14G7/6hsnV/NllbQJNpqJdNMKkbNxl4bdv/Ka6IzO/Kc +8hw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:message-id :in-reply-to:subject:cc:to:from:date; bh=yKd8xUB03VSuy6xT61Xg04A06NTDalOoFBkTHUHZKnw=; b=RTp+XNNm9c+Z0ZGeT+tIf5ImDJdSXKSjUHlRMT0HiuMm45URoBtKpODRAA3risJ74T FXHHDLNk4BiIaFsgtnLT7nKmgBfXOhdHDozfnWDWC7flsLwxiDvHXTe0gIwXJFBL5qeK +pAuYVYAXjI82OMshloAmAEeJZL6UqetTykoPRW0Fhr3j2hEEb3nDIFd0+H3mhKvYWW6 BFSk7vx6vtxSRSlrOW1WBuc60ISi1MzZZXTwb7SWCYtoy3wvlWuDUjmhhZDIl0pL70Vx XpDY+TaZ8lfAbQ86dqfDQlon23JZwHLBzOzgn0HaRZlE/uaWwe7S701bLq3IPvgEQx0b 4gyQ== 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 15-v6si48402717pfr.242.2018.11.20.15.14.29; Tue, 20 Nov 2018 15:14:44 -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 S1726105AbeKUJpY (ORCPT + 99 others); Wed, 21 Nov 2018 04:45:24 -0500 Received: from kvm5.telegraphics.com.au ([98.124.60.144]:50234 "EHLO kvm5.telegraphics.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725999AbeKUJpY (ORCPT ); Wed, 21 Nov 2018 04:45:24 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by kvm5.telegraphics.com.au (Postfix) with ESMTP id 653E5281BE; Tue, 20 Nov 2018 18:13:41 -0500 (EST) Date: Wed, 21 Nov 2018 10:13:46 +1100 (AEDT) From: Finn Thain To: Kars de Jong cc: geert@linux-m68k.org, philb@gnu.org, schwab@linux-m68k.org, arnd@arndb.de, schivers@csc.com.au, tglx@linutronix.de, daniel.lezcano@linaro.org, schmitzmic@gmail.com, john.stultz@linaro.org, linus.walleij@linaro.org, linux-m68k@lists.linux-m68k.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v2 09/14] m68k: hp300: Remove hp300_gettimeoffset() In-Reply-To: Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 20 Nov 2018, Kars de Jong wrote: > Op ma 19 nov. 2018 om 02:10 schreef Finn Thain : > > > > hp300_gettimeoffset() never checks the timer interrupt flag and will > > fail to notice when the timer counter gets reloaded. That means the > > clock could jump backwards. > > > > Remove this code and leave this platform on the 'jiffies' clocksource. > > Note that this amounts to a regression in clock precision. However, > > adopting the 'jiffies' clocksource does resolve the monotonicity issue. > > > > Signed-off-by: Finn Thain > > --- > > hp300_gettimeoffset() cannot be used in a clocksource conversion > > unless it can be made monotonic. I can't fix this without knowing the > > details of the timer implementation, such as the relationship between > > the timer count and the interrupt flag. > > I don't really like this regression... > Me neither... I'll see if I can write a conversion patch based on the information you've provided. Can you test it? > According to NetBSD sources, there are 3 timers in the chip (originally > an MC6840 PTM). Thanks for the tip. I will examine the datasheet for the 6840. I'll also take another look at the NetBSD code. > Timer 1 is used as the system timer, timer 3 runs at the same rate and > is unused on Linux (on NetBSD it is used as the statistics/profiling > timer), and timer 3 is connected to timer 2 so you can make a 32-bit > timer out of the two timers together (also unused on Linux). > > Timers 1 counts down at 25 MHz. You mean, 250 kHz, right? The code in mainline programs the timer for 2500 cycles, hoping to get 10 ms. That is, 250 cycles per ms. > The interrupt flag is set when the counter reaches 0 after which it is > automatically reloaded and starts counting down again. > Thanks. On atari, the 68901 counts down to 0x01 and raises an interrupt. On mac, the 6522 counts down to 0xFFFF then raises an interrupt. No idea about amiga (Geert?) -- this has to be handled correctly to get a monotonic clocksource. I'll fix this in v3 (where the information is available). -- > > --- > > arch/m68k/hp300/time.c | 19 ------------------- > > 1 file changed, 19 deletions(-) >