All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Fengguang Wu <fengguang.wu@intel.com>,
	Arnd Bergmann <arnd@arndb.de>,
	Sudeep Dutt <sudeep.dutt@intel.com>,
	linux-kernel@vger.kernel.org,
	Siva Krishna Kumar Reddy Yerramreddy
	<siva.krishna.kumar.reddy.yerramreddy@intel.com>,
	virtualization@lists.linux-foundation.org,
	Caz Yokoyama <Caz.Yokoyama@intel.com>,
	Dasaratharaman Chandramouli
	<dasaratharaman.chandramouli@intel.com>
Subject: Re: [PATCH char-misc-linus 4/5] misc: mic: Fix sparse warnings and other endianness issues.
Date: Tue, 26 Nov 2013 11:15:25 -0800	[thread overview]
Message-ID: <20131126191525.GA29279@kroah.com> (raw)
In-Reply-To: <e5bcd02bd49b111e2d4f885655461e889b8049a3.1385487752.git.ashutosh.dixit@intel.com>

On Tue, Nov 26, 2013 at 10:14:21AM -0800, Ashutosh Dixit wrote:
> Endianness issues are now consistent as per the documentation in
> host/mic_virtio.h. Note that the host can be both BE or LE whereas the
> card is always LE.
> 
> Memory space sparse warnings are fixed for now by using __force. This is
> sufficient for now since the driver depends on x86 but will need to be
> revisited if we support other architectures which treat I/O memory
> differently from system memory.

There's no need for this for 3.13-final, right?  No bug fixes are here
that I can tell.

And don't use __force, really, can't you fix this some other way?

> diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c
> index 4dce912..c975c36 100644
> --- a/drivers/misc/mic/card/mic_virtio.c
> +++ b/drivers/misc/mic/card/mic_virtio.c
> @@ -248,17 +248,17 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev,
>  	/* First assign the vring's allocated in host memory */
>  	vqconfig = mic_vq_config(mvdev->desc) + index;
>  	memcpy_fromio(&config, vqconfig, sizeof(config));
> -	_vr_size = vring_size(config.num, MIC_VIRTIO_RING_ALIGN);
> +	_vr_size = vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN);
>  	vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info));
> -	va = mic_card_map(mvdev->mdev, config.address, vr_size);
> +	va = mic_card_map(mvdev->mdev, le64_to_cpu(config.address), vr_size);
>  	if (!va)
>  		return ERR_PTR(-ENOMEM);
>  	mvdev->vr[index] = va;
>  	memset_io(va, 0x0, _vr_size);
> -	vq = vring_new_virtqueue(index,
> -				config.num, MIC_VIRTIO_RING_ALIGN, vdev,
> -				false,
> -				va, mic_notify, callback, name);
> +	vq = vring_new_virtqueue(index, le16_to_cpu(config.num),
> +				 MIC_VIRTIO_RING_ALIGN, vdev, false,
> +				 (void __force *)va, mic_notify, callback,
> +				 name);

Why __force a void * here?  That feels wrong.

Can you split the endian fixes up from the user pointer fixes to make it
easier to review/apply?

thanks,

greg k-h

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	Dasaratharaman Chandramouli 
	<dasaratharaman.chandramouli@intel.com>,
	Sudeep Dutt <sudeep.dutt@intel.com>,
	Nikhil Rao <nikhil.rao@intel.com>,
	Siva Krishna Kumar Reddy Yerramreddy 
	<siva.krishna.kumar.reddy.yerramreddy@intel.com>,
	Caz Yokoyama <Caz.Yokoyama@intel.com>,
	Fengguang Wu <fengguang.wu@intel.com>
Subject: Re: [PATCH char-misc-linus 4/5] misc: mic: Fix sparse warnings and other endianness issues.
Date: Tue, 26 Nov 2013 11:15:25 -0800	[thread overview]
Message-ID: <20131126191525.GA29279@kroah.com> (raw)
In-Reply-To: <e5bcd02bd49b111e2d4f885655461e889b8049a3.1385487752.git.ashutosh.dixit@intel.com>

On Tue, Nov 26, 2013 at 10:14:21AM -0800, Ashutosh Dixit wrote:
> Endianness issues are now consistent as per the documentation in
> host/mic_virtio.h. Note that the host can be both BE or LE whereas the
> card is always LE.
> 
> Memory space sparse warnings are fixed for now by using __force. This is
> sufficient for now since the driver depends on x86 but will need to be
> revisited if we support other architectures which treat I/O memory
> differently from system memory.

There's no need for this for 3.13-final, right?  No bug fixes are here
that I can tell.

And don't use __force, really, can't you fix this some other way?

> diff --git a/drivers/misc/mic/card/mic_virtio.c b/drivers/misc/mic/card/mic_virtio.c
> index 4dce912..c975c36 100644
> --- a/drivers/misc/mic/card/mic_virtio.c
> +++ b/drivers/misc/mic/card/mic_virtio.c
> @@ -248,17 +248,17 @@ static struct virtqueue *mic_find_vq(struct virtio_device *vdev,
>  	/* First assign the vring's allocated in host memory */
>  	vqconfig = mic_vq_config(mvdev->desc) + index;
>  	memcpy_fromio(&config, vqconfig, sizeof(config));
> -	_vr_size = vring_size(config.num, MIC_VIRTIO_RING_ALIGN);
> +	_vr_size = vring_size(le16_to_cpu(config.num), MIC_VIRTIO_RING_ALIGN);
>  	vr_size = PAGE_ALIGN(_vr_size + sizeof(struct _mic_vring_info));
> -	va = mic_card_map(mvdev->mdev, config.address, vr_size);
> +	va = mic_card_map(mvdev->mdev, le64_to_cpu(config.address), vr_size);
>  	if (!va)
>  		return ERR_PTR(-ENOMEM);
>  	mvdev->vr[index] = va;
>  	memset_io(va, 0x0, _vr_size);
> -	vq = vring_new_virtqueue(index,
> -				config.num, MIC_VIRTIO_RING_ALIGN, vdev,
> -				false,
> -				va, mic_notify, callback, name);
> +	vq = vring_new_virtqueue(index, le16_to_cpu(config.num),
> +				 MIC_VIRTIO_RING_ALIGN, vdev, false,
> +				 (void __force *)va, mic_notify, callback,
> +				 name);

Why __force a void * here?  That feels wrong.

Can you split the endian fixes up from the user pointer fixes to make it
easier to review/apply?

thanks,

greg k-h

  reply	other threads:[~2013-11-26 19:15 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-26 18:04 [PATCH char-misc-linus 0/5] misc: mic: Fixes for 3.13-rc2 Ashutosh Dixit
2013-11-26 18:08 ` [PATCH char-misc-linus 1/5] misc: mic: Change mic_notify(...) to return true Ashutosh Dixit
2013-11-26 18:08 ` Ashutosh Dixit
2013-11-26 18:11 ` [PATCH char-misc-linus 2/5] misc: mic: Minor bug fix in 'retry' loops Ashutosh Dixit
2013-11-26 18:11 ` Ashutosh Dixit
2013-11-26 18:12 ` [PATCH char-misc-linus 3/5] misc: mic: Bug fix for sysfs poll usage Ashutosh Dixit
2013-11-26 18:12 ` Ashutosh Dixit
2013-11-26 18:14 ` [PATCH char-misc-linus 4/5] misc: mic: Fix sparse warnings and other endianness issues Ashutosh Dixit
2013-11-26 19:15   ` Greg Kroah-Hartman [this message]
2013-11-26 19:15     ` Greg Kroah-Hartman
2013-11-27 17:12     ` Ashutosh Dixit
2013-11-27 17:12     ` Ashutosh Dixit
2013-11-26 18:14 ` Ashutosh Dixit
2013-11-26 18:15 ` [PATCH char-misc-linus 5/5] misc: mic: Fix user space namespace pollution from mic_common.h Ashutosh Dixit
2013-11-26 18:15 ` Ashutosh Dixit
2013-11-26 18:12   ` H. Peter Anvin
2013-11-26 18:12   ` 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=20131126191525.GA29279@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Caz.Yokoyama@intel.com \
    --cc=arnd@arndb.de \
    --cc=ashutosh.dixit@intel.com \
    --cc=dasaratharaman.chandramouli@intel.com \
    --cc=fengguang.wu@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=siva.krishna.kumar.reddy.yerramreddy@intel.com \
    --cc=sudeep.dutt@intel.com \
    --cc=virtualization@lists.linux-foundation.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.