<?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: Behaviour of the LOCK macro on a multiprocessor in Operating System - OpenVMS</title>
    <link>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926702#M32757</link>
    <description>Kris,&lt;BR /&gt;&lt;BR /&gt;this is a question for me ;-)&lt;BR /&gt;&lt;BR /&gt;May I suggest, that you use the .LIST MEB MACRO statement (just insert it before invoking the LOCK macro) and compile your MACRO program with /LIST. This will show the macro expansion in the source listing.&lt;BR /&gt;&lt;BR /&gt;The PRESERVE={YES/NO} clause will cause R0 to be preserved around the LOCK/UNLOCK macro invocation.&lt;BR /&gt;&lt;BR /&gt;On a uniprocessor, the LOCK/UNLOCK macro will just raise/lower IPL and not touch R0 at all - so it will work as expected whether you use PRESERVE=NO or PRESERVE=YES.&lt;BR /&gt;&lt;BR /&gt;On a multiprocessor, the macro will call SMP$ACQUIRE or SMP$RELEASE, which will modify R0. The 'status' value found in R0 (%x85CB4100) is not a status value, but most probably the address of the SCHED spinlock structure left in R0 on return from SMP$RELEASE.&lt;BR /&gt;&lt;BR /&gt;So to make this code work correctly, you need to use PRESERVE=YES, if you want to preserve the contents of R0 around the LOCK or UNLOCK macro invocation.&lt;BR /&gt;&lt;BR /&gt;Volker.</description>
    <pubDate>Fri, 16 Sep 2005 07:07:41 GMT</pubDate>
    <dc:creator>Volker Halle</dc:creator>
    <dc:date>2005-09-16T07:07:41Z</dc:date>
    <item>
      <title>Behaviour of the LOCK macro on a multiprocessor</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926701#M32756</link>
      <description>Hi,&lt;BR /&gt;Recently, I installed a working program of mine on a dual CPU DS25 running VMS 7.3-1.&lt;BR /&gt;Unfortunately, the program exits with status code %x85CB4100.&lt;BR /&gt;Running the same program on a single CPU AlphaServer 1000A running VMS 7.3-1, it works fine.&lt;BR /&gt;Intrigued I was I stripped down the program, and it seems that the error occurs in the LOCK macro in the only Macro-32 module in the program.&lt;BR /&gt;The procedure is called indirectly by $CMKRNL, tries to acquire the SCHED spinlock, does something nasty, and releases the spinlock before returning to the main stream of execution.&lt;BR /&gt;The 3 lines of Macro to acquire the spinlock, I snatched from SYS$EXAMPLES:LAT$RATING_DPT.MAR.&lt;BR /&gt;After some testing, I found that if I changed the code to specify PRESERVE=YES, the routine executes as expected on both uniprocessor and multiprocessor systems. If I specify PRESERVE=NO, the routine fails on multiprocessor systems, but still executes flawlessly on uniprocessor.&lt;BR /&gt;Someone any ideas why?&lt;BR /&gt;Thanx,&lt;BR /&gt;Kris (aka Qkcl)&lt;BR /&gt;&lt;BR /&gt;Note: Source code for main program (in C), and kernel mode routine (in Macro) attached.</description>
      <pubDate>Fri, 16 Sep 2005 06:04:07 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926701#M32756</guid>
      <dc:creator>Kris Clippeleyr</dc:creator>
      <dc:date>2005-09-16T06:04:07Z</dc:date>
    </item>
    <item>
      <title>Re: Behaviour of the LOCK macro on a multiprocessor</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926702#M32757</link>
      <description>Kris,&lt;BR /&gt;&lt;BR /&gt;this is a question for me ;-)&lt;BR /&gt;&lt;BR /&gt;May I suggest, that you use the .LIST MEB MACRO statement (just insert it before invoking the LOCK macro) and compile your MACRO program with /LIST. This will show the macro expansion in the source listing.&lt;BR /&gt;&lt;BR /&gt;The PRESERVE={YES/NO} clause will cause R0 to be preserved around the LOCK/UNLOCK macro invocation.&lt;BR /&gt;&lt;BR /&gt;On a uniprocessor, the LOCK/UNLOCK macro will just raise/lower IPL and not touch R0 at all - so it will work as expected whether you use PRESERVE=NO or PRESERVE=YES.&lt;BR /&gt;&lt;BR /&gt;On a multiprocessor, the macro will call SMP$ACQUIRE or SMP$RELEASE, which will modify R0. The 'status' value found in R0 (%x85CB4100) is not a status value, but most probably the address of the SCHED spinlock structure left in R0 on return from SMP$RELEASE.&lt;BR /&gt;&lt;BR /&gt;So to make this code work correctly, you need to use PRESERVE=YES, if you want to preserve the contents of R0 around the LOCK or UNLOCK macro invocation.&lt;BR /&gt;&lt;BR /&gt;Volker.</description>
      <pubDate>Fri, 16 Sep 2005 07:07:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926702#M32757</guid>
      <dc:creator>Volker Halle</dc:creator>
      <dc:date>2005-09-16T07:07:41Z</dc:date>
    </item>
    <item>
      <title>Re: Behaviour of the LOCK macro on a multiprocessor</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926703#M32758</link>
      <description>Kris,&lt;BR /&gt;&lt;BR /&gt;here is a pointer to documentation of the LOCK macro in VAX Device Support Reference Manual:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.sysworks.com.au/disk$vaxdocjun963/decw$book/dy4yaa28.p123.decw$book#555" target="_blank"&gt;http://www.sysworks.com.au/disk$vaxdocjun963/decw$book/dy4yaa28.p123.decw$book#555&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Volker.</description>
      <pubDate>Fri, 16 Sep 2005 07:14:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926703#M32758</guid>
      <dc:creator>Volker Halle</dc:creator>
      <dc:date>2005-09-16T07:14:50Z</dc:date>
    </item>
    <item>
      <title>Re: Behaviour of the LOCK macro on a multiprocessor</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926704#M32759</link>
      <description>Volker,&lt;BR /&gt;Spot on.&lt;BR /&gt;Expanded Macro code shows&lt;BR /&gt;    MOVL S^#SPL$C_SCHED,R0&lt;BR /&gt;    JSB G^SMP$RELEASE&lt;BR /&gt;    MTPR (SP)+,S^#PR$_IPL&lt;BR /&gt;    RET&lt;BR /&gt;So, R0 is definitely touched. So the calling routine does not get a proper return status.&lt;BR /&gt;But this then leaves the question how to determine if the SMP$ACQUIRE or SMP$RELEASE routines executed properly.&lt;BR /&gt;Btw, thanx for the pointer to the docs.&lt;BR /&gt;Kris (aka Qkcl)</description>
      <pubDate>Fri, 16 Sep 2005 07:48:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926704#M32759</guid>
      <dc:creator>Kris Clippeleyr</dc:creator>
      <dc:date>2005-09-16T07:48:42Z</dc:date>
    </item>
    <item>
      <title>Re: Behaviour of the LOCK macro on a multiprocessor</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926705#M32760</link>
      <description>Kris,&lt;BR /&gt;&lt;BR /&gt;if SMP$ACQUIRE or SMP$RELEASE would fail, you'll probably notice, as you'll get a system crash ;-)&lt;BR /&gt;&lt;BR /&gt;Both routines do not return an output status value in R0. R0 will be modified though. &lt;BR /&gt;&lt;BR /&gt;Volker.</description>
      <pubDate>Fri, 16 Sep 2005 07:59:59 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926705#M32760</guid>
      <dc:creator>Volker Halle</dc:creator>
      <dc:date>2005-09-16T07:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Behaviour of the LOCK macro on a multiprocessor</title>
      <link>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926706#M32761</link>
      <description>Got what I wanted.&lt;BR /&gt;Thanx again Volker.&lt;BR /&gt;Kris (aka Qkcl)&lt;BR /&gt;</description>
      <pubDate>Fri, 16 Sep 2005 08:23:17 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-openvms/behaviour-of-the-lock-macro-on-a-multiprocessor/m-p/4926706#M32761</guid>
      <dc:creator>Kris Clippeleyr</dc:creator>
      <dc:date>2005-09-16T08:23:17Z</dc:date>
    </item>
  </channel>
</rss>

