[Crash-utility] per_cpu__xxxxx

olivier.daudel at u-paris10.fr olivier.daudel at u-paris10.fr
Tue Aug 22 20:06:08 UTC 2006


Hi Dave,
In reading your reply arroud per_cpu__xxxxx, i have understood my mistake.
For a new bee ... i think we could add someting like this in your help.
=====================================================

Spetial mention arround per_cpu__xxxx (with Intel only ?) in SMP context.

First step : you have to find __per_cpu_offset
crash> __per_cpu_offset
__per_cpu_offset = $1 =
{25182048, 25214816, 25247584, 25280352, 25313120, 25345888, 25378656,
  25411424, 25444192, 25476960, 25509728, 25542496, 25575264, 25608032,
  25640800, 25673568, 25706336, 25739104, 25771872, 25804640, 25837408,
  25870176, 25902944, 25935712, 25968480, 26001248, 26034016, 26066784,
  26099552, 26132320, 26165088, 26197856}

Second setp : use whatis, struct and sym with your per_cpu__xxxxx
crash> whatis per_cpu__irq_stat
irq_cpustat_t per_cpu__irq_stat;
crash> irq_cpustat_t -o
No struct type named irq_cpustat_t.
struct {
    [0] unsigned int __softirq_pending;
    [4] long unsigned int idle_timestamp;
    [8] unsigned int __nmi_count;
   [12] unsigned int apic_timer_irqs;
}
SIZE: 128
crash> sym per_cpu__irq_stat
c0407380 (D) per_cpu__irq_stat

Third step : use eval to determine the correct address
crash> eval c0407380 + 25214816
hexadecimal: c1c132e0
[...]

(one day, i shall try to do a small patch with options -h, -d, -o and 
-2 (-b better, but already used) to select the proper choice when we 
want to !!!)

Last step : you may now access to the per_cpu__xxxxx of second CPU
crash> rd -d c1c132e0 4
c1c132e0:             0     16918620            0     17218691

A nicer example, with a well defined structure :

crash> sym per_cpu__kstat
c0408be0 (D) per_cpu__kstat
crash> whatis per_cpu__kstat
struct kernel_stat per_cpu__kstat;
crash> eval c0408be0 + 25214816
hexadecimal: c1c14b40
[...]
crash> kernel_stat c1c14b40
struct kernel_stat {
  cpustat = {
    user = 535936,
    nice = 3864001,
    system = 33693,
    softirq = 289,
    irq = 526,
    idle = 12992235,
    iowait = 23818,
    steal = 0
  },
  irqs = {8702265, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77403, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    4788, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    18433, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
}



----------------------------------------------------------------
Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre




----- Fin du message transféré -----


----------------------------------------------------------------
Ce message a ete envoye par IMP, grace a l'Universite Paris 10 Nanterre







More information about the Crash-utility mailing list