Synchronous User Space Execution via Secondary Kernel Stack

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Current systems cannot execute user space functions synchronously from a kernel context, limiting the flexibility and efficiency of operations such as input/output filtering, as signal handlers are asynchronous and restrictive.

Innovation Solution

Implementing an upcall mechanism that allows a kernel to execute user space functions synchronously by initializing a secondary kernel stack, enabling unrestricted execution in user space while preserving the original kernel stack for return, thus allowing for non-blocking system calls and arbitrary user space function calls.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Ease of operation

If signal handlers are used for asynchronous notifications, then the kernel can handle events, but the kernel cannot execute user space functions synchronously at appropriate control flow points

Engineering Contradiction:
Improvekernel control flow flexibilityVSAvoidexecution timing flexibility
Core Design Contradiction:
Ease of operationVSAdaptability or versatility

Solution Approach 1:

The patent introduces a secondary kernel stack as an intermediary mechanism that enables synchronous user space function execution from kernel context. This secondary stack acts as a mediator between the original kernel execution context and user space, allowing the kernel to temporarily switch to user space, execute functions synchronously, and then return to the original kernel context without losing control flow information.

Inventive Principle:
Principle #24Intermediary (Mediator)

2Adaptability or versatility

If a user space function is called from kernel space, then the function can perform user space operations, but the original kernel stack is lost and cannot be easily restored

Engineering Contradiction:
Improveuser space function execution capabilityVSAvoidstack management complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The patent applies preliminary action by saving the original kernel stack pointer before transitioning to user space execution. This pre-saved pointer is stored in a thread-local variable or register, allowing the system to later restore the original kernel context without complex stack manipulation. The secondary kernel stack is then allocated and configured before user space execution begins, ensuring a clean transition path.

Inventive Principle:
Principle #10Preliminary action

Solution Approach 2:

The patent segments the kernel stack into two distinct parts: the original kernel stack and a secondary kernel stack. The original stack is preserved for returning to kernel space, while the secondary stack is used during user space execution. This segmentation allows independent management of each stack, reducing complexity and enabling safe transitions between kernel and user space.

Inventive Principle:
Principle #1Segmentation

3Reliability

If signal handlers are used for event processing, then asynchronous events can be handled, but performance is slower compared to synchronous execution

Engineering Contradiction:
Improveevent handling capabilityVSAvoidoperation speed
Core Design Contradiction:
ReliabilityVSProductivity

Solution Approach 1:

The patent inverts the traditional asynchronous signal handling approach by implementing synchronous user space function execution from kernel context. Instead of having user space functions wait for asynchronous signals, the kernel proactively calls user space functions synchronously at appropriate control flow points. This inversion eliminates the overhead of asynchronous signal handling while maintaining the ability to execute user space code, thereby improving performance.

Inventive Principle:
Principle #13The other way round (Inversion)

Data Source

PatentUS10509673B2Synchronous user space function execution from a kernel context
Publication Date: 2019.12.17 VMWARE INC
  • US10509673B2 patent drawing
  • US10509673B2 patent drawing
  • US10509673B2 patent drawing

AI summary

The approaches described herein implement synchronous execution of a user space operation from a kernel context. A thread, executing on a computing device, initializes a second kernel stack based on a first kernel stack. The computing device executes an operating system having a user space and a kernel space. The thread, executing in kernel space, performs a non-blocking call (e.g., an upcall) to execute an upcall function in user space. The upcall function may further call other user space functions or system calls. The system calls are performed using the second kernel stack. Upon termination of the upcall function, the thread continues execution on the first kernel stack.