Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1712277imu; Wed, 21 Nov 2018 00:25:25 -0800 (PST) X-Google-Smtp-Source: AFSGD/VL9DLhPByrBSLO/GisxEifRKa6gPrjgLrXJgSy20R7tH+XGT6y51B3VvaY6KSbBC7gH/jy X-Received: by 2002:a17:902:9a04:: with SMTP id v4-v6mr5634504plp.247.1542788725071; Wed, 21 Nov 2018 00:25:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542788725; cv=none; d=google.com; s=arc-20160816; b=i2j9Ml6GuZ0uneeHJr6qO7gpwFln6ItWaX1Cpcvdo6MJTgyDCLrHAiAmCiXgvfHPVm tm8iQ/VorIB9tsIUhytmBDt7iFE5c3OIrqk8wx6PwXtVPxxBdsyANPChxJd/ZDYvNbV8 jGUJSC50dULS3vh5jUPd0mysZzACnhdzk+v7nL6ptsftWgtf+1eijyms5IJnrtPO/COL Qcgh/PIHJ1qrmC+oLI7iHIAbkDthxICn+eE2PX8Vxg7uzQYo1q9x/LRyAuecT88gplAi KA4R1djaSHXzHtW2ljOV8qCIYpWbu5bvQ4hmt6A9nmfFIHqFce28IbxzhvpdfVdIUDxD pEJg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=AMgnLNRmf7JRMzC8NH90Wby7mb7+BsBl7gBwAunGYbw=; b=wD3aq3jnavcxk/nggOUcH70ZgQuL9tthBemHwP47A1l94U+dZEgvLiSId74LPKs24l dJPZ5Hpd8v8EaV1ccVVRT36rTQZLc9928Slr1L09nXapAPw4s6OTujiPz5vCD6b+d+HF BOLd85fVr7Eg3tLJsKEE7xYdkul/dgpVplrhOn97HZI1xNYGVkf3yaO/yKjySeHvKbWB /daYJygsthq+c5LgainPTubovz/IJD0xbTTx5Xecc8CoJrmVkz6HPoPh6ZtQ+CiorqsZ H1TGzUBt3Okktlvg/RuQ4QR2ScRO8TFRG/OFzFxc+frOhmsYhyeLrKTL64kRBDjSU5Hh kRsA== 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 c31si29538857pgc.465.2018.11.21.00.25.06; Wed, 21 Nov 2018 00:25:25 -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 S1728738AbeKUS4g (ORCPT + 99 others); Wed, 21 Nov 2018 13:56:36 -0500 Received: from smtpq4.tb.mail.iss.as9143.net ([212.54.42.167]:53786 "EHLO smtpq4.tb.mail.iss.as9143.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728572AbeKUS4g (ORCPT ); Wed, 21 Nov 2018 13:56:36 -0500 Received: from [212.54.42.137] (helo=smtp6.tb.mail.iss.as9143.net) by smtpq4.tb.mail.iss.as9143.net with esmtp (Exim 4.86_2) (envelope-from ) id 1gPNmm-0000uh-5s for linux-kernel@vger.kernel.org; Wed, 21 Nov 2018 09:23:00 +0100 Received: from mail-lj1-f174.google.com ([209.85.208.174]) by smtp6.tb.mail.iss.as9143.net with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1gPNmV-0000t1-MD for linux-kernel@vger.kernel.org; Wed, 21 Nov 2018 09:22:43 +0100 Received: by mail-lj1-f174.google.com with SMTP id s5-v6so4012766ljd.12 for ; Wed, 21 Nov 2018 00:22:43 -0800 (PST) X-Gm-Message-State: AGRZ1gJPkaNANYmOIZrsdicoeTiATyTNxC2uDnp5tQUlDzdzo3DwsL4+ n1nY1m1aTEjkW3lbgTHbgwDJm4rnX80IMaAe7+8= X-Received: by 2002:a2e:9d17:: with SMTP id t23-v6mr3227458lji.57.1542788563093; Wed, 21 Nov 2018 00:22:43 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Kars de Jong Date: Wed, 21 Nov 2018 09:22:31 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH v2 09/14] m68k: hp300: Remove hp300_gettimeoffset() To: fthain@telegraphics.com.au 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 Content-Type: text/plain; charset="UTF-8" X-SourceIP: 209.85.208.174 X-Authenticated-Sender: karsdejong@home.nl (via SMTP) X-Ziggo-spambar: / X-Ziggo-spamscore: 0.0 X-Ziggo-spamreport: CMAE Analysis: v=2.3 cv=G66o7Os5 c=1 sm=1 tr=0 a=9+rZDBEiDlHhcck0kWbJtElFXBc=:19 a=IkcTkHD0fZMA:10 a=JHtHm7312UAA:10 a=8981fWPbAAAA:8 a=8uBZengZ5fZy5sdr5uEA:9 a=QEXdDO2ut3YA:10 a=o72u2rHnfW5qNJ_4I8LD:22 X-Ziggo-Spam-Status: No X-Spam-Status: No X-Spam-Flag: No Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Op wo 21 nov. 2018 om 00:13 schreef Finn Thain : > > 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? I can try... It's been a while since I booted the machine to Linux though (NFS support only). MAME is also starting to support it, but not quite there yet :-) > > 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. Eh, yes, that makes a lot more sense. > > 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). Cool! Kars.