mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Roland McGrath <roland@redhat.com>
To: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Oleg Nesterov <oleg@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, peter.lachner@intel.com
Subject: Re: [patch v3 1/2] x86, ptrace: regset extensions to support xstate
Date: Thu, 11 Feb 2010 19:45:20 -0800 (PST)	[thread overview]
Message-ID: <20100212034520.0FABFC821@magilla.sf.frob.com> (raw)
In-Reply-To: Suresh Siddha's message of  Thursday, 11 February 2010 11:50:59 -0800 <20100211195614.802495327@sbs-t61.sc.intel.com>

> +	/*
> +	 * First copy the fxsave bytes 0..463.
> +	 */
> +	ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> +				  &target->thread.xstate->xsave, 0,
> +				  offsetof(struct user_xstateregs,
> +					   i387.xstate_fx_sw));
> +	if (ret)
> +		return ret;
> +
> +	/*
> +	 * Copy the 48bytes defined by software.
> +	 */
> +	ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> +				  xstate_fx_sw_bytes,
> +				  offsetof(struct user_xstateregs,
> +					   i387.xstate_fx_sw),
> +				  offsetof(struct user_xstateregs,
> +					   xsave_hdr));
> +	if (ret)
> +		return ret;
> +
> +	/*
> +	 * Copy the rest of xstate memory layout.
> +	 */
> +	ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf,
> +				  &target->thread.xstate->xsave.xsave_hdr,
> +				  offsetof(struct user_xstateregs,
> +					   xsave_hdr), -1);
> +	return ret;

I don't know why this didn't occur to me before.  Is there a reason not to
just copy xstate_fx_sw_bytes into the thread.xstate buffer?  You could just
do it right here, or in the places that really touch thread.xstate contents.

Then the trivial single user_regset_copyout() call would be all you need
here, and that seems simpler.  IMHO it's enough simpler that even if you
pay the 6-words memcpy every time here, it's worth it.

If you don't want to do that, that's fine too.  
The code looks correct as it is.

> --- tip.orig/arch/x86/include/asm/user.h
> +++ tip/arch/x86/include/asm/user.h

I don't have any special opinions about the placement, naming, etc. of
these asm/user.h bits (just that there be some symbolic form of the ABI
somewhere).  But perhaps folks want to think about it a bit more before we
bake it into the source API.

These definitions duplicate the asm/processor.h ones used inside the kernel.
IMHO these should be consolidated so asm/processor.h refers to the public types.

I'm not sure whether 'struct user_*' names make most sense for these or not.
They are processor-defined layouts.

> +struct user_ymmh_regs {
> +	/* 16 * 16 bytes for each YMMH-reg */
> +	__u32 ymmh_space[64];
> +};

This is the high half of %ymmN registers, where %xmmN is the low half.
Right?  Though of course documented in the chip manuals, it is rather
nonobvious that %ymmN are split this way in the storage, so I think it
merits a comment here saying so explicitly.


On these cosmetic issues I leave it up to you and the x86 maintainers.
I don't have strong opinions.  But I wanted to air what had occurred to me.

Modulo any cosmetic changes you want to make, this patch has my ACK
contingent on Oleg's ACK.


Thanks,
Roland

  parent reply	other threads:[~2010-02-12  3:45 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-11 19:50 [patch v3 0/2] updated ptrace/core-dump patches for supporting xstate - v3 Suresh Siddha
2010-02-11 19:50 ` [patch v3 1/2] x86, ptrace: regset extensions to support xstate Suresh Siddha
2010-02-11 23:18   ` [tip:x86/ptrace] " tip-bot for Suresh Siddha
2010-02-12  3:45   ` Roland McGrath [this message]
2010-02-12 17:31   ` [patch v3 1/2] " Oleg Nesterov
2010-02-11 19:51 ` [patch v3 2/2] ptrace: Add support for generic PTRACE_GETREGSET/PTRACE_SETREGSET Suresh Siddha
2010-02-11 23:19   ` [tip:x86/ptrace] " tip-bot for Suresh Siddha
2010-02-22  9:07     ` Ingo Molnar
2010-02-22  9:33       ` linux-next requiements (Was: Re: [tip:x86/ptrace] ptrace: Add support for generic PTRACE_GETREGSET/PTRACE_SETREGSET) Stephen Rothwell
2010-02-22 10:27         ` Ingo Molnar
2010-02-22 11:47           ` linux-next requirements " Stephen Rothwell
2010-02-22 22:57             ` H. Peter Anvin
2010-02-22 23:59               ` Stephen Rothwell
2010-02-23 20:20                 ` Roland McGrath
2010-02-23 20:49                   ` H. Peter Anvin
2010-02-23 22:54                     ` Stephen Rothwell
2010-02-23  8:45             ` Ingo Molnar
2010-02-23 19:52               ` Al Viro
2010-02-23 19:57                 ` Al Viro
2010-02-24  7:25               ` linux-next requirements Stephen Rothwell
2010-02-27  1:53                 ` Grant Likely
2010-02-27  8:53                   ` Geert Uytterhoeven
2010-02-27  9:09                 ` Jaswinder Singh Rajput
2010-02-27  9:39                 ` Ingo Molnar
2010-02-27 12:23                   ` Rafael J. Wysocki
2010-02-27 12:47                     ` Ingo Molnar
2010-02-27 19:07                       ` Rafael J. Wysocki
2010-02-27 21:50                         ` Geert Uytterhoeven
2010-02-27 22:31                           ` Rafael J. Wysocki
2010-02-28  7:06                         ` Ingo Molnar
2010-02-28 12:22                           ` Rafael J. Wysocki
2010-02-28  7:14                         ` Ingo Molnar
2010-02-28  7:37                           ` Stephen Rothwell
2010-02-28  7:51                             ` Ingo Molnar
2010-02-28  8:19                               ` Al Viro
2010-02-28  8:53                                 ` Ingo Molnar
2010-02-28 10:26                                 ` Stephen Rothwell
2010-02-28  7:23                         ` Ingo Molnar
2010-03-01 15:13                           ` Nick Bowler
2010-03-03 21:53                           ` Pavel Machek
2010-03-04  0:35                             ` Thomas Gleixner
2010-03-04  0:42                               ` Andrew Morton
2010-03-04  1:17                                 ` Thomas Gleixner
2010-03-04  2:48                                   ` Ingo Molnar
2010-02-22 18:37       ` [tip:x86/ptrace] ptrace: Add support for generic PTRACE_GETREGSET/PTRACE_SETREGSET Roland McGrath
2010-02-23 18:36         ` [tip:x86/ptrace] parisc: Disable CONFIG_HAVE_ARCH_TRACEHOOK tip-bot for Roland McGrath
2010-02-12  3:56   ` [patch v3 2/2] ptrace: Add support for generic PTRACE_GETREGSET/PTRACE_SETREGSET Roland McGrath
2010-02-12 15:59     ` Oleg Nesterov

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=20100212034520.0FABFC821@magilla.sf.frob.com \
    --to=roland@redhat.com \
    --cc=hjl.tools@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@redhat.com \
    --cc=peter.lachner@intel.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

all inboxes | Powered by JetHome®