[Crash-utility] [PATCH] Fix x86 initialization for {hard, soft}irq_ctx

Dave Anderson anderson at redhat.com
Thu Feb 9 18:21:21 UTC 2017



----- Original Message -----
> Dave Anderson <anderson at redhat.com> writes:
> 
> > Hi Ogawa,
> 
> Hi,
> 
> > Please review the attached update to your patch, which adds support for
> > the irq_ctx-to-irq_stack transition.
> > -	if ((hard_sp = per_cpu_symbol_search("per_cpu__hardirq_ctx"))) {
> > +	if ((hard_sp = per_cpu_symbol_search("per_cpu__hardirq_ctx")) ||
> > +	    (hard_sp = per_cpu_symbol_search("per_cpu__hardirq_stack"))) {
> >  		if ((kt->flags & SMP) && (kt->flags & PER_CPU_OFF)) {
> >  			for (i = 0; i < NR_CPUS; i++) {
> > +				ulong ptr;
> > +
> 
> [...]
> 
> Right, this will work, maybe, several stuffs. However hardirq_tasks[] is
> missing, so this will not be fully. For now, I don't have dump of other
> than v4.9 (stack format was changed), so I'm not sure which commands are
> not working (user of hardirq_tasks[]).

I haven't looked at the recent kernel to check out how the linkage is done
without the temporary thread_info at the bottom of the hard/soft irq stacks,
but looking at a live 4.9 system, it looks like the first word at the base of 
the hard and soft irq stack now contains a pointer into the stack of the
last caller?  If that's true, then stkptr_to_task() could be used to 
populate the hardirq_tasks[] and softirq_tasks[] -- but the initialization
would have to be delayed until near the end of task_init().

Dave

  
> 
> Thanks.
> 
> > +	if (MEMBER_EXISTS("irq_ctx", "tinfo")) {
> > +		for (i = 0; i < NR_CPUS; i++) {
> > +			if (!(tt->hardirq_ctx[i]))
> > +				continue;
> >  
> > -                if (!readmem(tt->hardirq_ctx[i], KVADDR, thread_info_buf,
> > -		    SIZE(irq_ctx), "hardirq thread_union",
> > -		    RETURN_ON_ERROR)) {
> > -                	error(INFO, "cannot read hardirq_ctx[%d] at %lx\n",
> > -                            	i, tt->hardirq_ctx[i]);
> > -                        continue;
> > -                }
> > +			if (!readmem(tt->hardirq_ctx[i], KVADDR, thread_info_buf,
> > +			    SIZE(irq_ctx), "hardirq thread_union",
> > +			    RETURN_ON_ERROR)) {
> > +				error(INFO, "cannot read hardirq_ctx[%d] at %lx\n",
> > +					i, tt->hardirq_ctx[i]);
> > +				continue;
> > +			}
> >  
> > -                tt->hardirq_tasks[i] =
> > -			ULONG(thread_info_buf+OFFSET(thread_info_task));
> > +			tt->hardirq_tasks[i] =
> > +				ULONG(thread_info_buf+OFFSET(thread_info_task));
> > +		}
> >  	}
> 
> --
> OGAWA Hirofumi <hirofumi at mail.parknet.co.jp>
> 




More information about the Crash-utility mailing list