Revision history   OpenPOWER Library

 4.4.3.2. PSL Procedure for Time-Sliced Programming Models

 Each PSL assigned to service the scheduled processes is configured with a unique identifier and the identifier of the next PSL in the list of PSLs servicing the processes. In addition, each PSL is identified as either the first PSL, the last PSL, both first and last PSL (only one PSL servicing the queue), or neither first or last PSL. The PSL ID Register contains the PSL unique identifier and the settings for first and last.

  Operations Performed by the First PSL (PSL_ID[L,F] = '01')

When the terminate_element MMIO command is received by the first PSL, the PSL checks to see if the process element being terminated is currently running. It performs any operations necessary, and sends the terminate_element command to the next PSL or sets the completion status in the software command/status word.

  1. If the process element is running, the process is terminated. The PSL sets the completion status in the software command/status field to indicate that the process has been successfully terminated. The PSL is allowed to complete any outstanding transactions but should not start any new transactions for the process.

    • The status field in sw_command_status is set to x'0001' using a caching-inhibited DMA or special memory-update operation that is guaranteed not to corrupt memory if the operation fails. The final value of sw_command_status should be (x'00010001' || first_psl_id || link_of_element_to_terminate).

  2. If the process element is not running, the PSL writes a termination command to the psl_chained_command doubleword for the next PSL and watches for the termination to be complete.

    • Write the value (x'00010000' || next_psl_id || link_of_element_to_terminate) to the psl_chained_command doubleword.

    • While waiting for the process to be terminated, the PSL does not attempt to start the corresponding process or any process with the complete, suspend, or terminate flags set. The PSL can perform other operations.

      • The process is terminated when the status field in sw_command_status is x'0001'.

  Operations Performed by the Next PSL (PSL_ID[L,F] = '00')

When the terminate_element command is detected by the next PSL, the PSL checks to see if the process element that is being terminated is currently running. It performs any operations necessary, and sends the terminate_element command to the next PSL or sets the completion status in the software command/status word. The terminate_element command is detected by monitoring the psl_chained_command doubleword.

  1. If the process element is running, the process is terminated. The PSL sets the completion status in the software command/status field to indicate that the process has been successfully terminated. The PSL is allowed to complete any outstanding transactions but should not start any new transactions for the process.

    • The status field in sw_command_status is set to x'0001' using a caching-inhibited DMA or special memory-update operation that is guaranteed not to corrupt memory if the operation fails. The final value of sw_command_status should be (x'00010001' || first_psl_id || link_of_element_to_terminate).

  2. If the process element is not running, the PSL writes a termination command to the psl_chained_command doubleword for the next PSL and watches for the termination to be completed.

    • Write the value (x'00010000' || next_psl_id || link_of_element_to_terminate) to psl_chained_command.

    • While waiting for the process to be terminated, the PSL does not attempt to start the corresponding process or any process with the complete, suspend, or terminate flags set. The PSL can perform other operations.

      • The process is terminated when the status field in sw_command_status is x'0001'.

  Operations Performed by the Last PSL (PSL_ID[L] = '1')

When the terminate_element MMIO command is received or the terminate_element command is detected by the last PSL, the PSL checks to see if the process element being terminated is currently running. It performs any operations necessary, and sets the completion status in the software command/status word. The terminate_element command is detected by monitoring the psl_chained_command doubleword.

  1. If the process element is running, the process is terminated and the PSL sets the completion status in the software command/status field to indicate that the process has been successfully terminated. The PSL is allowed to complete any outstanding transactions but should not start any new transactions for the process.

    • The status field in sw_command_status is set to x'0001' using a caching-inhibited DMA or special memory-update operation that is guaranteed not to corrupt memory if the operation fails. The final value of sw_command_status should be (x'00010001' || first_psl_id || link_of_element_to_terminate).

  2. If the process element is not running, the PSL searches the queue to determine if the process is waiting to be resumed and indicates that the process termination is complete.

    • The PSL pulls each process link from the PSL queue and compares the link with the process being terminated. The full queue is searched.

      1. Performs a read of the cache line containing the head_pointer and tail_pointer such that the cache line is owned by the PSL.

        • The PSL should prevent any other PSL from accessing the cache line until substep f.

          • Save the head_pointer location to an initial_head_pointer internal register.

      2.  Removes the process from the PSL queue.

        • Read the process_element_link and process_state pointed to by the tail_pointer.

        • Add 8 to the tail_pointer; tail_pointer = tail_pointer + 8.

        • If the tail_pointer is greater than end_of_PSL_queue_area, tail_pointer = start_of_PSL_queue_area.

      3. Compares the process_element_link read in substep b with link_of_element_to_terminate.

        • If the links match, continue with substep e.

        • If the link do not match, continue with the next substep.

      4. Puts the process_element_link and process_state back on the PSL queue.

        • Writes the process_element_link and process_state to the memory location pointed to by the head_pointer.

        • Add 8 to the head_pointer; head_pointer = head_pointer + 8.

        • If the head_pointer is greater than end_of_PSL_queue_area, head_pointer = start_of_PSL_queue_area.

      5.  Compares the tail_pointer to the initial_head_pointer.

        • If the tail_pointer is not equal to initial_head_pointer, continue with substep b.

        • If the tail_pointer is equal to initial_head_pointer, continue with the next substep.

      6.  Release the protection of the cache line containing the head_pointer and tail_pointer values.

    • After completing the search of all process links, the status field in sw_command_status is set to x'0001' using a caching-inhibited DMA or special memory-update operation that is guaranteed not to corrupt memory if the operation fails. The final value of sw_command_status should be (x'00010001' || first_psl_id || link_of_element_to_terminate).

      All other PSLs can now stop protecting against starting the process being terminated.


loading table of contents...