From: Alexander Lochmann <alexander.lochmann@tu-dortmund.de>
To: David Smith <dsmith@redhat.com>, Josh Stone <jistone@redhat.com>,
systemtap@sourceware.org
Subject: Re: SystemTap for Android - patchset
Date: Thu, 07 Jul 2016 19:01:00 -0000 [thread overview]
Message-ID: <577EA70B.9080806@tu-dortmund.de> (raw)
In-Reply-To: <822425cc-666c-c5dc-04bf-51898919a3b9@redhat.com>
[-- Attachment #1.1: Type: text/plain, Size: 2552 bytes --]
On 07.07.2016 20:47, David Smith wrote:
> On 07/06/2016 07:29 AM, Alexander Lochmann wrote:
>> So. Let me start.
>> First of all, I extracted the patches properly, and attached the files.
>> (Btw, I found a third bug. :) )
>> FYI, I just fixed the bugs for the kernel versions I'm dealing with,
>> because I don't know which other versions are affected as well.
>
> The problem you are trying to fix in your patch "[PATCH 1/3] Definition
> of cputime_to_usecs in Linux kernel 3.0 is broken" is interesting. I
> don't think you've got quite the right solution. Testing for a kernel
> version here works for you, but really isn't a general solution -
> depending on arch there could be a kernel in that range with a
> reasonable cputime_to_usecs().
I see. :-/ Lesson learned.
>
> ====
> diff --git a/tapset/linux/task_time.stp b/tapset/linux/task_time.stp
> index f86f984..f3c276c 100644
> --- a/tapset/linux/task_time.stp
> +++ b/tapset/linux/task_time.stp
> @@ -27,8 +27,12 @@
> * Yet note some kernels (RHEL6) may already have both... */
> #if defined(cputime_to_usecs)
> #if !defined(cputime_to_msecs)
> +#if LINUX_VERSION_CODE <= KERNEL_VERSION(3,0,200) && LINUX_VERSION_CODE
>> = KERNEL_VERSION(3,0,0)
> +#define cputime_to_msecs(__ct) _stp_div64(NULL,
> ({cputime_to_usecs(__ct)}), 1000ULL)
> +#else
> #define cputime_to_msecs(__ct) _stp_div64(NULL,
> cputime_to_usecs(__ct), 1000ULL)
> #endif
> +#endif
>
> /* Kernels before 2.6.37 have cputime_to_msecs, but not usecs. */
> #elif defined(cputime_to_msecs)
> ====
>
> I've got a couple of thoughts here:
>
> - I wonder if we just couldn't always use your workaround (along with a
> comment about why we're doing that).
Why not? :) Since the kernel and every module of course is compiled with
-O3 (or -O2?), it shouldn't make any difference in the resulting
assembler code.
>
> - Here's an untested workaround idea that might work for all kernels:
>
> #define cputime_to_msecs(__ct) \
> ({ \
> unsigned long __usecs = cputime_to_usecs(__ct); \
> _stp_div64(NULL, __usecs, 1000ULL); \
> })
>
And so does this version. The compiler should be smart enough to
recognize __usecs is a local variable, and thus could be stored in a
register.
- Alex
--
Technische Universität Dortmund
Alexander Lochmann PGP key: 0xBC3EF6FD
Otto-Hahn-Str. 16 phone: +49.231.7556141
D-44227 Dortmund fax: +49.231.7556116
http://ess.cs.tu-dortmund.de/Staff/al
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-07-07 19:01 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <f01a1f27-3cdb-61a4-cbdb-7bffd1032c8e@tu-dortmund.de>
2016-07-01 16:15 ` Alexander Lochmann
2016-07-01 16:56 ` David Smith
2016-07-01 17:47 ` Josh Stone
2016-07-06 12:29 ` Alexander Lochmann
2016-07-06 16:42 ` Frank Ch. Eigler
2016-07-06 20:05 ` Alexander Lochmann
2016-07-06 20:15 ` Frank Ch. Eigler
2016-07-06 20:27 ` Alexander Lochmann
2016-07-07 16:00 ` David Smith
2016-07-07 16:06 ` David Smith
2016-07-07 16:23 ` Alexander Lochmann
2016-07-07 17:39 ` David Smith
2016-07-07 20:51 ` Alexander Lochmann
2016-07-07 21:14 ` David Smith
2016-07-08 5:38 ` Alexander Lochmann
2016-07-08 15:31 ` David Smith
2016-07-07 18:47 ` David Smith
2016-07-07 19:01 ` Alexander Lochmann [this message]
2016-07-07 19:24 ` David Smith
2016-07-07 19:32 ` Alexander Lochmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=577EA70B.9080806@tu-dortmund.de \
--to=alexander.lochmann@tu-dortmund.de \
--cc=dsmith@redhat.com \
--cc=jistone@redhat.com \
--cc=systemtap@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).