All of lore.kernel.org
 help / color / mirror / Atom feed
* Memory limits - mm_segment_t - MAKE_MM_SEG
@ 2009-04-29 13:54 Michal Simek
  2009-04-29 14:03 ` Michal Simek
  2009-04-30 13:50 ` Arnd Bergmann
  0 siblings, 2 replies; 4+ messages in thread
From: Michal Simek @ 2009-04-29 13:54 UTC (permalink / raw)
  To: Arnd Bergmann, John Williams, Andrew Morton, Linux Kernel list,
	Ingo Molnar

Hi all,

I look at some things which I need to clear for MMU Microblaze patches and
I would like to know your opinion about.

First of all I found that almost all archs use MAKE_MM_SEG macro which should be good
to move to generic location (asm-generic/uaccess.h ? )
#define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })


The second thing is about place where is stored limit for processes -> mm_segment_t structure

Where is the proper location for storing mm_segment_t? Some arch use thread_info some of them
thread_struct

For microblaze case are used both -> that's definitely not correct.

Here is the small table for cpus which are in linux kernel and location and type for them.
The most of them uses thread_info structure for it and name is addr_limit.
The location of mm_segment_t is different too -> we should move it to any generic location too.
What do you think?

        location                     name           location      struct mm_segment_t
s390:   processor.h/thread_struct    mm_segment     processor.h   __u32 ar4
alpha:  thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
x86:    thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
ia64:   thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
mips:   thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
um:     thread_info.h/thread_info    addr_limit     uaccess.h    unsigned long seg
frv:    thread_info.h/thread_info    addr_limit     segment.h    unsigned long seg
cris:   thread_info.h/thread_info    addr_limit     segment.h    unsigned long seg
sh:     thread_info.h/thread_info    addr_limit     segment.h    unsigned long seg
h8300:  not_used     not_used                       segment.h    unsigned long seg
nm10300:thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
arm:    thread_info.h/thread_info    addr_limit     thread_info.h  typedef unsigned long mm_segment_t;
parisc: thread_info.h/thread_info    addr_limit     processor.h  int seq
m32r:   thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
xtensa: thread_info.h/thread_info    addr_limit     segment.h    unsigned long seg
avr32:  not_used     not_used                       uaccess.h    unsigned int is_user_space;
sparc:  processor_32.h/thread_struct  current_ds    processor_32.h  int seg
m68k:   not_used     not_used                       segment.h    unsigned long seg
blackfin:thread_info.h/thread_info    addr_limit    thread_info.h  typedef unsigned long mm_segment_t;
powerpc: processor.h/thread_struct  current_ds     processor.h  unsigned long seg


There is really mess in it and I would like to have good solution for Microblaze and I think
that will be good to have any generic solution and remove code duplication.

Thanks for your comments,
Michal


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854

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

* Re: Memory limits - mm_segment_t - MAKE_MM_SEG
  2009-04-29 13:54 Memory limits - mm_segment_t - MAKE_MM_SEG Michal Simek
@ 2009-04-29 14:03 ` Michal Simek
  2009-04-30 13:50 ` Arnd Bergmann
  1 sibling, 0 replies; 4+ messages in thread
From: Michal Simek @ 2009-04-29 14:03 UTC (permalink / raw)
  To: monstr
  Cc: Arnd Bergmann, John Williams, Andrew Morton, Linux Kernel list,
	Ingo Molnar

Michal Simek wrote:
> Hi all,
>
> I look at some things which I need to clear for MMU Microblaze patches and
> I would like to know your opinion about.
>
> First of all I found that almost all archs use MAKE_MM_SEG macro which should be good
> to move to generic location (asm-generic/uaccess.h ? )
> #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
>
>
> The second thing is about place where is stored limit for processes -> mm_segment_t structure
>
> Where is the proper location for storing mm_segment_t? Some arch use thread_info some of them
> thread_struct
>
> For microblaze case are used both -> that's definitely not correct.
>
> Here is the small table for cpus which are in linux kernel and location and type for them.
> The most of them uses thread_info structure for it and name is addr_limit.
> The location of mm_segment_t is different too -> we should move it to any generic location too.
> What do you think?
>
>         location                     name           location      struct mm_segment_t
> s390:   processor.h/thread_struct    mm_segment     processor.h   __u32 ar4
> alpha:  thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
> x86:    thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
> ia64:   thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
> mips:   thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
> um:     thread_info.h/thread_info    addr_limit     uaccess.h    unsigned long seg
> frv:    thread_info.h/thread_info    addr_limit     segment.h    unsigned long seg
> cris:   thread_info.h/thread_info    addr_limit     segment.h    unsigned long seg
> sh:     thread_info.h/thread_info    addr_limit     segment.h    unsigned long seg
> h8300:  not_used     not_used                       segment.h    unsigned long seg
> nm10300:thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
> arm:    thread_info.h/thread_info    addr_limit     thread_info.h  typedef unsigned long mm_segment_t;
> parisc: thread_info.h/thread_info    addr_limit     processor.h  int seq
> m32r:   thread_info.h/thread_info    addr_limit     processor.h  unsigned long seg
> xtensa: thread_info.h/thread_info    addr_limit     segment.h    unsigned long seg
> avr32:  not_used     not_used                       uaccess.h    unsigned int is_user_space;
> sparc:  processor_32.h/thread_struct  current_ds    processor_32.h  int seg
> m68k:   not_used     not_used                       segment.h    unsigned long seg
> blackfin:thread_info.h/thread_info    addr_limit    thread_info.h  typedef unsigned long mm_segment_t;
> powerpc: processor.h/thread_struct  current_ds     processor.h  unsigned long seg
>
>
> There is really mess in it and I would like to have good solution for Microblaze and I think
> that will be good to have any generic solution and remove code duplication.
>
> Thanks for your comments,
> Michal
>
>   
+ move some macros to generic location too.
#define get_ds()      (KERNEL_DS)

+ get_fs(), set_fs(), segment_eq() after sync changes above

Michal





-- 
Michal Simek, Ing. (M.Eng)
PetaLogix - Linux Solutions for a Reconfigurable World
w: www.petalogix.com p: +61-7-30090663,+42-0-721842854 f: +61-7-30090663


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

* Re: Memory limits - mm_segment_t - MAKE_MM_SEG
  2009-04-29 13:54 Memory limits - mm_segment_t - MAKE_MM_SEG Michal Simek
  2009-04-29 14:03 ` Michal Simek
@ 2009-04-30 13:50 ` Arnd Bergmann
  2009-04-30 14:28   ` Michal Simek
  1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2009-04-30 13:50 UTC (permalink / raw)
  To: monstr; +Cc: John Williams, Andrew Morton, Linux Kernel list, Ingo Molnar

On Wednesday 29 April 2009, Michal Simek wrote:
> I look at some things which I need to clear for MMU Microblaze patches and
> I would like to know your opinion about.
> 
> First of all I found that almost all archs use MAKE_MM_SEG macro which 
> should be good to move to generic location (asm-generic/uaccess.h ? )
> #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })

I have a generic uaccess.h queued up, which I'm planning to submit for
2.6.30 that includes this. 

> The second thing is about place where is stored limit for processes -> mm_segment_t structure
> 
> Where is the proper location for storing mm_segment_t? Some arch use
> thread_info some of them thread_struct

The method that is used here is different on some architectures.
Most of them use the address limit, which is a property of the
thread, and sensibly belongs into the thread_info. s390 and possibly
others have separate address spaces for user access and use a CPU
feature for this, which belongs into thread_struct.

> Here is the small table for cpus which are in linux kernel and location and type for them.
> The most of them uses thread_info structure for it and name is addr_limit.
> The location of mm_segment_t is different too -> we should move it to any generic location too.
> What do you think?

Sounds fair to me. I think uaccess.h is the best place for this, or maybe
a new mm_segment.h, but not segment.h which is used traditionally for
real segments on x86.

	Arnd <><

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

* Re: Memory limits - mm_segment_t - MAKE_MM_SEG
  2009-04-30 13:50 ` Arnd Bergmann
@ 2009-04-30 14:28   ` Michal Simek
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2009-04-30 14:28 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: John Williams, Andrew Morton, Linux Kernel list, Ingo Molnar

Arnd Bergmann wrote:
> On Wednesday 29 April 2009, Michal Simek wrote:
>> I look at some things which I need to clear for MMU Microblaze patches and
>> I would like to know your opinion about.
>>
>> First of all I found that almost all archs use MAKE_MM_SEG macro which 
>> should be good to move to generic location (asm-generic/uaccess.h ? )
>> #define MAKE_MM_SEG(s) ((mm_segment_t) { (s) })
> 
> I have a generic uaccess.h queued up, which I'm planning to submit for
> 2.6.30 that includes this. 

Please CC me for this patch. Thanks.

> 
>> The second thing is about place where is stored limit for processes -> mm_segment_t structure
>>
>> Where is the proper location for storing mm_segment_t? Some arch use
>> thread_info some of them thread_struct
> 
> The method that is used here is different on some architectures.
> Most of them use the address limit, which is a property of the
> thread, and sensibly belongs into the thread_info. s390 and possibly
> others have separate address spaces for user access and use a CPU
> feature for this, which belongs into thread_struct.

Great. I'll use only thread_info structure.

> 
>> Here is the small table for cpus which are in linux kernel and location and type for them.
>> The most of them uses thread_info structure for it and name is addr_limit.
>> The location of mm_segment_t is different too -> we should move it to any generic location too.
>> What do you think?
> 
> Sounds fair to me. I think uaccess.h is the best place for this, or maybe
> a new mm_segment.h, but not segment.h which is used traditionally for
> real segments on x86.

OK. I'll move all things from segment.h to uaccess.h in my next branch.

Michal

> 
> 	Arnd <><


-- 
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854

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

end of thread, other threads:[~2009-04-30 14:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-29 13:54 Memory limits - mm_segment_t - MAKE_MM_SEG Michal Simek
2009-04-29 14:03 ` Michal Simek
2009-04-30 13:50 ` Arnd Bergmann
2009-04-30 14:28   ` Michal Simek

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.