linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC/PATCH v2] ARM: vDSO gettimeofday using generic timer architecture
Date: Sun, 9 Feb 2014 10:20:23 +0000	[thread overview]
Message-ID: <20140209102023.GL26684@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <1391814349-10706-1-git-send-email-nathan_lynch@mentor.com>

On Fri, Feb 07, 2014 at 05:05:49PM -0600, Nathan Lynch wrote:
> +	/* Grab the vDSO code pages. */
> +	for (i = 0; i < vdso_pages; i++) {
> +		pg = virt_to_page(&vdso_start + i*PAGE_SIZE);
> +		ClearPageReserved(pg);
> +		get_page(pg);
> +		vdso_pagelist[i] = pg;
> +	}

Why do we want to clear the reserved status?  This looks over complicated
to me.

> +
> +	/* Sanity check the shared object header. */
> +	vbase = vmap(vdso_pagelist, 1, 0, PAGE_KERNEL);
> +	if (vbase == NULL) {
> +		pr_err("Failed to map vDSO pagelist!\n");
> +		return -ENOMEM;
> +	} else if (memcmp(vbase, "\177ELF", 4)) {
> +		pr_err("vDSO is not a valid ELF object!\n");
> +		ret = -EINVAL;
> +		goto unmap;
> +	}

Why do we need to vmap() pages which are already accessible - vdso_start
must be part of the kernel image, and therefore will be accessible via
standard mappings.

> +
> +	/* Grab the vDSO data page. */
> +	pg = virt_to_page(vdso_data);
> +	get_page(pg);
> +	vdso_pagelist[i] = pg;

Same goes for this.

> +static long clock_gettime_fallback(clockid_t _clkid, struct timespec *_ts)
> +{
> +	register struct timespec *ts asm("r1") = _ts;
> +	register clockid_t clkid asm("r0") = _clkid;
> +	register long ret asm ("r0");
> +	register long nr asm("r7") = __NR_clock_gettime;
> +
> +	asm("swi #0" : "=r" (ret) : "r" (clkid), "r" (ts), "r" (nr) : "memory");

This isn't compatible with OABI, so either this must not be enabled when
AEABI is disabled, or this needs to be fixed.

> +static long clock_getres_fallback(clockid_t _clkid, struct timespec *_ts)
> +{
> +	register struct timespec *ts asm("r1") = _ts;
> +	register clockid_t clkid asm("r0") = _clkid;
> +	register long ret asm ("r0");
> +	register long nr asm("r7") = __NR_clock_getres;
> +
> +	asm volatile(
> +		"swi #0" :
> +		"=r" (ret) :
> +		"r" (clkid), "r" (ts), "r" (nr) :
> +		"memory");

Same here.

> +static long gettimeofday_fallback(struct timeval *_tv, struct timezone *_tz)
> +{
> +	register struct timezone *tz asm("r1") = _tz;
> +	register struct timeval *tv asm("r0") = _tv;
> +	register long ret asm ("r0");
> +	register long nr asm("r7") = __NR_gettimeofday;
> +
> +	asm("swi #0" : "=r" (ret) : "r" (tv), "r" (tz), "r" (nr) : "memory");

and here.

-- 
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".

  reply	other threads:[~2014-02-09 10:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07 23:05 [RFC/PATCH v2] ARM: vDSO gettimeofday using generic timer architecture Nathan Lynch
2014-02-09 10:20 ` Russell King - ARM Linux [this message]
2014-02-10 16:51   ` Steve Capper
2014-02-10 17:12     ` Russell King - ARM Linux
2014-02-11  8:44       ` Steve Capper
2014-02-10 23:57   ` Nathan Lynch
2014-02-11 10:45     ` Will Deacon
2014-02-11 16:23       ` Nathan Lynch

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=20140209102023.GL26684@n2100.arm.linux.org.uk \
    --to=linux@arm.linux.org.uk \
    --cc=linux-arm-kernel@lists.infradead.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 NNTP newsgroup(s).