From: Martin Pool <mbp@samba.org>
To: linux-ia64@vger.kernel.org
Subject: [Linux-ia64] avoid exceptions in copy_from_user?
Date: Fri, 02 May 2003 06:43:37 +0000 [thread overview]
Message-ID: <marc-linux-ia64-105590723705628@msgid-missing> (raw)
This is probably a flawed idea but I was just curious: could the
kernel use speculative loads to avoid taking exceptions when a
copy_from_user or related function faults? (Something like the
routine below.)
I thought that if the chk.s instructions could fit into otherwise
unused slots, then failing copies would avoid needing to take an
interrupt and search the fixup table, and could instead branch
directly to the code to clean up and return.
I suspect the answer is that it's not worthwhile, because if the copy
fails then the kernel is about to go and do something expensive like
paging or killing the task, and so a little more overhead is not
important, and anyhow adding instructions to the non-failing case is
undesirable.
// int readit(int *a)
// return the contents of a, or -1 if a is not a valid pointer
.text
.align 16
.global readit#
.proc readit#
readit:
.prologue
// one input, no locals
alloc r2 = ar.pfs, 1, 0, 0, 0
.body
// Try to read the thing
ld8.s ret0 = [in0]
;;
// Did we break?
chk.s ret0, .recovery
// Return
br.ret.sptk.many b0
.recovery:
mov ret0 = -1
;;
br.ret.sptk.many b0
.end readit#
--
Martin
next reply other threads:[~2003-05-02 6:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-02 6:43 Martin Pool [this message]
2003-05-02 7:13 ` [Linux-ia64] avoid exceptions in copy_from_user? David Mosberger
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=marc-linux-ia64-105590723705628@msgid-missing \
--to=mbp@samba.org \
--cc=linux-ia64@vger.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