<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: script to find logic in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936638#M97397</link>
    <description>&lt;!--!*#--&gt;&lt;BR /&gt;&lt;BR /&gt;Forgot to say this would be a PERL script.. if not obvious.&lt;BR /&gt;&lt;BR /&gt;Also, I see I have my loop nesting wrong&lt;BR /&gt;The first section is a double nesting of lanscan and intctl building a list of device which have a duplicate cpu.&lt;BR /&gt;Then comes a section to deal with those (after $cpu=0).&lt;BR /&gt;Finally comes an overview report (after print \n)&lt;BR /&gt;&lt;BR /&gt;Should be:&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my ($cpu, $hw, @hw_to_reassign, %cpu_assigned_to, %hw_assigned_to);&lt;BR /&gt;&lt;BR /&gt;foreach (`lanscan`) {&lt;BR /&gt;    next if /Hardware|Path/;&lt;BR /&gt;    chomp;&lt;BR /&gt;    $hw = $_;&lt;BR /&gt;    foreach (`intctl -H $hw`){&lt;BR /&gt;       next unless /$hw/;&lt;BR /&gt;       $cpu = (split)[4];&lt;BR /&gt;       if (exists $hw_assigned_to{$cpu}) {&lt;BR /&gt;          push @hw_to_reassign, $hw;&lt;BR /&gt;       } else { &lt;BR /&gt;          $hw_assigned_to{$cpu} = $hw;&lt;BR /&gt;       }&lt;BR /&gt;       $cpu_assigned_to{$hw} = $cpu; # optional&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;$cpu = 0;&lt;BR /&gt;while ($hw = shift @hw_to_reassign) {&lt;BR /&gt;        $cpu++ while ($hw_assigned_to{$cpu});&lt;BR /&gt;        $cpu_assigned_to{$hw} = $cpu;  # optional&lt;BR /&gt;        $hw_assigned_to{$cpu} = $hw;&lt;BR /&gt;        print "$hw cpu $cpu_assigned_to{$hw} re-assigned to $cpu\n";&lt;BR /&gt;        system ("intctl -M -H $hw -I 1 -c $cpu");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;print "\n";&lt;BR /&gt;foreach $cpu (sort keys %hw_assigned_to) {&lt;BR /&gt;   print "cpu $cpu --&amp;gt; $hw_assigned_to{$cpu}\n";&lt;BR /&gt;   } &lt;BR /&gt; &lt;BR /&gt;  &lt;BR /&gt;</description>
    <pubDate>Thu, 01 Feb 2007 11:22:59 GMT</pubDate>
    <dc:creator>Hein van den Heuvel</dc:creator>
    <dc:date>2007-02-01T11:22:59Z</dc:date>
    <item>
      <title>script to find logic</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936636#M97395</link>
      <description>create a common script to find and transfer CPU ID's for interrupts.&lt;BR /&gt;&lt;BR /&gt;Ex: lanscan |grep -v -E "Hardware|Path" |awk '{print $1}'  shows lan card Hardware paths.&lt;BR /&gt;&lt;BR /&gt;  then putting into a loop will get all corresponding CPU ID's.&lt;BR /&gt;&lt;BR /&gt;for i in `lanscan |grep -v -E "Hardware|Path" |awk '{print $1}'`&lt;BR /&gt;  do&lt;BR /&gt;  intctl -H $i | grep -v -E "cpu|ID" |awk '{print $5}' &lt;BR /&gt;  done&lt;BR /&gt;&lt;BR /&gt;My Question:  Want to make sure they are not using same CPU ID's. If it is using then change to different CPU ID for that path using following command.&lt;BR /&gt;&lt;BR /&gt;  intctl -M -H &lt;HW path=""&gt; -I 1 -c &lt;CPU id=""&gt;&lt;BR /&gt;&lt;BR /&gt;   The above command performs to transfer interrupts from one CPU to another one for the path specified.&lt;BR /&gt;&lt;BR /&gt;Thanks in Advance.&lt;/CPU&gt;&lt;/HW&gt;</description>
      <pubDate>Thu, 01 Feb 2007 10:35:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936636#M97395</guid>
      <dc:creator>IT_2007</dc:creator>
      <dc:date>2007-02-01T10:35:07Z</dc:date>
    </item>
    <item>
      <title>Re: script to find logic</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936637#M97396</link>
      <description>&lt;!--!*#--&gt;How about something along the lines of&lt;BR /&gt;(UNTESTED. Need to check for some max-cpu!)&lt;BR /&gt;&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my ($cpu, $hw, @hw_to_reassign, %cpu_assigned_to, %hw_assigned_to);&lt;BR /&gt;&lt;BR /&gt;foreach (`lanscan`) {&lt;BR /&gt;    next if /Hardware|Path/;&lt;BR /&gt;    chomp;&lt;BR /&gt;    $hw = $_;&lt;BR /&gt;    foreach (`intctl -H $hw`){&lt;BR /&gt;       next unless /$hw/;&lt;BR /&gt;       $cpu = (split)[4];&lt;BR /&gt;       if (exists $hw_assigned_to{$cpu}) {&lt;BR /&gt;          push @hw_to_reassign, $hw;&lt;BR /&gt;       } else { &lt;BR /&gt;          $hw_assigned_to{$cpu} = $hw;&lt;BR /&gt;       }&lt;BR /&gt;       $cpu_assigned_to{$hw} = $cpu; # optional&lt;BR /&gt;    }&lt;BR /&gt;$cpu = 0;&lt;BR /&gt;    while ($hw = shift @hw_to_reassign) {&lt;BR /&gt;        $cpu++ while ($hw_assigned_to{$cpu});&lt;BR /&gt;        $cpu_assigned_to{$hw} = $cpu;  # optional&lt;BR /&gt;        $hw_assigned_to{$cpu} = $hw;&lt;BR /&gt;        print "$hw cpu $cpu_assigned_to{$hw} re-assigned to $cpu\n";&lt;BR /&gt;        system ("intctl -M -H $hw -I 1 -c $cpu");&lt;BR /&gt;     }&lt;BR /&gt;}&lt;BR /&gt;print "\n";&lt;BR /&gt;foreach $cpu (sort keys %hw_assigned_to) {&lt;BR /&gt;   print "cpu $cpu --&amp;gt; $hw_assigned_to{$cpu}\n";&lt;BR /&gt;   }&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Feb 2007 11:18:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936637#M97396</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-02-01T11:18:16Z</dc:date>
    </item>
    <item>
      <title>Re: script to find logic</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936638#M97397</link>
      <description>&lt;!--!*#--&gt;&lt;BR /&gt;&lt;BR /&gt;Forgot to say this would be a PERL script.. if not obvious.&lt;BR /&gt;&lt;BR /&gt;Also, I see I have my loop nesting wrong&lt;BR /&gt;The first section is a double nesting of lanscan and intctl building a list of device which have a duplicate cpu.&lt;BR /&gt;Then comes a section to deal with those (after $cpu=0).&lt;BR /&gt;Finally comes an overview report (after print \n)&lt;BR /&gt;&lt;BR /&gt;Should be:&lt;BR /&gt;&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my ($cpu, $hw, @hw_to_reassign, %cpu_assigned_to, %hw_assigned_to);&lt;BR /&gt;&lt;BR /&gt;foreach (`lanscan`) {&lt;BR /&gt;    next if /Hardware|Path/;&lt;BR /&gt;    chomp;&lt;BR /&gt;    $hw = $_;&lt;BR /&gt;    foreach (`intctl -H $hw`){&lt;BR /&gt;       next unless /$hw/;&lt;BR /&gt;       $cpu = (split)[4];&lt;BR /&gt;       if (exists $hw_assigned_to{$cpu}) {&lt;BR /&gt;          push @hw_to_reassign, $hw;&lt;BR /&gt;       } else { &lt;BR /&gt;          $hw_assigned_to{$cpu} = $hw;&lt;BR /&gt;       }&lt;BR /&gt;       $cpu_assigned_to{$hw} = $cpu; # optional&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;$cpu = 0;&lt;BR /&gt;while ($hw = shift @hw_to_reassign) {&lt;BR /&gt;        $cpu++ while ($hw_assigned_to{$cpu});&lt;BR /&gt;        $cpu_assigned_to{$hw} = $cpu;  # optional&lt;BR /&gt;        $hw_assigned_to{$cpu} = $hw;&lt;BR /&gt;        print "$hw cpu $cpu_assigned_to{$hw} re-assigned to $cpu\n";&lt;BR /&gt;        system ("intctl -M -H $hw -I 1 -c $cpu");&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;print "\n";&lt;BR /&gt;foreach $cpu (sort keys %hw_assigned_to) {&lt;BR /&gt;   print "cpu $cpu --&amp;gt; $hw_assigned_to{$cpu}\n";&lt;BR /&gt;   } &lt;BR /&gt; &lt;BR /&gt;  &lt;BR /&gt;</description>
      <pubDate>Thu, 01 Feb 2007 11:22:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936638#M97397</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-02-01T11:22:59Z</dc:date>
    </item>
    <item>
      <title>Re: script to find logic</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936639#M97398</link>
      <description>looking for a shell script otherwise would go to perl. &lt;BR /&gt;&lt;BR /&gt;thanks.</description>
      <pubDate>Thu, 01 Feb 2007 12:33:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936639#M97398</guid>
      <dc:creator>IT_2007</dc:creator>
      <dc:date>2007-02-01T12:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: script to find logic</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936640#M97399</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Is there a reason why you don't just move the interrupts around once manually and then use:&lt;BR /&gt;&lt;BR /&gt;intctl -s /etc/my_interrupt_cfg&lt;BR /&gt;&lt;BR /&gt;Then every time you reboot you can just call&lt;BR /&gt;&lt;BR /&gt;intctl -r /etc/my_interrupt_cfg&lt;BR /&gt;&lt;BR /&gt;Which will restore the config to how you had it before.&lt;BR /&gt;&lt;BR /&gt;Of course if you have iCAP CPUs or vPars... the number of CPUs will change and this won't work.&lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;&lt;BR /&gt;Duncan&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Feb 2007 15:56:35 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936640#M97399</guid>
      <dc:creator>Duncan Edmonstone</dc:creator>
      <dc:date>2007-02-01T15:56:35Z</dc:date>
    </item>
    <item>
      <title>Re: script to find logic</title>
      <link>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936641#M97400</link>
      <description>&lt;!--!*#--&gt;I much like Duncan's idea.&lt;BR /&gt;I guess that a reason why I keep reading and replying to the forums always something new to learn. This time the -r / -s option for intctl&lt;BR /&gt;&lt;BR /&gt;I had an opportunity to test my script on my 2620.&lt;BR /&gt;It almost worked. Only serious problem:&lt;BR /&gt;    chomp;&lt;BR /&gt;    $hw = $_;&lt;BR /&gt;Should be &lt;BR /&gt;    $hw = (split)[0];&lt;BR /&gt;&lt;BR /&gt;I looked at the intctl output some more, and tehre is no reason to first do the lanscan + individual intctl's. You can call it once adn licp up the ' lan ' lines remembering the hardware addresses and cpu's as you go.&lt;BR /&gt;&lt;BR /&gt;Minor re-hash:&lt;BR /&gt;&lt;BR /&gt;"move_network_interrupts.pl" 39 lines, 932 characters&lt;BR /&gt;use strict;&lt;BR /&gt;use warnings;&lt;BR /&gt;my ($cpu, $hw, @hw_to_reassign, %cpu_assigned_to, %hw_assigned_to);&lt;BR /&gt;&lt;BR /&gt;#&lt;BR /&gt;# Loop through hardware looking for lan entries as:&lt;BR /&gt;# 0/1/2/1       lan        iether     N/A   1&lt;BR /&gt;#&lt;BR /&gt;foreach (`intctl`){&lt;BR /&gt;    if (/(\S+)\s+lan\s+\S+\s+\S+\s+(\d+)/) {&lt;BR /&gt;       $hw  = $1;&lt;BR /&gt;       $cpu = $2;&lt;BR /&gt;print "... $hw $cpu\n";&lt;BR /&gt;       if ($hw_assigned_to{$cpu}) {&lt;BR /&gt;          push @hw_to_reassign, $hw;&lt;BR /&gt;       } else {&lt;BR /&gt;          $hw_assigned_to{$cpu} = $hw;&lt;BR /&gt;       }&lt;BR /&gt;       $cpu_assigned_to{$hw} = $cpu;&lt;BR /&gt;    }&lt;BR /&gt;}&lt;BR /&gt;#&lt;BR /&gt;# Re-assign duplica&lt;BR /&gt;#&lt;BR /&gt;$cpu = 0;&lt;BR /&gt;while ($hw = shift @hw_to_reassign) {&lt;BR /&gt;    $cpu++ while ($hw_assigned_to{$cpu});&lt;BR /&gt;    print "reassining $hw cpu $cpu_assigned_to{$hw} to $cpu\n";&lt;BR /&gt;    system ("intctl -M -H $hw -I 1 -c $cpu");&lt;BR /&gt;    $cpu_assigned_to{$hw} = $cpu;&lt;BR /&gt;    $hw_assigned_to{$cpu} = $hw;&lt;BR /&gt;}&lt;BR /&gt;#&lt;BR /&gt;# Final report&lt;BR /&gt;#&lt;BR /&gt;print "\n";&lt;BR /&gt;foreach $cpu (sort keys %hw_assigned_to) {&lt;BR /&gt;    print "cpu $cpu --&amp;gt; $hw_assigned_to{$cpu}\n";&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Sample run:&lt;BR /&gt;&lt;BR /&gt;&amp;gt;perl  move_network_interrupts.pl&lt;BR /&gt;... 0/1/2/0 0&lt;BR /&gt;... 0/1/2/1 0&lt;BR /&gt;reassining 0/1/2/1 cpu 0 to 1&lt;BR /&gt;intctl: Moved the interrupt: 1, of card 0/1/2/1, driver iether, from CPU:0 to CPU:1&lt;BR /&gt;&lt;BR /&gt;cpu 0 --&amp;gt; 0/1/2/0&lt;BR /&gt;cpu 1 --&amp;gt; 0/1/2/1&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Enjoy,&lt;BR /&gt;Hein.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 01 Feb 2007 20:37:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/script-to-find-logic/m-p/3936641#M97400</guid>
      <dc:creator>Hein van den Heuvel</dc:creator>
      <dc:date>2007-02-01T20:37:17Z</dc:date>
    </item>
  </channel>
</rss>

