linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Andrei Vagin <avagin@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Dmitry Safonov <dima@arista.com>
Subject: Re: [PATCH v2 3/6] arm64/vdso: Add time napespace page
Date: Tue, 14 Apr 2020 18:20:14 +0100	[thread overview]
Message-ID: <20200414172014.GA6705@C02TD0UTHF1T.local> (raw)
In-Reply-To: <20200225073731.465270-4-avagin@gmail.com>

On Mon, Feb 24, 2020 at 11:37:28PM -0800, Andrei Vagin wrote:
> Allocate the time namespace page among VVAR pages.  Provide
> __arch_get_timens_vdso_data() helper for VDSO code to get the
> code-relative position of VVARs on that special page.
> 
> If a task belongs to a time namespace then the VVAR page which contains
> the system wide VDSO data is replaced with a namespace specific page
> which has the same layout as the VVAR page. That page has vdso_data->seq
> set to 1 to enforce the slow path and vdso_data->clock_mode set to
> VCLOCK_TIMENS to enforce the time namespace handling path.
> 
> The extra check in the case that vdso_data->seq is odd, e.g. a concurrent
> update of the VDSO data is in progress, is not really affecting regular
> tasks which are not part of a time namespace as the task is spin waiting
> for the update to finish and vdso_data->seq to become even again.
> 
> If a time namespace task hits that code path, it invokes the corresponding
> time getter function which retrieves the real VVAR page, reads host time
> and then adds the offset for the requested clock which is stored in the
> special VVAR page.
> 
> Signed-off-by: Andrei Vagin <avagin@gmail.com>
> ---
>  arch/arm64/include/asm/vdso.h                 |  6 ++++++
>  .../include/asm/vdso/compat_gettimeofday.h    | 11 ++++++++++
>  arch/arm64/include/asm/vdso/gettimeofday.h    |  8 ++++++++
>  arch/arm64/kernel/vdso.c                      | 20 ++++++++++++++++---
>  arch/arm64/kernel/vdso/vdso.lds.S             |  5 ++++-
>  arch/arm64/kernel/vdso32/vdso.lds.S           |  5 ++++-
>  include/vdso/datapage.h                       |  1 +
>  7 files changed, 51 insertions(+), 5 deletions(-)

> +#ifdef CONFIG_TIME_NS
> +static __always_inline const struct vdso_data *__arch_get_timens_vdso_data(void)
> +{
> +	const struct vdso_data *ret;
> +
> +	asm volatile("mov %0, %1" : "=r"(ret) : "r"(_timens_data));
> +
> +	return ret;
> +}
> +#endif

What is this inline assembly for? The commit message doesn't mention it,
there's no explanation here, and the native version doesn't do likewise
so it seems rather surprising.

Thanks,
Mark.

> diff --git a/arch/arm64/include/asm/vdso/gettimeofday.h b/arch/arm64/include/asm/vdso/gettimeofday.h
> index 5a534432aa5d..553bdc19a91f 100644
> --- a/arch/arm64/include/asm/vdso/gettimeofday.h
> +++ b/arch/arm64/include/asm/vdso/gettimeofday.h
> @@ -97,6 +97,14 @@ const struct vdso_data *__arch_get_vdso_data(void)
>  	return _vdso_data;
>  }
>  
> +#ifdef CONFIG_TIME_NS
> +static __always_inline
> +const struct vdso_data *__arch_get_timens_vdso_data(void)
> +{
> +	return _timens_data;
> +}
> +#endif

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2020-04-14 17:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25  7:37 [PATCH v2 0/6] arm64: add the time namespace support Andrei Vagin
2020-02-25  7:37 ` [PATCH v2 1/6] arm64/vdso: use the fault callback to map vvar pages Andrei Vagin
2020-04-09 12:01   ` Vincenzo Frascino
2020-02-25  7:37 ` [PATCH v2 2/6] arm64/vdso: Zap vvar pages when switching to a time namespace Andrei Vagin
2020-04-09 12:01   ` Vincenzo Frascino
2020-02-25  7:37 ` [PATCH v2 3/6] arm64/vdso: Add time napespace page Andrei Vagin
2020-04-09 12:03   ` Vincenzo Frascino
2020-04-14 17:20   ` Mark Rutland [this message]
2020-04-15  2:34     ` Andrei Vagin
2020-04-15 10:05       ` Mark Rutland
2020-04-15 10:16         ` Vincenzo Frascino
2020-04-15 12:27           ` Mark Rutland
2020-02-25  7:37 ` [PATCH v2 4/6] arm64/vdso: Handle faults on timens page Andrei Vagin
2020-04-09 12:04   ` Vincenzo Frascino
2020-02-25  7:37 ` [PATCH v2 5/6] arm64/vdso: Restrict splitting VVAR VMA Andrei Vagin
2020-04-09 12:05   ` Vincenzo Frascino
2020-02-25  7:37 ` [PATCH v2 6/6] arm64: enable time namespace support Andrei Vagin
2020-04-09 12:06   ` Vincenzo Frascino
2020-04-01  6:50 ` [PATCH v2 0/6] arm64: add the " Andrei Vagin
2020-04-01  9:02   ` Vincenzo Frascino
2020-04-09 13:24 ` Vincenzo Frascino
2020-04-11  7:33   ` Andrei Vagin
2020-04-14  9:02     ` Vincenzo Frascino
2020-04-15 16:14       ` Andrei Vagin
2020-04-15 16:35         ` Vincenzo Frascino

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=20200414172014.GA6705@C02TD0UTHF1T.local \
    --to=mark.rutland@arm.com \
    --cc=avagin@gmail.com \
    --cc=dima@arista.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=vincenzo.frascino@arm.com \
    /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).