<?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: Problem with &amp;quot;findpregtype&amp;quot;. in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-quot-findpregtype-quot/m-p/5211813#M652191</link>
    <description>Hi Don Morris I was able to solve the issue with your suggested 2nd point.&lt;BR /&gt;&lt;BR /&gt;Thanks to Dennis also for replying to my query.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Closing the thread as script is working now.</description>
    <pubDate>Tue, 01 Dec 2009 12:28:31 GMT</pubDate>
    <dc:creator>Narendra Thapa</dc:creator>
    <dc:date>2009-12-01T12:28:31Z</dc:date>
    <item>
      <title>Problem with "findpregtype".</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-quot-findpregtype-quot/m-p/5211810#M652188</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;I am writing a device driver on HPUX. I am seeing  different behavior of findpregtype() on debug and non debug HPUX OS.&lt;BR /&gt;&lt;BR /&gt;findpregtype() in the code below is always returning “preg-&amp;gt;p_reg” as NULL on debug version of HPUX (B.11.31.0903).   But, it works correctly on PERF HPUX.&lt;BR /&gt;      &lt;BR /&gt;    vas = p_vas(procp_self());&lt;BR /&gt;    vas_read_lock(vas);&lt;BR /&gt;    preg = findpregtype(vas, PT_TEXT, (struct kthread *)NULL);&lt;BR /&gt;    vas_unlock(vas);&lt;BR /&gt;    if (preg &amp;amp;&amp;amp; preg-&amp;gt;p_reg)&lt;BR /&gt;    {&lt;BR /&gt;                vp = preg-&amp;gt;p_reg-&amp;gt;r_fstore;&lt;BR /&gt;    }&lt;BR /&gt;&lt;BR /&gt;Please let me know if I am missing anything here.&lt;BR /&gt;</description>
      <pubDate>Mon, 30 Nov 2009 12:22:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-quot-findpregtype-quot/m-p/5211810#M652188</guid>
      <dc:creator>Narendra Thapa</dc:creator>
      <dc:date>2009-11-30T12:22:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with "findpregtype".</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-quot-findpregtype-quot/m-p/5211811#M652189</link>
      <description>Well, the first thing that comes to mind is that if you have access to debug builds -- you shouldn't be asking *here*. Either you're with HP (which I can't determine to be true hence I have to reply to you here) or you're suitably supported that you should use your support channels.&lt;BR /&gt;&lt;BR /&gt;No one outside of R&amp;amp;D development environments should ever be running true debug bits.&lt;BR /&gt;&lt;BR /&gt;That aside -- there are a couple thoughts on your code snippet:&lt;BR /&gt;&lt;BR /&gt;1) It is not safe to read the p_reg field of the pregion in general as you describe without the VAS lock held. Yes, it is your VAS -- but the region underlying the pregion could be changed by another thread in your process [perhaps the text is being made self-patching (write is granted) and needs to be changed to a private copy instead of the globally shared bopy... that's a new region and hence the old region might go away between your dropping the lock and reading the field -- interrupts can happen at any time and mean you can't wave this away with "I do this quickly"].&lt;BR /&gt;&lt;BR /&gt;2) More to the point -- what you're describing makes me wonder if your driver is also compiled Debug when you link with the debug kernel. The usual culprit when I see this type of nonsense result (and it is nonsense -- the race I describe at (1) is possible but should be really rare, which means that usually reading your own VAS/text combination should work. You handle the daemon case by checking for NULL -- and if the pregion is non-NULL, it pretty much should have a region. The fact that you imply this is both repeatable and does not happen on a Perf kernel (when there's no difference between the two for this algorithm) suggests to me that you're really reading the *wrong field*. Which naturally flows if you're linking a perf-built driver to a debug kernel. The debug version of a pregion structure gains a lot of extra (debugging fields) in things like embedded locks, etc. The p_reg offset may easily just be pointing to garbage -- which you happen to see as NULL.&lt;BR /&gt;&lt;BR /&gt;One way to confirm (2) would be to use the debugger or disassemble your driver code -- see where the offset referenced is on the perf versus debug kernels. If the offset is the same (as I suspect), then compare that with the fields of preg_t, and you should see what you're really reading.</description>
      <pubDate>Mon, 30 Nov 2009 15:09:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-quot-findpregtype-quot/m-p/5211811#M652189</guid>
      <dc:creator>Don Morris_1</dc:creator>
      <dc:date>2009-11-30T15:09:26Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with "findpregtype".</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-quot-findpregtype-quot/m-p/5211812#M652190</link>
      <description>&amp;gt;Don: One way to confirm (2) would be to use the debugger or disassemble your driver code&lt;BR /&gt;&lt;BR /&gt;If it has debug info, you can get it to print out the offsets of each field.&lt;BR /&gt;gdb has "info types" and "ptype -v".&lt;BR /&gt;kwdb doesn't have -v but q4 has "fields -cv".</description>
      <pubDate>Tue, 01 Dec 2009 09:21:49 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-quot-findpregtype-quot/m-p/5211812#M652190</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2009-12-01T09:21:49Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with "findpregtype".</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-quot-findpregtype-quot/m-p/5211813#M652191</link>
      <description>Hi Don Morris I was able to solve the issue with your suggested 2nd point.&lt;BR /&gt;&lt;BR /&gt;Thanks to Dennis also for replying to my query.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Closing the thread as script is working now.</description>
      <pubDate>Tue, 01 Dec 2009 12:28:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/problem-with-quot-findpregtype-quot/m-p/5211813#M652191</guid>
      <dc:creator>Narendra Thapa</dc:creator>
      <dc:date>2009-12-01T12:28:31Z</dc:date>
    </item>
  </channel>
</rss>

