Received: by 10.213.65.68 with SMTP id h4csp8568imn; Thu, 15 Mar 2018 14:44:25 -0700 (PDT) X-Google-Smtp-Source: AG47ELvuIow/+5EgN7RtxLKGi6eCSQkHi8cYyFOFkoXznuy4MCMAeJcruj2WazRRFYZDEtx8mlrp X-Received: by 10.98.242.65 with SMTP id y1mr8780036pfl.232.1521150264972; Thu, 15 Mar 2018 14:44:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521150264; cv=none; d=google.com; s=arc-20160816; b=csqcqVM3vY7PrIgZT2tpBZiRPgXAZdXCVi4rRPyAZAPDLhG1o10mRUD3jNmXN1yTDz ohPjS1a1gabIzwFytc7hF3afzgMkqz7qZjD/UA1MaYOThlBbqfygQ5wEYqUzJBEcGgwb EJxTX1pO7Ol59jyatEzL6N684ffEnMS/BsPLEW457R/6JkFhQI/zYEjb0+wPlagJiGl8 uX2oLEib/kUQ/bSkIV999dYi4aPXvOruNkeYEc0tyUPrbnl8uSS23pFE0H3uw3lnh0im Fv/397V+3yCO3OvtcmRtnBL6YCZjSH8jAN2IfLaE07f2SoXWhdRaw+0B3Y3ySzVKQ/6o 9MmA== 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=YIA+wvHbLJd4OuiwrOeAHyB8l+3UWHFdxREuacGS/tg=; b=wI8gBUCxHkPsS5Od6WOKhJjkXhZuvYI6MSjBtHtkPxou0DcAhrf3/mENNr79VtFOGr dhEuYmLlaqUj07TgXmCBJWxZj8zMccseYoJgUvzlGfPK/KxZRisjTLSz8v4GOEBIAddb NBCGn0wUIK+/VTIXKurw0uPmuZAr71lq2+V/k6qI78xVNZpZfrv/lORJiqydbJT+8Md/ dSNVTyVwkNYwzG3cT8zdHxjaRvy35zlHIKT2DPmrA71ZtOgDo5bUWpeyvH9Z68GD5ivX YA7VkfJ2Rgl6CvYtx3oHQJmCeyH0WrkHTgs/wVIOMeIlYGA9ckcnE4qu4zRWZz6lLBX4 vXYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=pnU4xfyE; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g14si4027764pgn.275.2018.03.15.14.44.09; Thu, 15 Mar 2018 14:44:24 -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=pass header.i=@gmail.com header.s=20161025 header.b=pnU4xfyE; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752549AbeCOVlk (ORCPT + 99 others); Thu, 15 Mar 2018 17:41:40 -0400 Received: from mail-ot0-f174.google.com ([74.125.82.174]:42030 "EHLO mail-ot0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751774AbeCOVli (ORCPT ); Thu, 15 Mar 2018 17:41:38 -0400 Received: by mail-ot0-f174.google.com with SMTP id l5-v6so8406861otf.9 for ; Thu, 15 Mar 2018 14:41:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=YIA+wvHbLJd4OuiwrOeAHyB8l+3UWHFdxREuacGS/tg=; b=pnU4xfyE6k/TuMf8KN+/roO8eVk351s/4OjdOIP1iimUDwMfMqLc81Oyh72MNaku6k n1XIOXtHclXk/vh4C9GyWZ1Jwbdb/+A+EzUHgruv8qJXAA6O2rW3kA0XERmTZWxaXIDb h6ksGvV61tKs3nbfHqublAJo0XhXvfbQ8XA/elOjWUi8qfRu+k1T0M0c7qjRzJs5FSaA UkNjHAUG4Xs4HeNUicBwUq9dT5Qln/I48dff7bu58C5D0vYKmsIO9OSFvGVY+Ul7KlEH TFQX+IVhnct4JEnj1W896p8YAe1RO3s7gq9JvY7fgEIJmLvwyKovYRvE0dMDpBxjpCGR Ey7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=YIA+wvHbLJd4OuiwrOeAHyB8l+3UWHFdxREuacGS/tg=; b=izGWpxHBT0yG/kZaq9XNZ4JXEsCZl4oz0ShD7YRQie3xBzl5Ak8kaC2roojDfz62aU K2eMNs2kog2Dk1eT6/IAThelZMhH9PjoLtpuKPaLTLudWjakNUx/+xifKdXsBgvRt62P qB1VvdGw/WybVCp/vmsuazf1QVbyXv6cElD3JY1T0h0k2FM/Epeq4NOsz0wjNuNAoIik 1qX2freV8/b30zxIh3KsK4VgafYPO9Ckzs9RC4Z4JBa5aFj7w6Ri12bUFk2Md4Ay+jJC IwTEapLJ1YBlrjYKb8HJZJZbSsHwh4pzXu29YTyT55IHybWhFhmK6ioetZ7j0QFPLuqN bslQ== X-Gm-Message-State: AElRT7FAWYOu+1T7ZvGoiXA3D8omqjdhXuIGakTubArEPDRvWPNyT+7l sD/HqFwq68cAucCVNyxyYsULxbuje8FxCRtoZAI= X-Received: by 10.157.26.105 with SMTP id u38mr6339351otu.22.1521150098094; Thu, 15 Mar 2018 14:41:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.82.85 with HTTP; Thu, 15 Mar 2018 14:41:36 -0700 (PDT) In-Reply-To: References: <1521129648-20889-1-git-send-email-jason.vas.dias@gmail.com> From: Jason Vas Dias Date: Thu, 15 Mar 2018 21:41:36 +0000 Message-ID: Subject: Re: [PATCH v4.16-rc5 (3)] x86/vdso: on Intel, VDSO should handle CLOCK_MONOTONIC_RAW To: Thomas Gleixner Cc: linux-kernel@vger.kernel.org, x86@kernel.org, mingo@kernel.org, peterz@infradead.org, andi@firstfloor.org Content-Type: multipart/mixed; boundary="001a1134f8363f554405677a5b29" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --001a1134f8363f554405677a5b29 Content-Type: text/plain; charset="UTF-8" Hi Thomas - RE: On 15/03/2018, Thomas Gleixner wrote: > Jason, > > On Thu, 15 Mar 2018, jason.vas.dias@gmail.com wrote: > >> Resent to address reviewer comments. > > I was being patient so far and tried to guide you through the patch > submission process, but unfortunately this turns out to be just waste of my > time. > > You have not addressed any of the comments I made here: > > [1] > https://lkml.kernel.org/r/alpine.DEB.2.21.1803141511340.2481@nanos.tec.linutronix.de > [2] > https://lkml.kernel.org/r/alpine.DEB.2.21.1803141527300.2481@nanos.tec.linutronix.de > I'm really sorry about that - I did not see those mails , and have searched for them in my inbox - are you sure they were sent to 'linux-kernel@vger.kernel.org' ? That is the only list I am subscribed to . I clicked on the links , but the 'To:' field is just 'linux-kernel' . If I had seen those messages before I re-submitted, those issues would have been fixed. checkpatch.pl did not report them - I ran it with all patches and it reported no errors . And I did send the test results in a previous mail - $ gcc -m64 -o timer timer.c ( must be compiled in 64-bit mode). This is using the new rdtscp() function : $ ./timer -r 100 ... Total time: 0.000002806S - Average Latency: 0.000000028S N zero deltas: 0 N inconsistent deltas: 0 Average of 100 average latencies of 100 samples : 0.000000027S This is using the rdtsc_ordered() function: $ ./timer -m -r 100 Total time: 0.000005269S - Average Latency: 0.000000052S N zero deltas: 0 N inconsistent deltas: 0 Average of 100 average latencies of 100 samples : 0.000000047S timer.c is a very short program that just reads N_SAMPLES (a compile-time option) timespecs using either CLOCK_MONOTONIC_RAW (no -m) or CLOCK_MONOTONIC first parameter to clock_gettime(), then computes the deltas as long long, then averages them , counting any zero deltas, or deltas where the previous timespec is somehow greater than the current timespec, which are reported as inconsitencies (note 'inconistent deltas:0' and 'zero deltas: 0' in output). So my initial claim that rdtscp() can be twice as fast as rdtsc_ordered() was not far-fetched - this is what I am seeing . I think this is because of the explicit barrier() call in rdtsc_ordered() . This must be slower than than the internal processor pipeline "cancellation point" (barrier) used by the rdtscp instruction itself. This is the only reason for the rdtscp call - plus all modern Intel & AMD CPUs support it, and it DOES solve the ordering problem, whereby instructions in one pipeline of a task can get different rdtsc() results than instructions in another pipeline. I will document the results better in the ChangeLog , fix all issues you identified, and resend . I did not mean to ignore your comments - those mails are nowhere in my Inbox - please , confirm the actual email address they are getting sent to. Thanks & Regards, Jason --001a1134f8363f554405677a5b29 Content-Type: text/x-csrc; charset="US-ASCII"; name="timer.c" Content-Disposition: attachment; filename="timer.c" Content-Transfer-Encoding: base64 X-Attachment-Id: file0 LyogCiAqIFByb2dyYW0gdG8gbWVhc3VyZSBoaWdoLXJlcyB0aW1lciBsYXRlbmN5LgogKgogKi8K I2luY2x1ZGUgPHN0ZGludC5oPgojaW5jbHVkZSA8c3RkYm9vbC5oPgojaW5jbHVkZSA8c3lzL3R5 cGVzLmg+CiNpbmNsdWRlIDx1bmlzdGQuaD4KI2luY2x1ZGUgPHRpbWUuaD4KI2luY2x1ZGUgPGVy cm5vLmg+CiNpbmNsdWRlIDxhbGxvY2EuaD4KI2luY2x1ZGUgPHN0cmluZy5oPgojaW5jbHVkZSA8 c3RkaW8uaD4KI2luY2x1ZGUgPHN0ZGxpYi5oPgoKI2lmbmRlZiBOX1NBTVBMRVMKI2RlZmluZSBO X1NBTVBMRVMgMTAwCiNlbmRpZgojZGVmaW5lIF9TVFIoX1NfKSAjX1NfCiNkZWZpbmUgU1RSKF9T XykgX1NUUihfU18pCgojZGVmaW5lIFRTMk5TKF9UU18pICgoKCh1bnNpZ25lZCBsb25nIG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250ICk7CiAgY2xvY2tfZ2V0 dGltZShjbGssICZzYW1wbGVbc10pOwogIGZvcihzPTE7IHMgPCAoTl9TQU1QTEVTKzEpOyBzKz0x KQogIHsgdDEgPSBUUzJOUyhzYW1wbGVbcy0xXSk7CiAgICB0MiA9IFRTMk5TKHNhbXBsZVtzXSk7 CiAgICBpZiAoICh0MSA+IHQyKQogICAgICAgfHwoc2FtcGxlW3MtMV0udHZfc2VjID4gc2FtcGxl W3NdLnR2X3NlYykKICAgICAgIHx8KChzYW1wbGVbcy0xXS50dl9zZWMgPT0gc2FtcGxlW3NdLnR2 X3NlYykKICAgICAgICAmJihzYW1wbGVbcy0xXS50dl9uc2VjID4gc2FtcGxlW3NdLnR2X25zZWMp CiAgICAgICAgICkKICAgICAgICkKICAgIHsgZnByaW50ZihzdGRlcnIsIkluY29uc2lzdGVuY3k6 ICVsbHUgJWxsdSAlbHUuJWx1ICVsdS4lbHVcbiIsIHQxICwgdDIKICAgICAgICAgICAgLCBzYW1w bGVbcy0xXS50dl9zZWMsIHNhbXBsZVtzLTFdLnR2X25zZWMKICAgICAgICAgICAgLCBzYW1wbGVb c10udHZfc2VjLCAgIHNhbXBsZVtzXS50dl9uc2VjCiAgICAgICk7CiAgICAgIGljKz0xOwogICAg ICBjb250aW51ZTsKICAgIH0KICAgIGQgPSB0MiAtIHQxOwogICAgaWYgKCBkID09IDAgKQogICAg eyAgemQgKz0gMTsKICAgIH0KICAgIGRlbHRhc1tzLTFdID0gZDsKICAgIGlmKGRvX2R1bXApCiAg ICAgIGZwcmludGYoc3RkZXJyLCAiJWx1ICVsdSAlbGx1XG4iLAogICAgICAgICAgICAgIHNhbXBs ZVtzXS50dl9zZWMsIHNhbXBsZVtzXS50dl9uc2VjLCBkCiAgICAgICAgICAgICApOwogIH0KICBm b3IocyA9IDAsIHN1bT0wOyBzIDwgTl9TQU1QTEVTOyBzKz0xKQogICAgc3VtICs9IGRlbHRhc1tz XTsKICBmcHJpbnRmKHN0ZGVyciwic3V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