5 Replies Latest reply: Apr 13, 2011 2:13 PM by compres RSS

    writing single bytes to same MPB

    christgau

      Hi everybody,

       

      the following questions might be simple, but I'm not getting the answer by myself.

       

      Suppose that you have three processes (A, B and C) running on the SCC on different cores. B and C send messages to A.

       

      The messages have a size of two bytes. The senders will write in different locations of A's MPB. Let's say, B writes at address 0x0 and C writes at address 0x2. The message from B arrives at the MPB of A just before the message from C does.

       

      Does A get the correct messages from both senders when reading from the MPB (including MPBT cache invalidate)? Or can the message from B be overwritten by C on some way?

       

      (Remark: B and C are not sending the messages in multiples of cachelines)

       

      Thanks for your help

       

      Steffen

        • 1. Re: writing single bytes to same MPB
          jheld

          You haven't given enough information to know if there will be a problem.

          Depending on when A does its invalidate it could miss the second update.

          • 2. Re: writing single bytes to same MPB
            aprell

            A will read the correct messages, but it needs to know when they have arrived. Without synchronization A could miss an update, just as Jim said.

            • 3. Re: writing single bytes to same MPB
              christgau

              Thanks for your replies. I should have mentioned that A polls the MPB sections where B and C write into.

               

              Just to be sure: Assume that the following pseudo-code is executed, does A get 0xBEAF from B and 0xCAFE from C?

               

              /* A polls; t = 0 */

              A: memcpy(read_buffer_B, local_mpb, 2); memcpy(read_buffer_C, local_mpb + 0x2, 2);

               

              /* B and C send their messages; t = 1 */

              B: my_message = 0xBEAF; memcpy(remote_mpb_A, &my_message, 2);

              C: my_message = 0xCAFE; memcpy(remote_mpb_A + 0x2, &my_message, 2);

               

              /* A polls again; data transfer from B and C to local MPB of A is already complete */

              A: memcpy(read_buffer_B, local_mpb, 2); memcpy(read_buffer_C, local_mpb + 0x2, 2);

               

              Remarks: memcpy(destination, source, size), according CL1FLUSHMBs omitted

              • 4. Re: writing single bytes to same MPB
                compres

                Have you considered the write combine buffer in your code? 

                 

                If you don't write 32 contiguous and alligned bytes, the WCB may delay the writes as an optimization (it's an optimization if you assume a single core system, like the p54c PCs were).

                • 5. Re: writing single bytes to same MPB
                  christgau

                  Isaías, thanks for pointing that out! It made my day.