linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Andy Lutomirski <luto@amacapital.net>
Cc: Stefani Seibold <stefani@seibold.net>,
	linux-kernel@vger.kernel.org, x86@kernel.org, tglx@linutronix.de,
	mingo@redhat.com, ak@linux.intel.com, aarcange@redhat.com,
	john.stultz@linaro.org
Subject: Re: [PATCH] Add VDSO time function support for x86 32-bit kernel
Date: Thu, 13 Dec 2012 16:36:22 -0800	[thread overview]
Message-ID: <50CA7486.2070804@zytor.com> (raw)
In-Reply-To: <CALCETrV1kvhOvDpzTavGb1X9HT+PdEPXJ0H8afs7jzxpcF7Kjg@mail.gmail.com>

On 12/13/2012 04:20 PM, Andy Lutomirski wrote:
>>
>> Whatever data you need you can just map it into the vdso range.  There
>> really shouldn't be anything special about that at all.
>>
>> The fixmap stuff is an x86-64 legacy that you don't have to worry about,
>> obviously.
>
> The fixmap page is new.  It's not ABI -- the layout can freely change,
> but the vdso needs to be able to see.  It would make no sense to cow
> that page, and it would be more complicated to make it be part of the
> (64-bit) vdso, so I left it as a fixmap when I did the vvar cleanups.
>

Well, the vsyscall fixmap is an ABI.  But just because a page is mapped 
into userspace doesn't mean cow.  Think of it as a device mmap, or an 
mmap of a shared file.

> For compat mode, though, I don't think it can be in the fixmap unless
> there are segmentation games that I think are impossible, or unless
> the vdso wants to do a far call (which I would guess is not much
> faster than a system call, although I haven't benchmarked it).  This
> is because there are no addresses at all that can be seen from 32-bit
> code segments and that are in the kernel address range.

Yes, you'd have to nip into 64-bit mode which is not really practical.

> What you could do is probably arrange (using some linker script magic)
> for a symbol to exist that points at the page *before* the vdso
> starts.  Then just map the vvar page there when starting a compat
> task.  You could then address it using a normal symbol reference by
> tweaking the vvar macro.  (I think this'll access it via the GOT.)
> Alternatively, you could just pick an absolute address -- the page is
> NX, so you don't really need to worry about randomization.

IMO it seems this is making it way more complicated than it is.  Just 
make sure you have a section in the vdso where you can map in a data 
page with the symbols in the right offsets.  Extra points for doing 
magic so that it is at the beginning or end, but I think that might be 
harder than necessary.

	-hpa

-- 
H. Peter Anvin, Intel Open Source Technology Center
I work for Intel.  I don't speak on their behalf.


  reply	other threads:[~2012-12-14  0:36 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-12 20:19 [PATCH] Add VDSO time function support for x86 32-bit kernel stefani
2012-12-12 23:34 ` H. Peter Anvin
2012-12-13  5:53   ` Stefani Seibold
2012-12-13  6:10     ` H. Peter Anvin
2012-12-13  6:14     ` H. Peter Anvin
2012-12-13  6:17       ` Stefani Seibold
2012-12-13  6:47         ` H. Peter Anvin
2012-12-13  7:17           ` Stefani Seibold
2012-12-13 19:32             ` Andy Lutomirski
2012-12-14  0:09               ` H. Peter Anvin
2012-12-14  0:20                 ` Andy Lutomirski
2012-12-14  0:36                   ` H. Peter Anvin [this message]
2012-12-14  1:32                   ` H. Peter Anvin
2012-12-14  1:42                     ` Andy Lutomirski
2012-12-14  1:49                       ` H. Peter Anvin
2012-12-14  2:11                         ` Andy Lutomirski
2012-12-14  2:18                           ` H. Peter Anvin
2012-12-14  2:20                             ` Andy Lutomirski
2012-12-14  8:34                               ` [CRIU] " Pavel Emelyanov
2012-12-14 18:35                                 ` H. Peter Anvin
2012-12-14 18:44                                   ` Andy Lutomirski
2012-12-14 18:47                                     ` H. Peter Anvin
2012-12-14 20:12                                       ` Cyrill Gorcunov
2012-12-14 21:08                                         ` H. Peter Anvin
2012-12-14 21:20                                           ` Cyrill Gorcunov
2012-12-14 21:21                                             ` H. Peter Anvin
2012-12-14 21:27                                           ` Andy Lutomirski
2012-12-14 22:00                                             ` H. Peter Anvin
2012-12-14 22:25                                               ` Cyrill Gorcunov
2012-12-14 22:27                                                 ` H. Peter Anvin
2012-12-14 22:43                                                   ` Cyrill Gorcunov
2012-12-14 22:48                                                     ` H. Peter Anvin
2012-12-14 23:48                                                       ` John Stultz
2012-12-14 23:55                                                         ` H. Peter Anvin
2012-12-17  9:05                                     ` Pavel Emelyanov
     [not found]                                       ` <fb2e871b-3e2a-4e96-9eb9-cb2dd4f66eaa@email.android! .com>
2012-12-17 15:21                                       ` H. Peter Anvin
2012-12-17 18:56                                         ` Pavel Emelyanov
2012-12-17 18:57                                           ` H. Peter Anvin
2012-12-14 22:46                                 ` H. Peter Anvin
2012-12-14 23:09                                   ` Stefani Seibold
2012-12-14 23:29                                     ` H. Peter Anvin
  -- strict thread matches above, loose matches on Subject: below --
2012-12-11 16:11 stefani
2012-12-11 19:27 ` John Stultz
2012-12-11 19:37   ` Andy Lutomirski
2012-12-11 20:54   ` Stefani Seibold
2012-12-11 21:18     ` Andy Lutomirski
2012-12-11 21:28       ` Stefani Seibold
2012-12-11 19:37 ` Andy Lutomirski
2012-12-11 20:40   ` Stefani Seibold
2012-12-12  1:29     ` Andy Lutomirski

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=50CA7486.2070804@zytor.com \
    --to=hpa@zytor.com \
    --cc=aarcange@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@amacapital.net \
    --cc=mingo@redhat.com \
    --cc=stefani@seibold.net \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.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).