Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp979510imm; Mon, 9 Jul 2018 14:33:32 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcIG1zHXxO/VHQHvs6sNN04OVG2i1sOxsPIVFzLCUKDPe4poXrVEBiq1EZx+SZ7Mm8Rkdlj X-Received: by 2002:a62:dc8f:: with SMTP id c15-v6mr22987216pfl.155.1531172011940; Mon, 09 Jul 2018 14:33:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531172011; cv=none; d=google.com; s=arc-20160816; b=zOCwE55JSczlTuDEuyGo6WS4vz47pWBuQAhEmqkRUMW187qv9LQOk4UYoQ29ubWNm8 nmpKBeTTrU8T/9nGK3gMJzMhutdLNb2Jao3zJAeEkPZeA3+KNxVwRDRJRNrIejMFw/t8 lR2MNyYiuH0HkaDDRWvdIcehCkLYdOzJ1r4mTLvLz82AtnOz8NIl7dKu9to8ZBNXS24K JrqH8Q7mRRivCp9rjddf4YXog2blqJT2UkE+Qtxob+xJnEqOx4wLacMSv9QLGdkW7NRG 5jMwEKdC9HDf8dn9yTz+qvqM1t2ICr1Ve2DROTjowBgcqMeHkkbG9v8N092KtbuzIrO1 T27A== 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 :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=kmZ7qRQHqSZd1GrG0lW3437yq1TP/ppTpLXK2iwCtP8=; b=rabFyHcHWVOdVOuEwuZcspoiffUdfdbtK9zSfOPo1OsF6tSxQlZ5bzIY6HRQavNLm5 eNsnt61HRE6/AAzeDWptbEJzDsev6myrPu+aMDNdmn3PDylA383hApt6DReRh4RyY4+l oeO3cqX2wDQgfTxGfpJfzzri0NFTebIjnHIdYrqEO+v0/jlJ2jMVeKoOqgONMo6SWRxP OWuIdVuOhZO6omITNKzcIVqzlsnwjISA0B6kX1R+Ba9NzEQjkJ1xKia3ky3frjfhrI/o izndsokLSuuUJ8+8ctGvXLHFmQWEhAmtolOHaKQT1a4c6uP69b5b2WswKzNwRbJPKIjs EtCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=F+wd35cV; 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 ay6-v6si15094709plb.210.2018.07.09.14.33.17; Mon, 09 Jul 2018 14:33:31 -0700 (PDT) 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; dkim=fail header.i=@gmail.com header.s=20161025 header.b=F+wd35cV; 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 S933187AbeGIVb1 (ORCPT + 99 others); Mon, 9 Jul 2018 17:31:27 -0400 Received: from mail-lf0-f66.google.com ([209.85.215.66]:41407 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933049AbeGIVbY (ORCPT ); Mon, 9 Jul 2018 17:31:24 -0400 Received: by mail-lf0-f66.google.com with SMTP id v22-v6so2957244lfe.8; Mon, 09 Jul 2018 14:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=kmZ7qRQHqSZd1GrG0lW3437yq1TP/ppTpLXK2iwCtP8=; b=F+wd35cVYGuxz/H22puMer/MndpAfMo3C3N+gXgWZB7vdtZpne1ot8xoW0AieaGUM4 ILdkGyaCzaSN4cNZYVDFibll3Nbxn4yhUQg9L5zozec7iHgXYR6AtFwVplsfLzW/rAIw 9OJOWnj+1t2kYlar+iYqDBeh0j4IjNVd2DnF2eJrus8/5knnK61mk08s5bEkQdJxceBy lOPtM0CHAAnpbRq0wFzbiIFkUTYUwa2iIpQFNCWNqOSvCXy5RnG42NwZqfTQHAa9NTHl HPHC6zYs1fU91w/LZJtHM6CxAN5MCnuuCA7j165s/jR4HnIxzCaxrCJ1UbeQh/yZ66wU gezQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=kmZ7qRQHqSZd1GrG0lW3437yq1TP/ppTpLXK2iwCtP8=; b=dl+xOp3si4xno0FdroC/7aUchJttU0xs93o1r8uH7fzlNwqy4H1FIgbge1SerQRu4P M1vcU1njgVDC1QHLli4kzEExXIHX+US6EaXMFfAfiGkDezleCH8ZMiXJU349rq+PaunJ GB8jcxteY0hoYmeBSgWgFZzBAg/BDEpThMuLprQ5t4QyUezdSo+GS7muzQ9o9xOp5Irs T0aUcxD3pGk9/t27L1X8XjMOuhTIzStHYsdOXplPcRnXdFSQyFWWlQ4Qf+LABSiyslLD HguLIxuX0/BSGdpEYWlT2f+VS6JEwP1Y6KQn8OtEKEAhIIxg/sbmPhktMJMFsjhKfqxM Y+xA== X-Gm-Message-State: APt69E1/EUDScGnDiekQ9kt2576RP3/ZdMdIm6g8gAlw3zsllROR7Vmy 8whbLRmgfQBjO732l17jF8u6aVB7lSUsq4I8EJI= X-Received: by 2002:a19:7b08:: with SMTP id w8-v6mr761070lfc.22.1531171882098; Mon, 09 Jul 2018 14:31:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a2e:41c1:0:0:0:0:0 with HTTP; Mon, 9 Jul 2018 14:31:21 -0700 (PDT) In-Reply-To: References: <20180619140229.3615110-1-arnd@arndb.de> From: Arnd Bergmann Date: Mon, 9 Jul 2018 23:31:21 +0200 X-Google-Sender-Auth: pcpa39DhBENsR_eKzz3Mvd7v7VE Message-ID: Subject: Re: [PATCH 1/3] [v2] powerpc: mac: fix rtc read/write functions To: Meelis Roos Cc: Mathieu Malaterre , Paul Mackerras , Michael Ellerman , Geert Uytterhoeven , Joshua Thompson , Benjamin Herrenschmidt , Greg Ungerer , linux-m68k@vger.kernel.org, linuxppc-dev , LKML , y2038 Mailman List , Andreas Schwab Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jul 1, 2018 at 5:47 PM, Meelis Roos wrote: > A patch for the subject is now upstream. That made me finally take some > time to test it on my PowerMac G4. Tha date is OK but I get two warnings > with backtrace on bootup. Full dmesg below. Thanks for testing this, and sorry for the slow reply. > [ 4.026490] WARNING: CPU: 0 PID: 1 at arch/powerpc/platforms/powermac/time.c:154 pmu_get_time+0x7c/0xc8 > [ 4.032261] Modules linked in: > [ 4.037878] CPU: 0 PID: 1 Comm: swapper Tainted: G W 4.18.0-rc2-00223-g1904148a361a #88 > [ 4.043750] NIP: c0021354 LR: c0021308 CTR: 00000000 > [ 4.049585] REGS: ef047cd0 TRAP: 0700 Tainted: G W (4.18.0-rc2-00223-g1904148a361a) > [ 4.055572] MSR: 00029032 CR: 44000222 XER: 20000000 > [ 4.061620] > GPR00: c0021308 ef047d80 ef048000 00000000 00d7029c 00000004 00000001 0000009c > GPR08: 00d70000 00000001 00000200 c06a0000 24000228 00000000 c0004c9c 00000000 > GPR16: 00000000 00000000 00000000 00000000 00000000 00000000 c0670000 c0601a38 > GPR24: 00000008 c0630f18 c062a40c c05fc10c ef047e50 ef273800 ef047e50 ef047e50 > [ 4.092393] NIP [c0021354] pmu_get_time+0x7c/0xc8 > [ 4.098596] LR [c0021308] pmu_get_time+0x30/0xc8 I don't see how the WARN_ON() triggered unless the PMU time is actually before 1970. > [ 4.104779] Call Trace: > [ 4.110909] [ef047d80] [c0021308] pmu_get_time+0x30/0xc8 (unreliable) > [ 4.117209] [ef047df0] [c00213e8] pmac_get_rtc_time+0x28/0x40 > [ 4.123470] [ef047e00] [c000bc04] rtc_generic_get_time+0x20/0x34 > [ 4.129770] [ef047e10] [c03aca34] __rtc_read_time+0x5c/0xe0 > [ 4.136060] [ef047e20] [c03acafc] rtc_read_time+0x44/0x7c > [ 4.142356] [ef047e40] [c061e000] rtc_hctosys+0x64/0x11c > [ 4.148616] [ef047ea0] [c0004aa4] do_one_initcall+0x4c/0x1a8 > [ 4.154866] [ef047f00] [c06022f0] kernel_init_freeable+0x12c/0x1f4 > [ 4.161123] [ef047f30] [c0004cb4] kernel_init+0x18/0x130 > [ 4.167359] [ef047f40] [c00121c4] ret_from_kernel_thread+0x14/0x1c > [ 4.173610] Instruction dump: > [ 4.179766] 8941002e 5484c00e 5508801e 88e1002f 7c844214 554a402e 7c845214 7c843a14 > [ 4.186076] 7d244810 7d294910 7d2948f8 552907fe <0f090000> 3d2083da 80010074 38210070 > [ 4.192388] ---[ end trace 2e01ad9337fe08fd ]--- > [ 4.198643] rtc-generic rtc-generic: hctosys: unable to read the hardware clock The last message here happens exactly in that case as well: tm_year is before 1970: int rtc_valid_tm(struct rtc_time *tm) { if (tm->tm_year < 70 || ((unsigned)tm->tm_mon) >= 12 || tm->tm_mday < 1 || tm->tm_mday > rtc_month_days(tm->tm_mon, tm->tm_year + 1900) || ((unsigned)tm->tm_hour) >= 24 || ((unsigned)tm->tm_min) >= 60 || ((unsigned)tm->tm_sec) >= 60) return -EINVAL; return 0; } The most likely explanation I have here is that the RTC was indeed set to an incorrect date, either because of a depleted battery (not unlikely for a ~15 year old box) or because it was previously stored incorrectly. You say that the time is correct, but that could also be the case if the machine is connected to the network and synchronized using NTP. It should not have gotten the time from the RTC after that error. If you have the time to do another test, can you boot the machine with its network disconnected, see if the warning persists (it may have been repaired after the correct time got written into the RTC during shutdown), what the output of 'sudo hwclock' is, and whether anything changes after you set the correct time using 'hwclock --systohc' and reboot? Arnd