Method for improving low-speed io of linux kernel

By combining the jailhouse tool and the bare-metal program iodemo.bin, efficient data interaction between the Linux kernel and I2C devices is achieved, solving the inefficiency problem caused by low-speed I/O devices and improving the system's real-time performance and efficiency.

CN115686885BActive Publication Date: 2026-05-08KYLIN CORP
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
KYLIN CORP
Filing Date
2022-11-01
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

The Linux kernel operates inefficiently with low-speed I/O devices. Existing technologies such as synchronous I/O, asynchronous notification, and direct simulation of I2C device timings reduce system efficiency, and data timeouts or loss may occur when the hardware configuration is inappropriate.

Method used

Static partitioning is configured using the jailhouse tool to isolate the last CPU, increase the operating space for I2C devices and shared memory, use the bare-metal program iodemo.bin to send and receive data for I2C devices, and interact with Linux applications through shared memory to configure the depth of send and receive queues, thereby implementing I2C transmission timing and data framing.

Benefits of technology

It improves the I/O efficiency of the Linux kernel, reduces I/O intensive operations, enhances CPU intensive operations, and improves the kernel's real-time performance and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115686885B_ABST
    Figure CN115686885B_ABST
Patent Text Reader

Abstract

The present application relates to a Linux kernel low-speed io efficiency improving method, comprising the following steps: installing a jailhouse tool; performing cell configuration; initializing a Linux application; running an iodemo.bin bare machine; and performing data transceiving.The Linux kernel low-speed io efficiency improving method provided by the present application can run an i2c program (iodemo.bin) independently through the jailhouse tool, and can interact with the Linux through the shared memory mode, greatly reducing the io intensity of the Linux, enhancing the cpu intensity, and improving the kernel real-time performance and efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of operating system performance optimization technology, specifically to a method for improving the efficiency of low-speed I / O in the Linux kernel. Background Technology

[0002] As a monolithic kernel, Linux boasts high performance, but it can also experience inefficiencies due to drivers or kernel code waiting for slow I / O devices. In such cases, I / O efficiency enhancements are crucial.

[0003] In some Linux environments, where there is no I2C hardware, simulating I2C timings in the kernel using GPIO is an extremely inefficient process.

[0004] In kernel I / O technology, some people currently use synchronous I / O techniques, which can schedule processes by putting them to sleep when blocking occurs. Therefore, the Linux scheduler also introduces non-real-time characteristics, and an unreasonable number of threads can also reduce system efficiency.

[0005] Some developers have also used asynchronous notification technology for development, but this method relies on underlying DMA, FIFO and other designs. The support for this hardware mechanism is inherently limited. If the hardware configuration is not sufficient or the settings are unreasonable, FIFO overflow and other phenomena may occur, leading to data timeout or loss.

[0006] Some technicians even simulated the timing of I2C devices directly in the kernel, which greatly reduced the operating efficiency of Linux. Summary of the Invention

[0007] To address the shortcomings of existing technologies, this invention provides a method for improving low-speed I / O efficiency in the Linux kernel, comprising the following steps:

[0008] Step S1: Install jailhouse tools;

[0009] Step S2: Configure the cell by setting the address, size, and console of the virtualization firmware;

[0010] Step S3: Initialize the Linux application;

[0011] Step S4: Run iodemo.bin on bare metal;

[0012] Step S5: Perform data transmission and reception. The Linux application sends and receives data to and from the I2C device through the bare-metal program Iodemo.bin.

[0013] During the installation of the jailhouse tool, a static partitioning environment is set up, and the machine is configured as follows: the hardware supports virtualization extensions and two or more CPU cores, Linux kernel version 4.7 or higher, to support the control mechanism of arm64 virtualization, PSCI support for CPU operations, and a power state control interface provided in firmware to support CPU offline operation.

[0014] Step S2 includes: isolating the last CPU, increasing the link address space and mapping of iodemo.bin, and increasing the I2C device and shared memory operation space. The last CPU to be isolated is determined by the cpumask structure in the Linux kernel, and the CPU corresponding to the lowest bit mask is the last CPU.

[0015] Step S3 includes: running the ELF program app-io on Linux. This program first initializes the shared memory configuration area, configures the I2C transmission timing according to the actual situation of the I2C device, determines whether the shared memory data transmission and reception is based on data frames or byte streams, defines the depth information of the sending queue and receiving queue, and configures the clearing of the sending and receiving queues.

[0016] Step S4 includes: initializing jailhouse and running iodemo.bin using jailhouse enable, cell create, cell load and cell start commands.

[0017] The method for improving low-speed I / O efficiency in the Linux kernel provided by this invention allows the I2C program (iodemo.bin) to run independently using the jailhouse tool and interact with Linux via shared memory, which greatly reduces the I / O intensity of Linux and enhances CPU-intensive operations, thereby improving the real-time performance and efficiency of the kernel. Attached Figure Description

[0018] Figure 1 The implementation logic framework diagram of the method for improving low-speed I / O efficiency in the Linux kernel of this invention. Detailed Implementation

[0019] To gain a better understanding of the technical solution and beneficial effects of the present invention, the technical solution of the present invention and its beneficial effects are described in detail below with reference to the accompanying drawings.

[0020] Please refer to the following: Figure 1The diagram shown illustrates the logical framework of the Linux kernel low-speed I / O efficiency enhancement method of this invention. This invention improves the real-time performance of the Linux system by allowing low-speed I2C devices to operate on parallel and independently running CPUs. The binary program running on the CPU can interact with Linux through shared memory, supports deep FIFO configuration, and supports advanced settings such as data parsing and data framing, thereby improving the I / O efficiency of Linux.

[0021] The shared memory is divided into a configuration area, a sending area, and a receiving area (i.e., a sending queue and a receiving queue). The shared memory configuration area defines the I2C transmission timing and configures whether to frame data according to the timing information, etc. The byte size of the sending and receiving areas is further defined by this information.

[0022] This invention is specifically implemented using the jailhouse tool. The jailhouse tool provides hardware isolation for the CPU, RAM, shared memory, and low-speed I / O devices (I2C), and runs a binary bare-metal program (iodemo.bin) in the partition. This program is responsible for polling the I2C EEPROM for real-time read and write operations. The I2C transmission timing can also be implemented through shared memory configuration, and data interaction with Linux applications (app-io) is achieved through the send and receive queues of shared memory. On the Linux side, relevant drivers and application development are performed based on the shared memory address, and data can be transmitted in batches according to the settings.

[0023] Jailhouse is an open-source static partitioning tool from Siemens that uses cell-based configuration to partition hardware resources. During jailhouse initialization, it shrinks the resources of the root cell based on the configuration information of the non-root cell, thereby achieving hardware resource isolation. After hardware partitioning is complete, iodemo.bin runs on the isolated CPU and memory. This program reads the shared memory configuration area, defines the transmission timing of the I2C device, determines whether to perform packet framing for data reception, whether to parse data frames in the send queue to send byte streams, and limits the depth of the send and receive queues according to the configuration area.

[0024] The specific implementation method is as follows:

[0025] Prepare an aarch64 environment and install CentOS 8.4. Reserve memory space for the jailhouse firmware and iodemo.bin in the kernel boot parameters.

[0026] The specific steps for the testing environment are as follows:

[0027] 1. Install jailhouse tool

[0028] To set up a static partitioning environment, the following machine configuration is required:

[0029] (1) Hardware support for virtualization extensions and two or more CPU cores is required;

[0030] (2) Linux kernel 4.7+, PSCI support for CPU operations, etc.

[0031] 2. Cell Configuration

[0032] The actual partition information is as follows:

[0033] (1) Isolate the last CPU;

[0034] (2) Increase the link address space and mapping of iodemo.bin;

[0035] (3) Add i2c, shared memory operation space, etc.

[0036] 3. Linux application initialization

[0037] The Linux ELF program app-io first initializes the shared memory configuration area, configures the I2C transmission timing according to the actual situation of the I2C device, determines whether the shared memory data transmission and reception are based on data frames or byte streams, defines the depth information of the send queue and receive queue, and configures the clearing of the send and receive queues.

[0038] 4. Run iodemo.bin on bare metal.

[0039] The jailhouse is initialized and iodemo.bin is run using the jailhouse enable, cell create, cell load, cell start … commands. The program first reads the shared memory configuration area, defines the transmission timing of the I2C device, limits the depth of the send and receive queues according to the configuration area, and then enters while(1) … to send and receive data in parallel and independently on the shared memory queue.

[0040] 5. Data transmission and reception

[0041] The iodemo.bin bare-metal program runs in parallel and independently of the Linux app-io application, handling low-speed hardware communication. Meanwhile, the Linux application periodically sends and receives shared memory data, logging this shared memory data.

[0042] This invention allows the i2c program (iodemo.bin) to run independently using the jailhouse tool and interact with Linux via shared memory, greatly reducing Linux's I / O intensity and enhancing CPU-intensive operations, thereby improving kernel real-time performance and efficiency.

[0043] Although the present invention has been described using the above preferred embodiments, it is not intended to limit the scope of protection of the present invention. Any changes and modifications made by those skilled in the art to the above embodiments without departing from the spirit and scope of the present invention shall still fall within the scope of protection of the present invention. Therefore, the scope of protection of the present invention shall be defined by the claims.

Claims

1. A method for improving low-speed I / O efficiency in the Linux kernel, characterized in that, Includes the following steps: Step S1: Install jailhouse tools; Step S2: Configure the cell by setting the address, size, and console of the virtualization firmware; Step S3: Initialize the Linux application; Step S4: Run iodemo.bin on bare metal; Step S5: Perform data transmission and reception. The Linux application sends and receives data from the I2C device through the bare-metal program Iodemo.bin. Step S2 includes: isolating the last CPU, increasing the link address space and mapping of iodemo.bin, and increasing the I2C device and shared memory operation space. The last CPU to be isolated is determined by the cpumask structure in the Linux kernel, and the CPU corresponding to the lowest bit mask is the last CPU. Step S3 includes: running the ELF program app-io on Linux. This program first initializes the shared memory configuration area, configures the I2C transmission timing according to the actual situation of the I2C device, determines whether the shared memory data transmission and reception is based on data frames or byte streams, defines the depth information of the sending queue and receiving queue, and configures the clearing of the sending and receiving queues.

2. The method for improving low-speed I / O efficiency in the Linux kernel as described in claim 1, characterized in that: When installing the jailhouse tool, set up a static partition environment and configure the machine as follows: enable hardware to support virtualization extensions and more than two CPU cores, Linux kernel version 4.7 or higher to support the control mechanism of arm64 virtualization, support PSCI for CPU operations, provide a power state control interface in firmware to support CPU offline operation.

3. The method for improving low-speed I / O efficiency in the Linux kernel as described in claim 1, characterized in that: Step S4 includes: initializing jailhouse and running iodemo.bin using jailhouse enable, cell create, cell load and cell start commands.

Citation Information

Patent Citations

  • Hard isolation implementation architecture

    CN114625426A

  • Memory enclaves using process address space identifiers in a scalable input / output (i / o) virtualization (s-IOV) architecture

    US20190107965A1