# US 2023/0418509 A1 · Switching memory consistency models in accordance with execution privilege level

> Agents: this data is available as JSON from the patentgrep API and MCP server — see https://patentgrep.com/llms.txt

- Number: US 2023/0418509 A1
- Document ID: US20230418509A1
- Status: Published application
- Kind: A1
- Application number: 17/850,916
- Filed: 2022-06-27
- Published: 2023-12-28
- Earliest claimed: 2022-06-27
- Assignees: Red Hat, Inc.
- Applicants: Red Hat, Inc.
- Inventors: Michael Tsirkin
- Web page: https://patentgrep.com/patent/US20230418509A1

## CPC

- G06F 3/0655: {Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices}
- G06F 3/0604: {Improving or facilitating administration, e.g. storage management}
- G06F 3/061: {Improving I/O performance}
- G06F 3/0634: {by changing the state or mode of one or more devices}
- G06F 3/0679: {Non-volatile semiconductor memory device, e.g. flash memory, one time programmable memory [OTP]}
- G06F 3/0659: {Command handling arrangements, e.g. command buffers, queues, command scheduling}
- G06F: ELECTRIC DIGITAL DATA PROCESSING (computer systems based on specific computational models G06N)

## Abstract

An example method may include executing one or more first instructions that cause the processing device to enter a privileged execution mode, switching a memory consistency model of the processing device to a strong instruction ordering mode, and executing one or more second instructions in the privileged execution mode, where the one or more second instructions are executed using the strong instruction ordering mode. The method may further include executing one or more third instructions that cause the processing device to exit the privileged execution mode, and, responsive to executing the one or more third instructions, switching the memory consistency model of the processing device to a relaxed instruction ordering mode.

## Claims

### Claim 1

A system comprising:
a memory device comprising a group of memory units; and
a processing device, operatively coupled to the memory device, to perform operations comprising:
executing one or more first instructions that cause the processing device to enter a privileged execution mode;
switching a memory consistency mode of the processing device to a strong instruction ordering mode; and
executing one or more second instructions in the privileged execution mode, wherein the one or more second instructions are executed using the strong instruction ordering mode.

### Claim 2 (depends on 1)

The system of claim 1, the operations further comprising:
executing one or more third instructions that cause the processing device to exit the privileged execution mode; and
responsive to executing the one or more third instructions, switching the memory consistency mode of the processing device to a relaxed instruction ordering mode.

### Claim 3 (depends on 1)

The system of claim 1, wherein switching the memory consistency mode of the processing device is responsive to executing the one or more first instructions.

### Claim 4 (depends on 1)

The system of claim 1, wherein the one or more first instructions are executed in response to one or more of: a kernel system call, a hardware interrupt, an inter-processor interrupt, a timer interrupt, or a memory fault.

### Claim 5 (depends on 1)

The system of claim 1, wherein the one or more first instructions are executed by application program code, the application program code is associated with an isolated address space, and switching the memory consistency mode of the processing device to the strong instruction ordering mode is responsive to an instruction of the application program code attempting to access a memory location having an address outside the isolated address space.

### Claim 6 (depends on 5)

The system of claim 5, wherein switching the memory consistency mode of the processing device to the strong instruction ordering mode is responsive to a page fault that indicates an attempt to access a memory location having an address outside the isolated address space.

### Claim 7 (depends on 1)

The system of claim 1, wherein the privileged execution mode comprises a supervisor mode of the processing device, and wherein the one or more second instructions are comprised by an operating system kernel or a virtual machine.

### Claim 8 (depends on 1)

The system of claim 1, wherein the privileged execution mode comprises a hypervisor mode of the processing device, and wherein the one or more second instructions are comprised by a hypervisor.

### Claim 9 (depends on 1)

The system of claim 1, wherein the privileged execution mode comprises a privileged user-space mode of the processing device, and wherein the one or more second instructions are comprised by an application program.

### Claim 10 (depends on 1)

The system of claim 1, wherein the strong instruction ordering mode comprises a total store ordering mode.

### Claim 11

A method comprising:
executing, by a processing device, one or more first instructions that cause the processing device to enter a privileged execution mode;
switching a memory consistency mode of the processing device to a strong instruction ordering mode; and
executing one or more second instructions in the privileged execution mode, wherein the one or more second instructions are executed using the strong instruction ordering mode.

### Claim 12 (depends on 11)

The method of claim 11, further comprising:
executing one or more third instructions that cause the processing device to exit the privileged execution mode; and
responsive to executing the one or more third instructions, switching the memory consistency mode of the processing device to a relaxed instruction ordering mode.

### Claim 13 (depends on 11)

The method of claim 11, wherein switching the memory consistency mode of the processing device is responsive to executing the one or more first instructions.

### Claim 14 (depends on 11)

The method of claim 11, wherein the one or more first instructions are executed in response to one or more of: a kernel system call, a hardware interrupt, an inter-processor interrupt, a timer interrupt, or a memory fault.

### Claim 15 (depends on 11)

The method of claim 11, wherein the one or more first instructions are executed by application program code, the application program code is associated with an isolated address space, and switching the memory consistency mode of the processing device to the strong instruction ordering mode is responsive to an instruction of the application program code attempting to access a memory location having an address outside the isolated address space.

### Claim 16

A non-transitory machine-readable storage medium storing instructions that cause a processing device to perform operations comprising:
executing one or more first instructions that cause the processing device to enter a privileged execution mode;
switching a memory consistency mode of the processing device to a strong instruction ordering mode; and
executing one or more second instructions in the privileged execution mode, wherein the one or more second instructions are executed using the strong instruction ordering mode.

### Claim 17 (depends on 16)

The non-transitory machine-readable storage medium of claim 16, the operations further comprising:
executing one or more third instructions that cause the processing device to exit the privileged execution mode; and
responsive to executing the one or more third instructions, switching the memory consistency mode of the processing device to a relaxed instruction ordering mode.

### Claim 18 (depends on 16)

The non-transitory machine-readable storage medium of claim 16, wherein switching the memory consistency mode of the processing device is responsive to executing the one or more first instructions.

### Claim 19 (depends on 16)

The non-transitory machine-readable storage medium of claim 16, wherein the one or more first instructions are executed in response to one or more of: a kernel system call, a hardware interrupt, an inter-processor interrupt, a timer interrupt, or a memory fault.

### Claim 20 (depends on 16)

The non-transitory machine-readable storage medium of claim 16, wherein the one or more first instructions are executed by application program code, the application program code is associated with an isolated address space, and switching the memory consistency mode of the processing device to the strong instruction ordering mode is responsive to an instruction of the application program code attempting to access a memory location having an address outside the isolated address space.
