Branch Instruction Speculation Barrier Two-Stage Execution

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Data processing systems are vulnerable to cache timing side-channels due to speculative memory reads, which can be exploited by untrusted code to access sensitive information, and existing solutions like speculation barrier instructions negatively impact performance.

Innovation Solution

A two-stage execution mechanism for branch instructions is implemented, where the first execution inhibits updating of branch prediction data items and keeps the instruction in the issue queue until the speculation barrier is completed, allowing subsequent re-execution to update the branch prediction structures, thereby maintaining performance while enhancing security.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Reliability

If speculation barrier instructions are used to prevent speculative execution, then security against cache timing side-channels is improved, but processor performance deteriorates due to pipeline stalls

Engineering Contradiction:
ImprovesecurityVSAvoidprocessor performance
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The execution of branch instructions is segmented into two distinct stages: a first execution stage that performs the branch instruction without updating branch prediction data items, and a second execution stage that updates the branch prediction data items. This segmentation allows the processor to maintain security by preventing speculative updates while preserving performance by allowing non-speculative execution to proceed.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The system dynamically adjusts the execution behavior of branch instructions based on the presence of speculation barrier instructions. When a speculation barrier is detected, the processor transitions to a restricted execution mode for subsequent branch instructions, preventing speculative updates. Once the barrier is resolved, normal execution resumes. This dynamic adaptation balances security requirements with performance optimization.

Inventive Principle:
Principle #15Dynamics

2Speed

If branch prediction speculation is enabled for high performance, then processor speed is improved, but vulnerability to cache timing side-channels increases

Engineering Contradiction:
Improveprocessor speedVSAvoidcache timing side-channel vulnerability
Core Design Contradiction:
SpeedVSObject-affected harmful factors

Solution Approach 1:

The harmful speculative update of branch prediction data items is extracted and separated from the beneficial speculative execution of branch instructions. The first execution stage preserves the beneficial speculative execution for performance, while the second execution stage selectively applies the harmful update only when security is compromised, thereby removing the vulnerability without sacrificing performance.

Inventive Principle:
Principle #2Taking out (Extraction)

Solution Approach 2:

The branch prediction data items act as an intermediary between the branch instruction execution and the branch prediction mechanism. By controlling whether these intermediary data items are updated during execution, the system mediates between the conflicting requirements of performance (through speculative execution) and security (by preventing speculative updates that enable side-channels).

Inventive Principle:
Principle #24Intermediary (Mediator)

Data Source

PatentUS10977044B2Executing branch instructions following a speculation barrier instruction
Publication Date: 2021.04.13 ARM LTD
  • US10977044B2 patent drawing
  • US10977044B2 patent drawing
  • US10977044B2 patent drawing

AI summary

An apparatus comprising processing circuitry is provided, the processing circuitry comprising execution circuitry, commit circuitry, issue circuitry comprising an issue queue and selection circuitry, and a branch predictor. The processing circuitry is configured to identify a speculation barrier instruction in the commit queue. While an entry in the commit queue identifies a speculation barrier instruction, when a branch instruction that follows the speculation barrier instruction in the program order is selected for issue, the processing circuitry performs a first execution of the instruction, inhibiting updating of branch prediction data items associated with the branch instruction and inhibiting the selection circuitry from invalidating the associated issue queue entry. When the speculation barrier instruction completes, the processing circuitry is configured to perform a second execution of the instruction, updating the branch prediction data items associated with the branch instruction and allowing the issue circuitry to invalidate the associated issue queue entry.