[Crash-utility] [RFC][PATCH]: crash aborts with cannot determine idle task

Dave Anderson anderson at redhat.com
Mon Jun 15 12:18:43 UTC 2009


----- "Chandru" <chandru at in.ibm.com> wrote:

> On Friday 12 June 2009 18:06:38 Dave Anderson wrote:
> > 
> > Yes they will -- I just wanted your sign-off before I checked them in.
> 
> Hello Dave,
> thanks, here sending the patch again. thanks!
> 
> kdump installs NT_PRSTATUS notes into vmcore file only to the cpus that were
> online at the time of crash. In such cases, while reading in the notes from the
> dump file, we are unsure of the cpu to NT_PRSTATUS  mapping. The cpu
> possible, present and online map is not available until cpu_maps_init() initializes
> them. Hence we remap the prstatus pointer array to online cpus  before making
> any reference to the prstatus information.

Queued for the next release.

Thanks,
  Dave


> 
> 
> Signed-off-by: Chandru Siddalingappa <chandru at linux.vnet.ibm.com>
> Signed-off-by: Dave Anderson <anderson at redhat.com>
> Reviewed-by: Dave Anderson <anderson at redhat.com>
> Cc: Haren Myneni <haren at us.ibm.com>
> ---
> 
> --- crash-4.0-8.10/ppc64.c.orig	2009-06-15 11:47:35.000000000 +0530
> +++ crash-4.0-8.10/ppc64.c	2009-06-15 11:59:27.000000000 +0530
> @@ -2407,13 +2407,16 @@ ppc64_paca_init(void)
>  	if (!symbol_exists("paca"))
>  		error(FATAL, "PPC64: Could not find 'paca' symbol\n");
>  
> -	if (cpu_map_addr("present"))
> +	if (cpu_map_addr("possible"))
> +		map = POSSIBLE;
> +	else if (cpu_map_addr("present"))
>  		map = PRESENT;
>  	else if (cpu_map_addr("online"))
>  		map = ONLINE;
>  	else
>  		error(FATAL, 
> -		    "PPC64: cannot find 'cpu_present_map' or 'cpu_online_map'
> symbols\n");
> +		    "PPC64: cannot find 'cpu_possible_map' or 'cpu_present_map'\
> +			or 'cpu_online_map' symbols\n");
>  
>  	if (!MEMBER_EXISTS("paca_struct", "data_offset"))
>  		return;
> @@ -2424,7 +2427,7 @@ ppc64_paca_init(void)
>  	cpu_paca_buf = GETBUF(SIZE(ppc64_paca));
>  
>  	if (!(nr_paca = get_array_length("paca", NULL, 0))) 
> -		nr_paca = NR_CPUS;
> +		nr_paca = (kt->kernel_NR_CPUS ? kt->kernel_NR_CPUS : NR_CPUS);
>  
>  	if (nr_paca > NR_CPUS) {
>  		error(WARNING, 
> @@ -2435,7 +2438,7 @@ ppc64_paca_init(void)
>  	
>  	for (i = cpus = 0; i < nr_paca; i++) {
>  		/*
> -		 * CPU present (or online)?
> +		 * CPU present or online or can exist in the system(possible)?
>  		 */
>  		if (!in_cpu_map(map, i))
>  			continue;
> --- crash-4.0-8.10/task.c.orig	2009-06-15 11:47:29.000000000 +0530
> +++ crash-4.0-8.10/task.c	2009-06-15 11:53:48.000000000 +0530
> @@ -452,6 +452,8 @@ task_init(void)
>  		tt->this_task = pid_to_task(active_pid);
>  	}
>  	else {
> +		if (KDUMP_DUMPFILE())
> +			map_cpus_to_prstatus();
>  		please_wait("determining panic task");
>  		set_context(get_panic_context(), NO_PID);
>  		please_wait_done();
> --- crash-4.0-8.10/netdump.c.orig	2009-06-15 11:47:25.000000000 +0530
> +++ crash-4.0-8.10/netdump.c	2009-06-15 12:03:00.000000000 +0530
> @@ -45,6 +45,44 @@ static void check_dumpfile_size(char *);
>  	(machine_type("IA64") || machine_type("PPC64"))
>  
>  /*
> + * kdump installs NT_PRSTATUS elf notes only to the cpus
> + * that were online during dumping. Hence we call into this
> + * function to remap the NT_PRSTATUS notes only to the online cpus
> + */
> +void
> +map_cpus_to_prstatus(void)
> +{
> +	void **nt_ptr;
> +	int online, i, j, nrcpus;
> +	size_t size;
> +
> +	if (!(online = get_cpus_online()) || (online == kt->cpus))
> +		return;
> +
> +	if (CRASHDEBUG(1))
> +		error(INFO,
> +		    "cpus: %d online: %d NT_PRSTATUS notes: %d (remapping)\n",
> +			kt->cpus, online, nd->num_prstatus_notes);
> +
> +	size = NR_CPUS * sizeof(void *);
> +
> +	nt_ptr = (void **)GETBUF(size);
> +	BCOPY(nd->nt_prstatus_percpu, nt_ptr, size);
> +	BZERO(nd->nt_prstatus_percpu, size);
> +
> +	/*
> +	 *  Re-populate the array with the notes mapping to online cpus
> +	 */
> +	nrcpus = (kt->kernel_NR_CPUS ? kt->kernel_NR_CPUS : NR_CPUS);
> +
> +	for (i = 0, j = 0; i < nrcpus; i++) {
> +		if (in_cpu_map(ONLINE, i))
> +			nd->nt_prstatus_percpu[i] = nt_ptr[j++];
> +	}
> +
> +	FREEBUF(nt_ptr);
> +}
> +/*
>   *  Determine whether a file is a netdump/diskdump/kdump creation, 
>   *  and if TRUE, initialize the vmcore_data structure.
>   */
> @@ -618,7 +656,7 @@ get_netdump_panic_task(void)
>  		crashing_cpu = -1;
>  		if (kernel_symbol_exists("crashing_cpu")) {
>  			get_symbol_data("crashing_cpu", sizeof(int), &i);
> -			if ((i >= 0) && (i < nd->num_prstatus_notes)) {
> +			if ((i >= 0) && in_cpu_map(ONLINE, i)) {
>  				crashing_cpu = i;
>  				if (CRASHDEBUG(1))
>  					error(INFO, 
> @@ -2236,7 +2274,7 @@ get_netdump_regs_ppc64(struct bt_info *b
>  		 * CPUs if they responded to an IPI.
>  		 */
>                  if (nd->num_prstatus_notes > 1) {
> -			if (bt->tc->processor >= nd->num_prstatus_notes)
> +			if (!nd->nt_prstatus_percpu[bt->tc->processor])
>  				error(FATAL, 
>  		          	    "cannot determine NT_PRSTATUS ELF note "
>  				    "for %s task: %lx\n",




More information about the Crash-utility mailing list