[Crash-utility] Question about ARM module address range

Dave Anderson anderson at redhat.com
Thu Jul 19 14:05:28 UTC 2012


Hi guys,
     
While looking at the ARM per-cpu address range issue, I ran into
something re: the ARM module address range values that has me
confused.

In arm_init(), POST_VM, you've got:
  
              machdep->machspec->modules_end = machdep->kvbase - 1;
  
But it never gets used, because here in arm_is_module_addr() the
local variable "module_end" is used instead -- although it is set 
to the same value:
  
  static int
  arm_is_module_addr(ulong vaddr)
  {
          ulong modules_start;
          ulong modules_end = machdep->kvbase - 1;
  
          if (!MODULES_VADDR) {
                  /*
                   * In case we are still initializing, and vm_init() has not been
                   * called, we use defaults here which is 16MB below kernel start
                   * address.
                   */
                  modules_start = machdep->kvbase - 16 * 1024 * 1024;
          } else {
                  modules_start = MODULES_VADDR;
          }
  
          return (vaddr >= modules_start && vaddr <= modules_end);
  }

and where MODULES_VADDR is #define'd as:
  
  #define MODULES_VADDR (machdep->machspec->modules_vaddr)
  
So given that "modules_end" is set to "machdep->kvbase - 1", and given the
output from "help -m" on the 3 sample ARM dumps I have:
  
2.6.35:

  crash> help -m
  ...  
               kvbase: c0000000
  ... 
   vmalloc_start_addr: d0000000
        modules_vaddr: d0807000
          modules_end: bfffffff
    kernel_text_start: c0008000
  ...
  
2.6.36:
  
  crash> help -m
  ...
               kvbase: c0000000
  ...
   vmalloc_start_addr: c5800000
        modules_vaddr: c6024000
          modules_end: bfffffff
    kernel_text_start: c0008000
  
2.6.38:

  crash> help -m
  ... 
               kvbase: c0000000
  ...    
   vmalloc_start_addr: d0000000
        modules_vaddr: d0807000
          modules_end: bfffffff
    kernel_text_start: c0008000
  ...

So given that "modules_end" is always below the kvbase (bfffffff),
then arm_is_module_addr() will always return FALSE -- except maybe
during pre-vm_init() time when the range is temporarily set to
be the "default range" between bf000000 and bfffffff.  (and would
there *ever* be a module in that range?)

Anyway, although I don't think it's a problem, given that the 
only caller of arm_is_module_addr() is arm_is_vmalloc_addr(), 
and that function will fall through and still return TRUE if 
it is a module address.

But it just looks strange, and at least it would seem that:

 (1) the machdep->machspec->modules_end version should be used, and
 (2) it should be updated post-vm_init() so that the arm_is_module_addr()
     function actually works?

Or am I missing something?

Dave




More information about the Crash-utility mailing list