From: Cornelia Huck Subject: Re: [RFC PATCH 2/4] vhost: add byteswap routines Date: Mon, 3 Nov 2014 16:38:22 +0100 Message-ID: <20141103163822.5570c340.cornelia.huck@de.ibm.com> References: <1414571925-16918-1-git-send-email-clg@fr.ibm.com> <1414571925-16918-3-git-send-email-clg@fr.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: "Michael S. Tsirkin" , kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, agraf@suse.de, paulus@samba.org, gkurz@linux.vnet.ibm.com, aik@ozlabs.ru To: =?UTF-8?B?Q8OpZHJpYw==?= Le Goater Return-path: In-Reply-To: <1414571925-16918-3-git-send-email-clg@fr.ibm.com> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On Wed, 29 Oct 2014 09:38:43 +0100 C=C3=A9dric Le Goater wrote: > This patch adds a few helper routines around get_user and put_user > to ease byteswapping. >=20 > Signed-off-by: C=C3=A9dric Le Goater > --- >=20 > I am not sure these routines belong to this file. There is room for=20 > improvement to remove the ugly switch (sizeof(*(ptr))). Please=20 > comment ! >=20 > drivers/vhost/vhost.c | 93 +++++++++++++++++++++++++++++++++++++++= ++++++++++ > 1 file changed, 93 insertions(+) >=20 I'm wondering whether it would be a good idea to introduce generic {get,put}_user_reversed() routines. That way, you would push the switch (sizeof(*(ptr)) into uaccess code, where it needs to be done anyway. It also makes it possible to add optimizations there.