From: Oleg Nesterov <oleg@redhat.com>
To: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Roland McGrath <roland@redhat.com>,
"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
LKML <linux-kernel@vger.kernel.org>,
hjl.tools@gmail.com
Subject: Re: [patch v2 2/4] x86, ptrace: regset extensions to support xstate
Date: Wed, 10 Feb 2010 12:28:22 +0100 [thread overview]
Message-ID: <20100210112822.GB4546@redhat.com> (raw)
In-Reply-To: <20100209202502.216592031@sbs-t61.sc.intel.com>
On 02/09, Suresh Siddha wrote:
>
> +int xstateregs_get(struct task_struct *target, const struct user_regset *regset,
> + unsigned int pos, unsigned int count,
> + void *kbuf, void __user *ubuf)
> +{
> + int ret;
> + int size = regset->n * regset->size;
> + struct xsave_hdr_struct *xsave_hdr =
> + &target->thread.xstate->xsave.xsave_hdr;
> +
> + if (!cpu_has_xsave)
> + return -ENODEV;
> +
> + ret = init_fpu(target);
> + if (ret)
> + return ret;
> +
> + /*
> + * First copy the fxsave bytes 0..463
> + */
> + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> + &target->thread.xstate->xsave, 0,
> + offsetof(struct i387_fxsave_struct,
> + sw_reserved));
> + if (!ret)
> + /*
> + * Copy the 48bytes defined by software
> + */
> + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> + xstate_fx_sw_bytes,
> + offsetof(struct i387_fxsave_struct,
> + sw_reserved),
> + offsetof(struct xsave_struct,
> + xsave_hdr));
Hmm. Suresh, could you confirm these offsetof's are correct?
We are copying xstate_fx_sw_bytes array which is u64[6], but
start_pos == sizeof(i387_fxsave_struct) - padding ?
While we are here. Perhaps it would be more symmetrical to do
ret = user_regset_copyout();
if (ret)
return ret;
instead of "if (!ret)" which needs a tab, but this is up to you.
> + if (!ret)
> + /*
> + * Copy the rest of xstate memory layout
> + */
> + ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> + xsave_hdr,
Another very minor nit, this is the only user of xsave_hdr, but this
var was defined at the top. Perhaps it would be a bit more clean to
have
struct xsave_struct *xsave = target->thread.xstate->xsave;
and use it in 1st and 3rd copyout?
Speaking about the first user_regset_copyout(), perhaps xsave->i387
would be more clear than xsave?
Oleg.
next prev parent reply other threads:[~2010-02-10 11:30 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-09 20:13 [patch v2 0/4] updated ptrace/core-dump patches for supporting xstate - V2 Suresh Siddha
2010-02-09 20:13 ` [patch v2 1/4] revert "x86: ptrace and core-dump extensions for xstate" Suresh Siddha
2010-02-09 22:54 ` [tip:x86/ptrace] Revert " tip-bot for Suresh Siddha
2010-02-09 20:13 ` [patch v2 2/4] x86, ptrace: regset extensions to support xstate Suresh Siddha
2010-02-09 22:54 ` [tip:x86/ptrace] x86, ptrace: Regset " tip-bot for Suresh Siddha
2010-02-10 1:30 ` [patch v2 2/4] x86, ptrace: regset " Roland McGrath
2010-02-10 10:44 ` Oleg Nesterov
2010-02-10 11:28 ` Oleg Nesterov [this message]
2010-02-10 15:43 ` Oleg Nesterov
2010-02-10 18:26 ` Roland McGrath
2010-02-10 14:18 ` Oleg Nesterov
2010-02-10 15:34 ` Oleg Nesterov
2010-02-09 20:13 ` [patch v2 3/4] x86, ptrace: prepare regset get/set routines for user specified lengths Suresh Siddha
2010-02-09 22:55 ` [tip:x86/ptrace] x86, ptrace: Prepare " tip-bot for Suresh Siddha
2010-02-10 1:32 ` [patch v2 3/4] x86, ptrace: prepare " Roland McGrath
2010-02-09 20:13 ` [patch v2 4/4] ptrace: Add support for generic PTRACE_GETREGSET/PTRACE_SETREGSET Suresh Siddha
2010-02-09 22:55 ` [tip:x86/ptrace] " tip-bot for Suresh Siddha
2010-02-10 1:52 ` [patch v2 4/4] " Roland McGrath
2010-02-10 2:03 ` H.J. Lu
2010-02-10 3:07 ` Roland McGrath
2010-02-10 4:24 ` H.J. Lu
2010-02-10 13:18 ` Oleg Nesterov
2010-02-10 19:12 ` Roland McGrath
2010-02-11 2:17 ` H. Peter Anvin
2010-02-11 3:30 ` Roland McGrath
2010-02-10 1:12 ` [patch v2 0/4] updated ptrace/core-dump patches for supporting xstate - V2 Roland McGrath
2010-02-10 1:22 ` Suresh Siddha
2010-02-10 7:27 ` Ingo Molnar
2010-02-10 18:58 ` Roland McGrath
2010-02-11 2:18 ` H. Peter Anvin
2010-02-11 3:45 ` Roland McGrath
2010-02-11 4:16 ` H. Peter Anvin
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=20100210112822.GB4546@redhat.com \
--to=oleg@redhat.com \
--cc=hjl.tools@gmail.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=roland@redhat.com \
--cc=suresh.b.siddha@intel.com \
--cc=tglx@linutronix.de \
/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