* [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
@ 2015-12-09 17:08 ` Niranjan Dighe
0 siblings, 0 replies; 9+ messages in thread
From: Niranjan Dighe @ 2015-12-09 17:08 UTC (permalink / raw)
To: Oleg Drokin, Andreas Dilger, Greg Kroah-Hartman, Dmitry Eremin,
James Simmons, Mike Rapoport, Patrick Boettcher, Matthew Tyler
Cc: lustre-devel, devel, linux-kernel
The third argument to function kportal_memhog_alloc is expected to
be gfp_t whereas the actual argument was unsigned int. Fix this by
explicitly typecasting to gfp_t
Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
---
drivers/staging/lustre/lustre/libcfs/module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 96d9d46..9c79f6e 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -268,7 +268,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
/* XXX The ioc_flags is not GFP flags now, need to be fixed */
err = kportal_memhog_alloc(pfile->private_data,
data->ioc_count,
- data->ioc_flags);
+ (__force gfp_t)data->ioc_flags);
if (err != 0)
kportal_memhog_free(pfile->private_data);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [lustre-devel] [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
@ 2015-12-09 17:08 ` Niranjan Dighe
0 siblings, 0 replies; 9+ messages in thread
From: Niranjan Dighe @ 2015-12-09 17:08 UTC (permalink / raw)
To: lustre-devel
The third argument to function kportal_memhog_alloc is expected to
be gfp_t whereas the actual argument was unsigned int. Fix this by
explicitly typecasting to gfp_t
Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
---
drivers/staging/lustre/lustre/libcfs/module.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 96d9d46..9c79f6e 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -268,7 +268,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
/* XXX The ioc_flags is not GFP flags now, need to be fixed */
err = kportal_memhog_alloc(pfile->private_data,
data->ioc_count,
- data->ioc_flags);
+ (__force gfp_t)data->ioc_flags);
if (err != 0)
kportal_memhog_free(pfile->private_data);
}
--
1.9.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
2015-12-09 17:08 ` [lustre-devel] " Niranjan Dighe
(?)
@ 2015-12-21 23:44 ` Greg Kroah-Hartman
2015-12-22 13:05 ` Niranjan Dighe
-1 siblings, 1 reply; 9+ messages in thread
From: Greg Kroah-Hartman @ 2015-12-21 23:44 UTC (permalink / raw)
To: Niranjan Dighe
Cc: Oleg Drokin, Andreas Dilger, Dmitry Eremin, James Simmons,
Mike Rapoport, Patrick Boettcher, Matthew Tyler, devel,
linux-kernel, lustre-devel
On Wed, Dec 09, 2015 at 10:38:13PM +0530, Niranjan Dighe wrote:
> The third argument to function kportal_memhog_alloc is expected to
> be gfp_t whereas the actual argument was unsigned int. Fix this by
> explicitly typecasting to gfp_t
>
> Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
> ---
> drivers/staging/lustre/lustre/libcfs/module.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
> index 96d9d46..9c79f6e 100644
> --- a/drivers/staging/lustre/lustre/libcfs/module.c
> +++ b/drivers/staging/lustre/lustre/libcfs/module.c
> @@ -268,7 +268,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
> /* XXX The ioc_flags is not GFP flags now, need to be fixed */
> err = kportal_memhog_alloc(pfile->private_data,
> data->ioc_count,
> - data->ioc_flags);
> + (__force gfp_t)data->ioc_flags);
No, please fix the type to be correct properly, like the comment says
needs to be done.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
2015-12-21 23:44 ` Greg Kroah-Hartman
@ 2015-12-22 13:05 ` Niranjan Dighe
2015-12-22 15:26 ` Greg Kroah-Hartman
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Niranjan Dighe @ 2015-12-22 13:05 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Oleg Drokin, Andreas Dilger, Dmitry Eremin, James Simmons,
Mike Rapoport, Patrick Boettcher, Matthew Tyler, devel,
linux-kernel, lustre-devel
On Tue, Dec 22, 2015 at 5:14 AM, Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> On Wed, Dec 09, 2015 at 10:38:13PM +0530, Niranjan Dighe wrote:
>> The third argument to function kportal_memhog_alloc is expected to
>> be gfp_t whereas the actual argument was unsigned int. Fix this by
>> explicitly typecasting to gfp_t
>>
>> Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
>> ---
>> drivers/staging/lustre/lustre/libcfs/module.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
>> index 96d9d46..9c79f6e 100644
>> --- a/drivers/staging/lustre/lustre/libcfs/module.c
>> +++ b/drivers/staging/lustre/lustre/libcfs/module.c
>> @@ -268,7 +268,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
>> /* XXX The ioc_flags is not GFP flags now, need to be fixed */
>> err = kportal_memhog_alloc(pfile->private_data,
>> data->ioc_count,
>> - data->ioc_flags);
>> + (__force gfp_t)data->ioc_flags);
>
> No, please fix the type to be correct properly, like the comment says
> needs to be done.
>
> thanks,
>
> greg k-h
Hello Greg,
I could see that the ioc_flags member of the struct libcfs_ioctl_data
is used as gfp_t only in the
case of the ioctl IOC_LIBCFS_MEMHOG. I can think of following ways to
correct it -
1. Create a union that has 2 different types encapsulated, something like this -
union {
__u32 ioc_flags;
gfp_t alloc_flags;
}flags;
Because, the ioc_flags seems to be used in different contexts at
different places throughout the
drivers/staging/lustre directory.
2. Is it OK to hardcode the appropriate gfp_t flags for the
IOC_LIBCFS_MEMHOG, as the userspace
seems to be taking the decision about the page allocation
zone/strategy, is this what is intended?
Regards,
Niranjan Dighe
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
2015-12-22 13:05 ` Niranjan Dighe
@ 2015-12-22 15:26 ` Greg Kroah-Hartman
2015-12-22 22:04 ` Dilger, Andreas
2016-01-05 15:43 ` Simmons, James A.
2 siblings, 0 replies; 9+ messages in thread
From: Greg Kroah-Hartman @ 2015-12-22 15:26 UTC (permalink / raw)
To: Niranjan Dighe
Cc: devel, Dmitry Eremin, Andreas Dilger, Patrick Boettcher,
linux-kernel, Oleg Drokin, James Simmons, Matthew Tyler,
lustre-devel
On Tue, Dec 22, 2015 at 06:35:21PM +0530, Niranjan Dighe wrote:
> On Tue, Dec 22, 2015 at 5:14 AM, Greg Kroah-Hartman
> <gregkh@linuxfoundation.org> wrote:
> > On Wed, Dec 09, 2015 at 10:38:13PM +0530, Niranjan Dighe wrote:
> >> The third argument to function kportal_memhog_alloc is expected to
> >> be gfp_t whereas the actual argument was unsigned int. Fix this by
> >> explicitly typecasting to gfp_t
> >>
> >> Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
> >> ---
> >> drivers/staging/lustre/lustre/libcfs/module.c | 2 +-
> >> 1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
> >> index 96d9d46..9c79f6e 100644
> >> --- a/drivers/staging/lustre/lustre/libcfs/module.c
> >> +++ b/drivers/staging/lustre/lustre/libcfs/module.c
> >> @@ -268,7 +268,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
> >> /* XXX The ioc_flags is not GFP flags now, need to be fixed */
> >> err = kportal_memhog_alloc(pfile->private_data,
> >> data->ioc_count,
> >> - data->ioc_flags);
> >> + (__force gfp_t)data->ioc_flags);
> >
> > No, please fix the type to be correct properly, like the comment says
> > needs to be done.
> >
> > thanks,
> >
> > greg k-h
>
> Hello Greg,
>
> I could see that the ioc_flags member of the struct libcfs_ioctl_data
> is used as gfp_t only in the
> case of the ioctl IOC_LIBCFS_MEMHOG. I can think of following ways to
> correct it -
>
> 1. Create a union that has 2 different types encapsulated, something like this -
> union {
> __u32 ioc_flags;
> gfp_t alloc_flags;
> }flags;
> Because, the ioc_flags seems to be used in different contexts at
> different places throughout the
> drivers/staging/lustre directory.
This crosses the user/kernel boundry? Hah, no, just drop it, don't
touch this at all, lustre ioctls are a complete mess and need to be
fixed up by the authors who can test them, just leave this alone for
now, sorry.
greg k-h
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
2015-12-22 13:05 ` Niranjan Dighe
2015-12-22 15:26 ` Greg Kroah-Hartman
@ 2015-12-22 22:04 ` Dilger, Andreas
2015-12-23 6:27 ` Niranjan Dighe
2016-01-05 15:43 ` Simmons, James A.
2 siblings, 1 reply; 9+ messages in thread
From: Dilger, Andreas @ 2015-12-22 22:04 UTC (permalink / raw)
To: Niranjan Dighe
Cc: Drokin, Oleg, Eremin, Dmitry, James Simmons, Mike Rapoport,
Patrick Boettcher, Matthew Tyler, devel, linux-kernel,
lustre-devel, Greg Kroah-Hartman
On 2015/12/22, 06:05, "Niranjan Dighe" <niranjan.dighe@gmail.com> wrote:
>On Tue, Dec 22, 2015 at 5:14 AM, Greg Kroah-Hartman
><gregkh@linuxfoundation.org> wrote:
>> On Wed, Dec 09, 2015 at 10:38:13PM +0530, Niranjan Dighe wrote:
>>> The third argument to function kportal_memhog_alloc is expected to
>>> be gfp_t whereas the actual argument was unsigned int. Fix this by
>>> explicitly typecasting to gfp_t
>>>
>>> Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
>>> ---
>>> drivers/staging/lustre/lustre/libcfs/module.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/staging/lustre/lustre/libcfs/module.c
>>>b/drivers/staging/lustre/lustre/libcfs/module.c
>>> index 96d9d46..9c79f6e 100644
>>> --- a/drivers/staging/lustre/lustre/libcfs/module.c
>>> +++ b/drivers/staging/lustre/lustre/libcfs/module.c
>>> @@ -268,7 +268,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file
>>>*pfile, unsigned long cmd,
>>> /* XXX The ioc_flags is not GFP flags now, need
>>>to be fixed */
>>> err = kportal_memhog_alloc(pfile->private_data,
>>> data->ioc_count,
>>> - data->ioc_flags);
>>> + (__force gfp_t)data->ioc_flags);
>>
>> No, please fix the type to be correct properly, like the comment says
>> needs to be done.
>>
>> thanks,
>>
>> greg k-h
>
>Hello Greg,
>
>I could see that the ioc_flags member of the struct libcfs_ioctl_data
>is used as gfp_t only in the
>case of the ioctl IOC_LIBCFS_MEMHOG. I can think of following ways to
>correct it -
>
>1. Create a union that has 2 different types encapsulated, something like
>this -
> union {
> __u32 ioc_flags;
> gfp_t alloc_flags;
> }flags;
>Because, the ioc_flags seems to be used in different contexts at
>different places throughout the
>drivers/staging/lustre directory.
>
>2. Is it OK to hardcode the appropriate gfp_t flags for the
>IOC_LIBCFS_MEMHOG, as the userspace
>seems to be taking the decision about the page allocation
>zone/strategy, is this what is intended?
The memhog functionality is used to introduce memory pressure on a client
or server during operation to test error handling as well as memory
allocation deadlocks (e.g. GFP_KERNEL used where GFP_NOFS should be used).
There are other ways to do this in the kernel today, so all of the memhog
code could just be deleted I think.
This looks like kportal_memhog_alloc(), kportal_memhog_free(),
IOC_LIBCFS_MEMHOG, and struct libcfs_device_userstate could be removed.
Cheers, Andreas
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
2015-12-22 22:04 ` Dilger, Andreas
@ 2015-12-23 6:27 ` Niranjan Dighe
2016-01-05 20:54 ` [lustre-devel] " Simmons, James A.
0 siblings, 1 reply; 9+ messages in thread
From: Niranjan Dighe @ 2015-12-23 6:27 UTC (permalink / raw)
To: Dilger, Andreas
Cc: Drokin, Oleg, Eremin, Dmitry, James Simmons, Mike Rapoport,
Patrick Boettcher, Matthew Tyler, devel, linux-kernel,
lustre-devel, Greg Kroah-Hartman
On Wed, Dec 23, 2015 at 3:34 AM, Dilger, Andreas
<andreas.dilger@intel.com> wrote:
> On 2015/12/22, 06:05, "Niranjan Dighe" <niranjan.dighe@gmail.com> wrote:
>
>>On Tue, Dec 22, 2015 at 5:14 AM, Greg Kroah-Hartman
>><gregkh@linuxfoundation.org> wrote:
>>> On Wed, Dec 09, 2015 at 10:38:13PM +0530, Niranjan Dighe wrote:
>>>> The third argument to function kportal_memhog_alloc is expected to
>>>> be gfp_t whereas the actual argument was unsigned int. Fix this by
>>>> explicitly typecasting to gfp_t
>>>>
>>>> Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
>>>> ---
>>>> drivers/staging/lustre/lustre/libcfs/module.c | 2 +-
>>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>>
>>>> diff --git a/drivers/staging/lustre/lustre/libcfs/module.c
>>>>b/drivers/staging/lustre/lustre/libcfs/module.c
>>>> index 96d9d46..9c79f6e 100644
>>>> --- a/drivers/staging/lustre/lustre/libcfs/module.c
>>>> +++ b/drivers/staging/lustre/lustre/libcfs/module.c
>>>> @@ -268,7 +268,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file
>>>>*pfile, unsigned long cmd,
>>>> /* XXX The ioc_flags is not GFP flags now, need
>>>>to be fixed */
>>>> err = kportal_memhog_alloc(pfile->private_data,
>>>> data->ioc_count,
>>>> - data->ioc_flags);
>>>> + (__force gfp_t)data->ioc_flags);
>>>
>>> No, please fix the type to be correct properly, like the comment says
>>> needs to be done.
>>>
>>> thanks,
>>>
>>> greg k-h
>>
>>Hello Greg,
>>
>>I could see that the ioc_flags member of the struct libcfs_ioctl_data
>>is used as gfp_t only in the
>>case of the ioctl IOC_LIBCFS_MEMHOG. I can think of following ways to
>>correct it -
>>
>>1. Create a union that has 2 different types encapsulated, something like
>>this -
>> union {
>> __u32 ioc_flags;
>> gfp_t alloc_flags;
>> }flags;
>>Because, the ioc_flags seems to be used in different contexts at
>>different places throughout the
>>drivers/staging/lustre directory.
>>
>>2. Is it OK to hardcode the appropriate gfp_t flags for the
>>IOC_LIBCFS_MEMHOG, as the userspace
>>seems to be taking the decision about the page allocation
>>zone/strategy, is this what is intended?
>
> The memhog functionality is used to introduce memory pressure on a client
> or server during operation to test error handling as well as memory
> allocation deadlocks (e.g. GFP_KERNEL used where GFP_NOFS should be used).
> There are other ways to do this in the kernel today, so all of the memhog
> code could just be deleted I think.
>
> This looks like kportal_memhog_alloc(), kportal_memhog_free(),
> IOC_LIBCFS_MEMHOG, and struct libcfs_device_userstate could be removed.
>
>
> Cheers, Andreas
>
Thanks Andreas, I will send out a separate patch with the cleanup as
you suggested.
Regards,
Niranjan
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [lustre-devel] [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
2015-12-22 13:05 ` Niranjan Dighe
2015-12-22 15:26 ` Greg Kroah-Hartman
2015-12-22 22:04 ` Dilger, Andreas
@ 2016-01-05 15:43 ` Simmons, James A.
2 siblings, 0 replies; 9+ messages in thread
From: Simmons, James A. @ 2016-01-05 15:43 UTC (permalink / raw)
To: 'Niranjan Dighe', Greg Kroah-Hartman
Cc: devel, Patrick Boettcher, linux-kernel, Oleg Drokin,
Mike Rapoport, Matthew Tyler, lustre-devel
>> On Wed, Dec 09, 2015 at 10:38:13PM +0530, Niranjan Dighe wrote:
>>> The third argument to function kportal_memhog_alloc is expected to
>>> be gfp_t whereas the actual argument was unsigned int. Fix this by
>>> explicitly typecasting to gfp_t
>>>
>>> Signed-off-by: Niranjan Dighe <niranjan.dighe@gmail.com>
>>> ---
>>> drivers/staging/lustre/lustre/libcfs/module.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
>>> index 96d9d46..9c79f6e 100644
>>> --- a/drivers/staging/lustre/lustre/libcfs/module.c
>>> +++ b/drivers/staging/lustre/lustre/libcfs/module.c
>>> @@ -268,7 +268,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
>>> /* XXX The ioc_flags is not GFP flags now, need to be fixed */
>>> err = kportal_memhog_alloc(pfile->private_data,
>>> data->ioc_count,
>>> - data->ioc_flags);
>>> + (__force gfp_t)data->ioc_flags);
>>
>> No, please fix the type to be correct properly, like the comment says
>> needs to be done.
>>
>> thanks,
>>
>> greg k-h
>
>Hello Greg,
>
>I could see that the ioc_flags member of the struct libcfs_ioctl_data
>is used as gfp_t only in the
>case of the ioctl IOC_LIBCFS_MEMHOG. I can think of following ways to
>correct it -
IOC_LIBCFS_MEMHOG will be going away. Since this keeps coming up I will prepare some patches.
Especially now that out tools no longer uses these obsolete ioctls.
^ permalink raw reply [flat|nested] 9+ messages in thread
* RE: [lustre-devel] [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse
2015-12-23 6:27 ` Niranjan Dighe
@ 2016-01-05 20:54 ` Simmons, James A.
0 siblings, 0 replies; 9+ messages in thread
From: Simmons, James A. @ 2016-01-05 20:54 UTC (permalink / raw)
To: 'Niranjan Dighe', Dilger, Andreas
Cc: devel, Patrick Boettcher, Greg Kroah-Hartman, linux-kernel,
Drokin, Oleg, Mike Rapoport, Matthew Tyler, lustre-devel
>>>2. Is it OK to hardcode the appropriate gfp_t flags for the
>>>IOC_LIBCFS_MEMHOG, as the userspace
>>>seems to be taking the decision about the page allocation
>>>zone/strategy, is this what is intended?
>>
>> The memhog functionality is used to introduce memory pressure on a client
>> or server during operation to test error handling as well as memory
>> allocation deadlocks (e.g. GFP_KERNEL used where GFP_NOFS should be used).
>> There are other ways to do this in the kernel today, so all of the memhog
>> code could just be deleted I think.
>>
>> This looks like kportal_memhog_alloc(), kportal_memhog_free(),
>> IOC_LIBCFS_MEMHOG, and struct libcfs_device_userstate could be removed.
>>
>>
>> Cheers, Andreas
>>
>Thanks Andreas, I will send out a separate patch with the cleanup as
>you suggested.
I missed this email. I just sent the cleanup patches a bit ago.
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-01-05 21:07 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-09 17:08 [PATCH] staging: lustre/lustre/libcfs: Fix type mismatch reported by sparse Niranjan Dighe
2015-12-09 17:08 ` [lustre-devel] " Niranjan Dighe
2015-12-21 23:44 ` Greg Kroah-Hartman
2015-12-22 13:05 ` Niranjan Dighe
2015-12-22 15:26 ` Greg Kroah-Hartman
2015-12-22 22:04 ` Dilger, Andreas
2015-12-23 6:27 ` Niranjan Dighe
2016-01-05 20:54 ` [lustre-devel] " Simmons, James A.
2016-01-05 15:43 ` Simmons, James A.
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.