linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [mmotm:master 371/385] arch/x86/mm/mpx.c:71:54: sparse: implicit cast to nocast type
@ 2015-07-24  8:18 kbuild test robot
  2015-07-24 10:09 ` vm_flags, vm_flags_t and __nocast Kirill A. Shutemov
  0 siblings, 1 reply; 6+ messages in thread
From: kbuild test robot @ 2015-07-24  8:18 UTC (permalink / raw)
  To: Oleg Nesterov
  Cc: kbuild-all, Johannes Weiner, Kirill A. Shutemov, Andrew Morton,
	Linux Memory Management List

tree:   git://git.cmpxchg.org/linux-mmotm.git master
head:   61f5f835b6f06fbc233481b5d3c0afd71ecf54e8
commit: b9e95c5dd1134d35b6c9aeaa3967ab5b3945ba73 [371/385] mm, mpx: add "vm_flags_t vm_flags" arg to do_mmap_pgoff()
reproduce:
  # apt-get install sparse
  git checkout b9e95c5dd1134d35b6c9aeaa3967ab5b3945ba73
  make ARCH=x86_64 allmodconfig
  make C=1 CF=-D__CHECK_ENDIAN__


sparse warnings: (new ones prefixed by >>)

>> arch/x86/mm/mpx.c:71:54: sparse: implicit cast to nocast type
   arch/x86/mm/mpx.c:312:27: sparse: incompatible types in comparison expression (different address spaces)
--
>> include/linux/mm.h:1812:54: sparse: implicit cast to nocast type
--
   mm/mmap.c:1343:47: sparse: implicit cast to nocast type
   mm/mmap.c:1345:45: sparse: implicit cast to nocast type
   mm/mmap.c:1354:45: sparse: implicit cast to nocast type
   mm/mmap.c:1375:47: sparse: implicit cast to nocast type
   mm/mmap.c:1395:37: sparse: implicit cast to nocast type
   mm/mmap.c:1399:37: sparse: implicit cast to nocast type
   mm/mmap.c:1443:33: sparse: implicit cast to nocast type
   mm/mmap.c:1578:29: sparse: implicit cast to nocast type
   mm/internal.h:253:43: sparse: implicit cast to nocast type
   mm/mmap.c:2650:37: sparse: implicit cast to nocast type
   mm/mmap.c:2690:34: sparse: implicit cast to nocast type
   mm/mmap.c:2693:34: sparse: implicit cast to nocast type
>> include/linux/mm.h:1812:54: sparse: implicit cast to nocast type
   mm/internal.h:253:43: sparse: implicit cast to nocast type

vim +71 arch/x86/mm/mpx.c

    55	 * bounds tables (the bounds directory is user-allocated).
    56	 *
    57	 * Later on, we use the vma->vm_ops to uniquely identify these
    58	 * VMAs.
    59	 */
    60	static unsigned long mpx_mmap(unsigned long len)
    61	{
    62		struct mm_struct *mm = current->mm;
    63		unsigned long addr, populate;
    64	
    65		/* Only bounds table can be allocated here */
    66		if (len != mpx_bt_size_bytes(mm))
    67			return -EINVAL;
    68	
    69		down_write(&mm->mmap_sem);
    70		addr = do_mmap(NULL, 0, len, PROT_READ | PROT_WRITE,
  > 71				MAP_ANONYMOUS | MAP_PRIVATE, VM_MPX, 0, &populate);
    72		up_write(&mm->mmap_sem);
    73		if (populate)
    74			mm_populate(addr, populate);
    75	
    76		return addr;
    77	}
    78	
    79	enum reg_type {

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* vm_flags, vm_flags_t and __nocast
  2015-07-24  8:18 [mmotm:master 371/385] arch/x86/mm/mpx.c:71:54: sparse: implicit cast to nocast type kbuild test robot
@ 2015-07-24 10:09 ` Kirill A. Shutemov
  2015-07-24 20:15   ` David Rientjes
  0 siblings, 1 reply; 6+ messages in thread
From: Kirill A. Shutemov @ 2015-07-24 10:09 UTC (permalink / raw)
  To: Andrew Morton, Linus Torvalds
  Cc: kbuild test robot, Oleg Nesterov, kbuild-all, Johannes Weiner,
	Kirill A. Shutemov, Linux Memory Management List

On Fri, Jul 24, 2015 at 04:18:30PM +0800, kbuild test robot wrote:
> tree:   git://git.cmpxchg.org/linux-mmotm.git master
> head:   61f5f835b6f06fbc233481b5d3c0afd71ecf54e8
> commit: b9e95c5dd1134d35b6c9aeaa3967ab5b3945ba73 [371/385] mm, mpx: add "vm_flags_t vm_flags" arg to do_mmap_pgoff()
> reproduce:
>   # apt-get install sparse
>   git checkout b9e95c5dd1134d35b6c9aeaa3967ab5b3945ba73
>   make ARCH=x86_64 allmodconfig
>   make C=1 CF=-D__CHECK_ENDIAN__
> 
> 
> sparse warnings: (new ones prefixed by >>)
> 
> >> arch/x86/mm/mpx.c:71:54: sparse: implicit cast to nocast type
>    arch/x86/mm/mpx.c:312:27: sparse: incompatible types in comparison expression (different address spaces)
> --
> >> include/linux/mm.h:1812:54: sparse: implicit cast to nocast type
> --
>    mm/mmap.c:1343:47: sparse: implicit cast to nocast type
>    mm/mmap.c:1345:45: sparse: implicit cast to nocast type
>    mm/mmap.c:1354:45: sparse: implicit cast to nocast type
>    mm/mmap.c:1375:47: sparse: implicit cast to nocast type
>    mm/mmap.c:1395:37: sparse: implicit cast to nocast type
>    mm/mmap.c:1399:37: sparse: implicit cast to nocast type
>    mm/mmap.c:1443:33: sparse: implicit cast to nocast type
>    mm/mmap.c:1578:29: sparse: implicit cast to nocast type
>    mm/internal.h:253:43: sparse: implicit cast to nocast type
>    mm/mmap.c:2650:37: sparse: implicit cast to nocast type
>    mm/mmap.c:2690:34: sparse: implicit cast to nocast type
>    mm/mmap.c:2693:34: sparse: implicit cast to nocast type
> >> include/linux/mm.h:1812:54: sparse: implicit cast to nocast type
>    mm/internal.h:253:43: sparse: implicit cast to nocast type

sparse complains on each and every vm_flags_t initialization, even with
proper VM_* constants.

Do we really want to fix that?

To me it's too much pain and no gain. __nocast is not beneficial here.

And I'm not sure that vm_flags_t typedef was a good idea after all.
Originally, it was intended to become 64-bit one day, but four years later
it's still unsigned long. Plain unsigned long works fine for other bit
field.

What is special about vm_flags?

> vim +71 arch/x86/mm/mpx.c
> 
>     55	 * bounds tables (the bounds directory is user-allocated).
>     56	 *
>     57	 * Later on, we use the vma->vm_ops to uniquely identify these
>     58	 * VMAs.
>     59	 */
>     60	static unsigned long mpx_mmap(unsigned long len)
>     61	{
>     62		struct mm_struct *mm = current->mm;
>     63		unsigned long addr, populate;
>     64	
>     65		/* Only bounds table can be allocated here */
>     66		if (len != mpx_bt_size_bytes(mm))
>     67			return -EINVAL;
>     68	
>     69		down_write(&mm->mmap_sem);
>     70		addr = do_mmap(NULL, 0, len, PROT_READ | PROT_WRITE,
>   > 71				MAP_ANONYMOUS | MAP_PRIVATE, VM_MPX, 0, &populate);
>     72		up_write(&mm->mmap_sem);
>     73		if (populate)
>     74			mm_populate(addr, populate);
>     75	
>     76		return addr;
>     77	}
>     78	
>     79	enum reg_type {
> 
> ---
> 0-DAY kernel test infrastructure                Open Source Technology Center
> https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: vm_flags, vm_flags_t and __nocast
  2015-07-24 10:09 ` vm_flags, vm_flags_t and __nocast Kirill A. Shutemov
@ 2015-07-24 20:15   ` David Rientjes
  2015-08-03 15:51     ` Kirill A. Shutemov
  0 siblings, 1 reply; 6+ messages in thread
From: David Rientjes @ 2015-07-24 20:15 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Andrew Morton, Linus Torvalds, kbuild test robot, Oleg Nesterov,
	kbuild-all, Johannes Weiner, Kirill A. Shutemov,
	Linux Memory Management List

On Fri, 24 Jul 2015, Kirill A. Shutemov wrote:

> sparse complains on each and every vm_flags_t initialization, even with
> proper VM_* constants.
> 
> Do we really want to fix that?
> 
> To me it's too much pain and no gain. __nocast is not beneficial here.
> 
> And I'm not sure that vm_flags_t typedef was a good idea after all.
> Originally, it was intended to become 64-bit one day, but four years later
> it's still unsigned long. Plain unsigned long works fine for other bit
> field.
> 
> What is special about vm_flags?
> 

Maybe remove the __nocast until it's a different type?  Seems like all 
these sites would have to be audited when that happens anyway.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: vm_flags, vm_flags_t and __nocast
  2015-07-24 20:15   ` David Rientjes
@ 2015-08-03 15:51     ` Kirill A. Shutemov
  2015-08-03 17:33       ` Oleg Nesterov
  2015-08-06  2:07       ` David Rientjes
  0 siblings, 2 replies; 6+ messages in thread
From: Kirill A. Shutemov @ 2015-08-03 15:51 UTC (permalink / raw)
  To: David Rientjes
  Cc: Kirill A. Shutemov, Andrew Morton, Linus Torvalds,
	kbuild test robot, Oleg Nesterov, kbuild-all, Johannes Weiner,
	Kirill A. Shutemov, Linux Memory Management List

David Rientjes wrote:
> On Fri, 24 Jul 2015, Kirill A. Shutemov wrote:
> 
> > sparse complains on each and every vm_flags_t initialization, even with
> > proper VM_* constants.
> > 
> > Do we really want to fix that?
> > 
> > To me it's too much pain and no gain. __nocast is not beneficial here.
> > 
> > And I'm not sure that vm_flags_t typedef was a good idea after all.
> > Originally, it was intended to become 64-bit one day, but four years later
> > it's still unsigned long. Plain unsigned long works fine for other bit
> > field.
> > 
> > What is special about vm_flags?
> > 
> 
> Maybe remove the __nocast until it's a different type?  Seems like all 
> these sites would have to be audited when that happens anyway.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: vm_flags, vm_flags_t and __nocast
  2015-08-03 15:51     ` Kirill A. Shutemov
@ 2015-08-03 17:33       ` Oleg Nesterov
  2015-08-06  2:07       ` David Rientjes
  1 sibling, 0 replies; 6+ messages in thread
From: Oleg Nesterov @ 2015-08-03 17:33 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: David Rientjes, Kirill A. Shutemov, Andrew Morton, Linus Torvalds,
	kbuild test robot, kbuild-all, Johannes Weiner,
	Linux Memory Management List

On 08/03, Kirill A. Shutemov wrote:
>
> Subject: [PATCH] mm: drop __nocast from vm_flags_t definition
>
> __nocast does no good for vm_flags_t. It only produces useless sparse
> warnings.
>
> Let's drop it.

Personally I like this change.

I too see no value in this "__nocast".

> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---
>  include/linux/mm_types.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> index 1fb4e46a1736..b9134cc27c4d 100644
> --- a/include/linux/mm_types.h
> +++ b/include/linux/mm_types.h
> @@ -226,7 +226,7 @@ struct page_frag {
>  #endif
>  };
>  
> -typedef unsigned long __nocast vm_flags_t;
> +typedef unsigned long vm_flags_t;
>  
>  /*
>   * A region containing a mapping of a non-memory backed file under NOMMU
> -- 
> 2.4.6

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: vm_flags, vm_flags_t and __nocast
  2015-08-03 15:51     ` Kirill A. Shutemov
  2015-08-03 17:33       ` Oleg Nesterov
@ 2015-08-06  2:07       ` David Rientjes
  1 sibling, 0 replies; 6+ messages in thread
From: David Rientjes @ 2015-08-06  2:07 UTC (permalink / raw)
  To: Kirill A. Shutemov
  Cc: Kirill A. Shutemov, Andrew Morton, Linus Torvalds,
	kbuild test robot, Oleg Nesterov, kbuild-all, Johannes Weiner,
	Linux Memory Management List

On Mon, 3 Aug 2015, Kirill A. Shutemov wrote:

> From f690ec43103e55d0ed533fc977f9ac3cfa29d8f6 Mon Sep 17 00:00:00 2001
> From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
> Date: Mon, 3 Aug 2015 18:49:18 +0300
> Subject: [PATCH] mm: drop __nocast from vm_flags_t definition
> 
> __nocast does no good for vm_flags_t. It only produces useless sparse
> warnings.
> 
> Let's drop it.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>

Acked-by: David Rientjes <rientjes@google.com>

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-06  2:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-24  8:18 [mmotm:master 371/385] arch/x86/mm/mpx.c:71:54: sparse: implicit cast to nocast type kbuild test robot
2015-07-24 10:09 ` vm_flags, vm_flags_t and __nocast Kirill A. Shutemov
2015-07-24 20:15   ` David Rientjes
2015-08-03 15:51     ` Kirill A. Shutemov
2015-08-03 17:33       ` Oleg Nesterov
2015-08-06  2:07       ` David Rientjes

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).