hey cathy,

i ended up filing the following bugs on this issue:
6668816 find_child_by_addr() causes ddi_hold_devi_by_instance() to return the 
wrong dip
6668833 xvm 3.1 changes rtls subsystem ids, breaks existing HVM domUs

thanks for helping me out with the analysis.
ed

On Wed, Feb 27, 2008 at 06:56:06PM +0800, Cathy Zhou wrote:
> 
> >>I had another look. Ed said that the rtls device used to be rtls0 and now
> >>it is changed to rtls1. Therefore, the rtls1 in the softmac_hash is
> >>expected.
> >>
> >>Then the question becomes, why the following check in 
> >>softmac_hold_device()
> >>succeeded?
> >>
> >>    if ((dip = ddi_hold_devi_by_instance(getmajor(dev), ppa, 0)) == NULL)
> >>            return (ENOENT);
> >>
> >
> >a fine question!  but it's one that i am not going to be able to answer
> >before going to bed.  ;)
> >
> Using mdb, I found the dip returned by the above call is indeed the dip of 
> rtls1:
> 
> [0]> d31e8e28::print struct dev_info devi_binding_name devi_instance 
> devi_ops
> devi_binding_name = 0xd31edcfd "pci10ec,8139"
> devi_instance = 0x1
> devi_ops = rtls`rtls_dev_ops
> 
> But somehow calling ddi_hold_devi_by_instance(<major_of_rtls>, 0, 0) 
> returns that dip, I believe that went through the code path:
> 
>   ddi_hold_devi_by_instance()->hold_devi()->e_ddi_majorinstance_to_path()
>       ->e_ddi_instance_majorinstance_to_path()
> 
> which in turn calls:
> 
>         /* look for the instance threaded off major */
>         dnp = &devnamesp[major];
>         for (dp = dnp->dn_inlist; dp != NULL; dp = dp->ind_next)
>                 if (dp->ind_instance == inst)
>                         break;
> 
> Note that in the dnp list:
> 
> [0]> d26c1d18::print struct devnames dn_name dn_inlist
> dn_name = 0xd2460628 "rtls"
> dn_inlist = 0xd24683a0
> [0]> 0xd24683a0::print in_drv_t ind_instance ind_node
> ind_instance = 0                                      <-----
> ind_node = 0xd244bb70
> [0]> 0xd244bb70::print in_node_t in_node_name
> in_node_name = 0xd244bb88 "pci10ec,0"
> 
> I am not sure why ind_instance is not 1 at this point.
> 
> Thanks
> - Cathy
> 
> 
> 

Reply via email to