Solaris Hotplug: Manage your devices!

Solaris Hotplug can be used in various ways, let’s see what we can get out of it!

Enable the daemon

First of all, we should enable the daemon before anything else:

# svcadm enable hotplug

Listing devices

You can list devices in different ways, first you can have the list of devices and their corresponding driver attach:

# hotplug list -d
pci@0,0  npe#0
    pci8086,100  <pci.0,0>  OFFLINE  #0
    pci8086,101@1  <pci.1,0>  ONLINE  pcieb#0
        pci1095,7132@0  <pci.0,0>  ONLINE  si3124#0
            disk@0,0  sd#7
            disk@1,0  sd#8
    pci8086,105@1,1  <pci.1,1>  ONLINE  pcieb#1
        display@0  <pci.0,0>  ONLINE  vgatext#0
        pci10de,be3  <pci.0,1>  OFFLINE  #0
    pci1458,1c3a  <pci.16,0>  OFFLINE  #0
    pci1458,5006@1a  <pci.1a,0>  ONLINE  ehci#0
        hub@1  hubd#0
    pci1458,a102  <pci.1b,0>  OFFLINE  #0
    pci8086,1c10@1c  <pci.1c,0>  ONLINE  pcieb#2
        pci108e,125e@0  <pci.0,0>  ONLINE  e1000g#0
        pci108e,125e@0,1  <pci.0,1>  ONLINE  e1000g#1
    pci8086,1c18@1c,4  <pci.1c,4>  ONLINE  pcieb#3
        pci1458,5007  <pci.0,0>  OFFLINE  #0
    pci8086,1c1a@1c,5  <pci.1c,5>  ONLINE  pcieb#4
        pci1458,e000@0  <pci.0,0>  ONLINE  rge#0
    pci8086,244e@1c,6  <pci.1c,6>  ONLINE  pcieb#5
        pci1283,8892@0  <pci.0,0>  ONLINE  pci_pci#0
            pci1458,1000@3  <pci.3,0>  ONLINE  hci1394#0
    pci1458,5006@1d  <pci.1d,0>  ONLINE  ehci#1
        hub@1  hubd#1
            hub@5  hubd#3
            hub@6  hubd#4
    isa@1f  <pci.1f,0>  ONLINE  isa#0
        fdc  #0
        motherboard  #0
        pit_beep  pit_beep#0
    pci1458,b005@1f,2  <pci.1f,2>  ONLINE  ahci#0
        disk@0,0  sd#0
        disk@1,0  sd#1
        disk@2,0  sd#2
        disk@3,0  sd#3
        disk@4,0  sd#4
        disk@5,0  sd#5
    pci1458,5001  <pci.1f,3>  OFFLINE  #0

On another side, you can see the device attached. I found that really interesting especially for the network cards:

# hotplug list -lv
/pci@0,0/pci8086,100    OFFLINE
/pci@0,0/pci8086,101@1    ONLINE
/pci@0,0/pci8086,101@1/pci1095,7132@0    ONLINE
/pci@0,0/pci8086,105@1,1    ONLINE
/pci@0,0/pci8086,105@1,1/display@0    ONLINE
/pci@0,0/pci8086,105@1,1/pci10de,be3    OFFLINE
/pci@0,0/pci1458,1c3a    OFFLINE
/pci@0,0/pci1458,5006@1a    ONLINE
/pci@0,0/pci1458,a102    OFFLINE
/pci@0,0/pci8086,1c10@1c    ONLINE
/pci@0,0/pci8086,1c10@1c/pci108e,125e@0    ONLINE
    { Network interface net0 }
    { net0: hosts IP addresses: }
/pci@0,0/pci8086,1c10@1c/pci108e,125e@0,1    ONLINE
    { Network interface net1 }
    { net1: hosts IP addresses: }
/pci@0,0/pci8086,1c18@1c,4    ONLINE
/pci@0,0/pci8086,1c18@1c,4/pci1458,5007    OFFLINE
/pci@0,0/pci8086,1c1a@1c,5    ONLINE
/pci@0,0/pci8086,1c1a@1c,5/pci1458,e000@0    ONLINE
    { Network interface net2 }
    { net2: hosts IP addresses: fe80::1e6f:65ff:fec4:2299, }
/pci@0,0/pci8086,244e@1c,6    ONLINE
/pci@0,0/pci8086,244e@1c,6/pci1283,8892@0    ONLINE
/pci@0,0/pci8086,244e@1c,6/pci1283,8892@0/pci1458,1000@3    ONLINE
/pci@0,0/pci1458,5006@1d    ONLINE
/pci@0,0/isa@1f    ONLINE
/pci@0,0/pci1458,b005@1f,2    ONLINE
/pci@0,0/pci1458,5001    OFFLINE

Practical use: resetting a PCIEX card

When you have a hardware failure or something that looks like it, it’s sometime good to be able to reset the device prior to replacing the hardware. The easiest way to do that is simply to power-cycle the server. Although, that’s really not convenient when you have to do that on a production machine.

You can then give a try to the following procedure:

Find the device to reset

We want to reset the PCIEX device behind net1:

# hotplug list -lv | ggrep -B6 -A2 net1
/pci@0,0/pci1458,a102    OFFLINE
/pci@0,0/pci8086,1c10@1c    ONLINE
/pci@0,0/pci8086,1c10@1c/pci108e,125e@0    ONLINE
    { Network interface net0 }
    { net0: hosts IP addresses: }
/pci@0,0/pci8086,1c10@1c/pci108e,125e@0,1    ONLINE
    { Network interface net1 }
    { net1: hosts IP addresses: }
/pci@0,0/pci8086,1c18@1c,4    ONLINE
/pci@0,0/pci8086,1c18@1c,4/pci1458,5007    OFFLINE

We can see that the device behind net1 is /pci@0,0/pci8086,1c10@1c/pci108e,125e@0,1, this is a dualport network card and the two ports are in use. As we don’t want to disable the other port, we’ll try first to offline only one port of the card. If that does not suits our needs, we’ll power-cycle the whole card.

Power-Cycle a single port

# hotplug offline /pci@0,0/pci8086,1c10@1c pci.0,1 # second port of the PCIEX card
# hotplug online /pci@0,0/pci8086,1c10@1c pci.0,1

We can find the corresponding messages in the /var/adm/messages file:

Apr 30 21:42:48 [hostname] mac: [ID 736570] NOTICE: e1000g1 unregistered
Apr 30 21:42:48 [hostname] genunix: [ID 408114 kern.notice] /pci@0,0/pci8086,1c10@1c/pci108e,125e@0,1 (e1000g1) offline
Apr 30 21:42:33 [hostname] mac: [ID 469746] NOTICE: e1000g1 registered
Apr 30 21:42:33 [hostname] genunix: [ID 408114 kern.notice] /pci@0,0/pci8086,1c10@1c/pci108e,125e@0,1 (e1000g1) online

Power-cycle the whole PCIEX card

# hotplug offline /pci@0,0/pci1458,a102 pci.1b,0
# hotplug online /pci@0,0/pci1458,a102 pci.1b,0

Here we are! The card and the two ports have been reset.

Sometimes, I’ve seen some people unloading the drivers to get the device reloaded by the OS: with hotplug, you can get even further by reloading only the particular device you want to.

If that was useful to you, don’t hesitate to tell me so 😉

This entry was posted in Solaris and tagged , , . Bookmark the permalink.

1 Response to Solaris Hotplug: Manage your devices!

  1. Justin Pryzby says:

    That’s a better alternative for our usb3 card at work than plugging and replugging following a reboot, thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *