Received: by 10.223.164.202 with SMTP id h10csp3432175wrb; Tue, 28 Nov 2017 11:11:03 -0800 (PST) X-Google-Smtp-Source: AGs4zMY78v398r16ib0//TLLwvrVEkw02dLDCI3f1fFHY7NuIDpG4+5M0tqjkxoe/WgGsGiJLD5O X-Received: by 10.159.247.198 with SMTP id v6mr159882plz.265.1511896263453; Tue, 28 Nov 2017 11:11:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1511896263; cv=none; d=google.com; s=arc-20160816; b=AMdOckkMpnVD70Gc6er9UiscNT234/hICAjdnjwqd3BvA8kkm+fovQeuzI7tsTaiNq G1LkyRWwEIE++d4fwthsj3VvvF/5mSYZEnqqTjxcXDGOLBo+Mp+6d+i+AOHMxTKhhmFD ZRelr0UuLXGlli9MxM8PKBnCLXDb5yjr7RYilo64OrFWaG6qgGQd8vjIJXezKMpqIqGQ DRe66dyeU02tUhj3AQTB3Mx1qXeExAj22jfIkS9952h05NRQK/WBQgN2ULJUkR/9w49H F1mQRdy6IFSBAxN+ZGAcRQMOR9fgcIL8piZaZ4ELr7nYOVxABK1hRkC+8V+oGmfKfd7Y EmIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=qtkODcTLxqlcoqt0RzPMWDDhfpatWdn1F1PaLcjRj3A=; b=eNtHwIX5FADY6LluY+Cv9gTW9j7Npot4JEvdL4CiodAoGpETQ+4qFHYQdrcxjMJFBI KxzAUNWsCt+XiKSpVC8Xrt0to1ZFTgBsNW5+i93Okqfp6bmCDwbXusUEKzs9JqWg4k3Z s3taQnOYyTs85sqJNlF5oUFGnHbzWnbdcdMw1eK8jHZ7kyox8aqY6aqcOinI/SAEDgJu fXOaq0rzyRNiQsBbfa35zFcgDwYdyKe8+0AHZshdo8Yuw4idWxUYC+jXEU+lSSrfCJ96 Ehx//y6hR+t5mB8rJLJauSxjgp7o2MFZ0li5zf7ov4vIjl1iMtLc3siaofI+0nPdB1GS zoFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@android.com header.s=20161025 header.b=u68+yih2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p1si25076604pgr.812.2017.11.28.11.10.52; Tue, 28 Nov 2017 11:11:03 -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; dkim=pass header.i=@android.com header.s=20161025 header.b=u68+yih2; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=android.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932073AbdK1TKK (ORCPT + 72 others); Tue, 28 Nov 2017 14:10:10 -0500 Received: from mail-it0-f65.google.com ([209.85.214.65]:46125 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753049AbdK1TKG (ORCPT ); Tue, 28 Nov 2017 14:10:06 -0500 Received: by mail-it0-f65.google.com with SMTP id t1so1018007ite.5 for ; Tue, 28 Nov 2017 11:10:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=android.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=qtkODcTLxqlcoqt0RzPMWDDhfpatWdn1F1PaLcjRj3A=; b=u68+yih2OFH9q7KIlgHKU828ubkjJ9T8LC9np/gqA4FcQQQinG37s3xTC8gP1zE/Vc JdL3AbPcVUlh10oDuU2Rtbt3Rh7K/CO/t6kPYrR1DMTlnW5D94Hah0hAYTA0ceVfMwKp sK0ZAhJYfdE6SKLVFOXlC6dQ9rks+gHZLIWCXMaO6gTCLrFwfSePlZZvFVKRrWuDf94c t0xZFhIwy8n4AyIuxKyWYTNFWV1018T5MwxZuC0+doqC6DH4hg2T9ZR4bxJI7D8I8fR0 FikN6ES1YSwrPuO99wE+Vi9N3Uh9PNI5/Air6NWpjobAXdpZItYoWQ5GpvqFRuCcsA6D l+xA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=qtkODcTLxqlcoqt0RzPMWDDhfpatWdn1F1PaLcjRj3A=; b=VZxxtnehiYn0TkLMyJ+DtjvgXjALL+FCQvNd6n/a1OcYV/sOIeKLzKp9Ayd/p5rT3f CuXbadhbFYegH4oBdAFc50Ab8sHXJofiHrVwAC4v/MUT16P1xyIpygcB1MzHiMI3cdBO TNLhNqcjv9P4qTRUNyfvxFJLO42HtqeVhvATHrU0N/6cVahTHk2oHHlvSC/UFqEOWCP3 sL/nwrxPYXUn6/+9/PwRxnE+Z8+2c18xON+TyjFz6cYfBq3duxNrUE37rsD4hiNFkyOu wzXoBc+h0439Kqw7eCEmCVkhrWaoF/ZlXknR79dt0qmnPpItTi9xJeWnFouIKXr2INzQ 4IDQ== X-Gm-Message-State: AJaThX5YJvFLTkipoty0ZDBnhRRsvcBpw7mQdnVLI3dM2hPxfHRx1rjc wyypRFrrFb8VYBVQuuduO77DD/xwjpg= X-Received: by 10.36.44.197 with SMTP id i188mr3947898iti.40.1511896205416; Tue, 28 Nov 2017 11:10:05 -0800 (PST) Received: from nebulus.mtv.corp.google.com ([2620:0:1000:1612:b4fb:6752:f21f:3502]) by smtp.googlemail.com with ESMTPSA id w71sm13040207iof.49.2017.11.28.11.10.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Nov 2017 11:10:04 -0800 (PST) Subject: Re: [RFC patch 7/7] timekeeping: Hack to use fine grained timestamps during boot To: Prarit Bhargava , Petr Mladek , Thomas Gleixner Cc: LKML , Linus Torvalds , Ingo Molnar , "H. Peter Anvin" , Peter Zijlstra , Andrew Morton , Sergey Senozhatsky , Steven Rostedt , Joe Perches References: <20171115181531.322572387@linutronix.de> <20171115182657.703928462@linutronix.de> <20171123125823.gnhwtnx6bxd3tb4q@pathway.suse.cz> <205229e2-fab4-31cb-60cd-f36bc2228804@redhat.com> From: Mark Salyzyn Message-ID: <26f1d1fd-ed65-73d1-8278-8058b6b83a3e@android.com> Date: Tue, 28 Nov 2017 11:10:02 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <205229e2-fab4-31cb-60cd-f36bc2228804@redhat.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/28/2017 10:43 AM, Prarit Bhargava wrote: > > On 11/23/2017 07:58 AM, Petr Mladek wrote: >> On Wed 2017-11-15 19:15:38, Thomas Gleixner wrote: >>> For demonstration purposes only. >>> >>> Add a disgusting hack to work around the fact that high resolution clock >>> MONOTONIC accessors are not available during early boot and return stale >>> time stamps accross suspend/resume when the current clocksource is not >>> flagged with CLOCK_SOURCE_SUSPEND_ACCESS_OK. >>> >>> Use local_clock() to provide timestamps in early boot and when the >>> clocksource is not accessible after timekeeping_suspend(). In the >>> suspend/resume case this might cause non monotonic timestamps. >> I get the non-monotonic times even during boot: >> >> [ 0.026709] smp: Bringing up secondary CPUs ... >> [ 0.027973] x86: Booting SMP configuration: >> [ 0.028006] .... node #0, CPUs: #1 >> [ 0.004000] kvm-clock: cpu 1, msr 1:3ff51041, secondary cpu clock >> ^^^^^^^^ >> [ 0.032097] KVM setup async PF for cpu 1 >> [ 0.032766] kvm-stealtime: cpu 1, msr 13b00dc40 >> [ 0.036502] #2 >> [ 0.004000] kvm-clock: cpu 2, msr 1:3ff51081, secondary cpu clock >> ^^^^^^^^ >> [ 0.040062] KVM setup async PF for cpu 2 >> [ 0.040576] kvm-stealtime: cpu 2, msr 13b20dc40 >> [ 0.041304] #3 >> [ 0.004000] kvm-clock: cpu 3, msr 1:3ff510c1, secondary cpu clock >> ^^^^^^^^ >> [ 0.048051] KVM setup async PF for cpu 3 >> [ 0.048554] kvm-stealtime: cpu 3, msr 13b40dc40 >> >> >> To be honest, I do not feel experienced enough to decide which >> solution is acceptable. I would say that only few people care >> about timestamps during boot. On the other hand, some tools > It is extremely important to know what happened and how long it took. I agree > with Petr, we should figure out a way to guarantee that the timestamp is monotonic. > > P. There is no guarantee of sequential order of delivery for kernel prints. [TL;DR] The timestamp may very well be monotonic in the general case, and yet it may take longer to _compose_ or _deliver_ the message (multiprocessor, via vsprint, etc). To get sequential order the timestamp _has_ to be reliably monotonic and _collected_ at incident _before_ anything else, before message is composed, and then (land in-place, post-sorted, what evz?) be presented in time sorted order. User space can also inject into the kernel print buffer, it certainly does not support at-incident timestamp collection as it is delayed already by a syscall or two. We would need to allow user space (via fast vdso) collect timestamp(s), then make it part of the payload of the report to even get close. It is out-of-scope for this RFC to consider rewriting the timestamp acquisition and delivery infrastructure for kernel prints IMHO. For now we all have accepted they will be _somewhat_ sequential within the confines of races and composition. Sincerely -- Mark Salyzyn From 1585336692364225958@xxx Tue Nov 28 18:48:06 +0000 2017 X-GM-THRID: 1584164865070567712 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread