CN109976877B - Method, device and storage medium for realizing request by using virtio driver - Google Patents

Method, device and storage medium for realizing request by using virtio driver Download PDF

Info

Publication number
CN109976877B
CN109976877B CN201910221640.8A CN201910221640A CN109976877B CN 109976877 B CN109976877 B CN 109976877B CN 201910221640 A CN201910221640 A CN 201910221640A CN 109976877 B CN109976877 B CN 109976877B
Authority
CN
China
Prior art keywords
descriptor
request
processing
processing information
ring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910221640.8A
Other languages
Chinese (zh)
Other versions
CN109976877A (en
Inventor
王宏辉
刘尧
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ucloud Technology Co ltd
Original Assignee
Ucloud Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ucloud Technology Co ltd filed Critical Ucloud Technology Co ltd
Priority to CN201910221640.8A priority Critical patent/CN109976877B/en
Publication of CN109976877A publication Critical patent/CN109976877A/en
Application granted granted Critical
Publication of CN109976877B publication Critical patent/CN109976877B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Storage Device Security (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, a device and a storage medium for realizing a request by using a virtio driver. The method comprises the following steps: a receiving step of receiving one or more requests; an information generation and storage step, wherein when each request is processed, processing information of a corresponding descriptor is generated, and one or more pieces of processing information of one or more descriptors are obtained and stored; an information acquisition step of acquiring one or more pieces of stored processing information after processing of one or more requests is interrupted; a retrieval step of retrieving an unprocessed descriptor from the one or more descriptors based on the one or more pieces of processing information, and retrieving a current ring index of the available ring based on respective processing information of the unprocessed descriptor; and an indicating step of indicating to process the request corresponding to the unprocessed descriptor in the one or more requests and indicating to process the request corresponding to the descriptor in the available ring from the ring index next to the current ring index.

Description

Method, device and storage medium for realizing request by using virtio driver
Technical Field
The invention relates to a method, a device and a storage medium for realizing a request by using a virtio driver.
Background
The Virtio driver is a driver commonly used in the current virtualization environment, and is used for sending an I/O request in a virtual machine to a storage system at the back end. The virtio driver is divided into two parts, namely a front-end driver part in a guest operating system (guest os) in the virtual machine and a back-end driver part on the host machine, and the front-end driver part generally sends an I/O request to the back-end driver part for processing.
In an actual production environment, the back-end driving part often corresponds to an access end of a complex storage system, has complex business logic, and often needs to be version-upgraded or has a case of unexpected crash (crash). When this happens, the recovery is currently done by restarting the virtual machine. However, this can have a severe impact on user traffic.
Disclosure of Invention
The invention provides a method for realizing a request by using virtio driver, which comprises the following steps:
receiving one or more requests, wherein a descriptor corresponding to each request is recorded in an available ring of the virtio driver;
an information generating and storing step of generating processing information of the corresponding descriptor to obtain and store one or more pieces of processing information of one or more descriptors when each request is processed;
an information acquisition step of acquiring the one or more pieces of processing information stored after processing of the one or more requests is interrupted;
a retrieving step of retrieving an unprocessed descriptor from the one or more descriptors according to the one or more processing information, and retrieving a current ring index of the available ring according to respective processing information of the unprocessed descriptor;
and an indicating step of indicating to process the request corresponding to the unprocessed descriptor in the one or more requests and indicating to process the request corresponding to the descriptor in the available ring from the ring index next to the current ring index.
Wherein each of the one or more processing information includes a processing state of a descriptor, a ring index of the descriptor corresponding in the available ring, and a carry of the corresponding ring index.
Wherein the processing state is a first symbol when the request has been processed or has not begun processing and a second symbol when the request is in process.
In the retrieving step, the descriptor whose processing status is the second symbol is retrieved from the one or more descriptors as the unprocessed descriptor, and the current ring index is retrieved according to the ring index and the carry in the processing information of the unprocessed descriptor.
The invention also provides a device for realizing the request by using virtio drive, which comprises:
the receiving unit is used for receiving one or more requests, and the descriptor corresponding to each request is recorded into the virtual ring driven by the virtio;
an information generating and storing unit that generates processing information of the corresponding descriptor when each request is processed, obtains one or more pieces of processing information of one or more descriptors, and stores the processing information;
an information acquisition unit that acquires the one or more pieces of processing information stored after processing of the one or more requests is interrupted;
a retrieving unit that retrieves an unprocessed descriptor from the one or more descriptors according to the one or more pieces of processing information, and retrieves a current ring index of the available ring according to respective pieces of processing information of the unprocessed descriptor;
and the indicating unit is used for indicating the request corresponding to the unprocessed descriptor in the one or more requests to be processed and indicating the request corresponding to the descriptor in the available ring to be processed from the next ring index of the current ring index.
Wherein each of the one or more processing information includes a processing state of a descriptor, a ring index of the descriptor corresponding in the available ring, and a carry of the corresponding ring index.
Wherein the processing state is a first symbol when the request has been processed or has not begun processing and a second symbol when the request is in process.
The retrieval unit retrieves the descriptor whose processing status is the second symbol from the one or more descriptors as the unprocessed descriptor, and extracts the current ring index according to the ring index and the carry in the processing information of the unprocessed descriptor.
Wherein the apparatus further comprises a processing unit to process the one or more requests.
The present invention also provides a storage medium having stored thereon a program for fulfilling a request using a virtio driver, the program being executed by a computer to implement a method for fulfilling a request using a virtio driver, the program comprising:
receiving an instruction, receiving one or more requests, wherein a descriptor corresponding to each request is recorded in an available ring of the virtio driver;
an information generation and storage instruction, which is used for generating the processing information of the corresponding descriptor when each request is processed, obtaining one or more pieces of processing information of one or more descriptors and storing the processing information;
an information acquisition instruction that acquires the one or more pieces of processing information stored after processing of the one or more requests is interrupted;
a retrieval instruction, retrieving an unprocessed descriptor from the one or more descriptors according to the one or more processing information, and retrieving a current ring index of the available ring according to respective processing information of the unprocessed descriptor;
and the instruction indicates to process the request corresponding to the unprocessed descriptor in the one or more requests and indicates to start processing the request corresponding to the descriptor in the available ring from the ring index next to the current ring index.
By the invention, even if version upgrading is carried out on the back-end driving part or unexpected crash occurs, all requests which are not processed can be continuously processed after restarting, the requests can not be missed or processed repeatedly, quick and automatic recovery is realized, serious influence on user services is avoided, and simultaneously, non-perception thermal upgrading of virtio driving can be realized.
Drawings
FIG. 1 is a block diagram of an apparatus for fulfilling requests using a virtio driver according to an embodiment of the invention;
fig. 2 is a flowchart of a method for implementing a request using a virtio driver according to an embodiment of the present invention.
Detailed Description
Embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
Fig. 1 is a block diagram of an apparatus 1 for fulfilling requests using a virtio driver according to an embodiment of the present invention. The device 1 includes a receiving unit 10, an information generating and storing unit 11, an information acquiring unit 12, a retrieving unit 13, and an instructing unit 14. The device 1 is for example a rear drive part in a virtio drive.
Fig. 2 is a flowchart of a method for implementing a request by using a virtio driver according to an embodiment of the present invention, and as shown in fig. 2, in the receiving step S20, the receiving unit 10 receives one or more requests, and a descriptor corresponding to each request is recorded in an available ring of the virtio driver.
In a virtio drive, the front-end drive sends one or more requests (i.e., I/O requests) to the back-end drive for processing via vring. vring includes descriptor array (desc), available ring (available ring) and used ring (used ring). The descriptor array stores a plurality of descriptors, each descriptor corresponding to a buffer (buffer). Each request corresponds to a descriptor, and the corresponding descriptor is recorded into an available ring.
In the information generation and storage step S21, the information generation and storage unit 11 generates processing information of the corresponding descriptor, obtains one or more pieces of processing information of each of the one or more descriptors, and stores the processing information, as each request is processed.
As shown in fig. 1, the apparatus 1 further comprises a processing unit 15, and the processing unit 15 processes the received one or more requests respectively. When the processing unit 15 starts processing a request, the information generation and storage unit 11 generates processing information of a descriptor corresponding to the request.
Wherein, the processing information of each descriptor includes the processing state of the descriptor, the ring index corresponding to the descriptor in the available ring, and the carry of the corresponding ring index.
The available rings are for example 16-bit with 16 ring indices, for example 0-15. Each descriptor recorded in an available ring corresponds to a ring index. Here, since the 16-bit ring index is easily wrapped around, the carry of the ring index is included in the processing information in order to distinguish the actual size of each ring index.
The processing information for each descriptor is, for example, 32-bit unsigned integer, e.g., represented by bits 0-31, respectively. Wherein, 0 bit represents the processing state of the descriptor, 1-15 bits represent the carry of the ring index corresponding to the descriptor in the available ring, and 16-31 bits represent the ring index corresponding to the descriptor in the available ring. The unsigned integer is a write-once, and the aligned 32-bit unsigned integer write-once can ensure atomicity of the processed information, so that ambiguity caused by non-atomic operation can be avoided.
The processing state is a first symbol, e.g. "0", when the request has been processed by the processing unit 15 or has not yet been started, and a second symbol, e.g. "1", when the request is being processed by the processing unit 15.
That is, the 0 bit of the processing information of each descriptor is "0" indicating that the request corresponding to the descriptor has been processed or has not been processed yet, and the 0 bit of the processing information of each descriptor is "1" indicating that the request corresponding to the descriptor is being processed, that is, has been processed but has not been processed yet. In addition, after the request is processed, 0 bit of the processing information of the descriptor corresponding to the request is set to "0", and then the descriptor corresponding to the request is added to the used ring.
In the process of processing one or more requests by the processing unit 15, when the back-end driving part crashes or needs to be normally exited for upgrading, the processing of the requests is interrupted, and the back-end driving part needs to be restarted in order to continue processing the requests.
In the information acquisition step S22, after the processing of the one or more requests by the processing unit 15 is interrupted, the information acquisition unit 12 acquires the stored one or more pieces of processing information.
Next, in a retrieving step S23, the retrieving unit 13 retrieves unprocessed descriptors from the one or more descriptors according to the one or more pieces of processing information, and retrieves the current ring index of the available ring according to the respective pieces of processing information of the unprocessed descriptors.
Wherein, the retrieving unit 13 retrieves a descriptor whose processing status is the second symbol "1" from one or more descriptors stored in the descriptor array as an unprocessed descriptor. That is, descriptors whose 0 bit of the processing information is "1" are taken out of these descriptors as unprocessed descriptors, such as descriptors d1 and d 5.
Then, the retrieval unit 13 extracts the current ring index from the ring index and the carry in the processing information of each of these unprocessed descriptors. When the carry is different, the ring index corresponding to the carry with the maximum value is taken out as the current ring index, and when the carry is the same, the ring index with the maximum value is taken out as the current ring index. For example, the retrieving unit 13 retrieves 2 unprocessed descriptors d1 and d5, the carry in the processing information of the descriptor d1 is "2", the ring index is "4", the carry in the processing information of the descriptor d5 is "1", and the ring index is "5". Where the carry of the descriptor d1 is greater than the carry of the descriptor d5, so the ring index "4" of the descriptor d1 is taken as the current ring index. That is, the actual size of each ring index can be clearly distinguished by the setting of the carry.
At the instruction step S24, the instruction unit 14 instructs processing of a request corresponding to an unprocessed descriptor among the one or more requests, and instructs processing of a request corresponding to a descriptor in an available ring from a ring index next to the current ring index.
In this example, the processing unit 15 processes, according to the indication of the indicating unit 14, for example, 2 requests corresponding to the descriptors d1 and d5 in one or more requests, so that the processing can be continued for those requests being processed at the time of the interrupt, thereby avoiding missing of unprocessed completed requests. In addition, the processing unit 15 starts processing the request corresponding to the descriptor in the available ring from the next ring index "5" of the current ring index "4", so that the processing can be continued from the next request of the request processed at the time of interruption, thereby avoiding the repeated processing of the processed request.
When the processing unit 15 continues to process the request according to the instruction of the instruction unit 14, the information generation and storage unit 11 generates and stores the processing information for the descriptor corresponding to the processed request, as well.
By the invention, when one or more received requests are processed, even if the processing is interrupted under the condition of version upgrading or unexpected crash of the rear-end driving part, all the requests which are not processed can be continuously processed after restarting, the requests can not be missed or the requests can not be processed repeatedly, the quick and automatic recovery is realized, the serious influence on the user service is avoided, and simultaneously the sensorless thermal upgrading of virtio driving can be realized.
The present invention also provides a storage medium having stored thereon a program for fulfilling a request using a virtio driver, the program being executed by a computer to implement a method for fulfilling a request using a virtio driver, the program comprising:
receiving an instruction, receiving one or more requests, wherein a descriptor corresponding to each request is recorded in an available ring of the virtio driver;
an information generation and storage instruction, which is used for generating the processing information of the corresponding descriptor when each request is processed, obtaining one or more pieces of processing information of one or more descriptors and storing the processing information;
an information acquisition instruction that acquires the one or more pieces of processing information stored after processing of the one or more requests is interrupted;
a retrieval instruction, retrieving an unprocessed descriptor from the one or more descriptors according to the one or more processing information, and retrieving a current ring index of the available ring according to respective processing information of the unprocessed descriptor;
and the instruction indicates to process the request corresponding to the unprocessed descriptor in the one or more requests and indicates to start processing the request corresponding to the descriptor in the available ring from the ring index next to the current ring index.
While the present invention has been described in conjunction with specific embodiments, it is evident that many alternatives, modifications, and variations will be apparent to those skilled in the art in light of the foregoing description. Accordingly, it is intended that such alternatives, modifications, and variations be included within the spirit and scope of the appended claims.

Claims (10)

1. A method for fulfilling requests using virtio drivers, the method comprising:
receiving one or more requests, wherein a descriptor corresponding to each request is recorded in an available ring of the virtio driver;
an information generating and storing step of generating processing information of the corresponding descriptor to obtain and store one or more pieces of processing information of one or more descriptors when each request is processed;
an information acquisition step of acquiring the one or more pieces of processing information stored after processing of the one or more requests is interrupted;
a retrieving step of retrieving an unprocessed descriptor from the one or more descriptors according to the one or more processing information, and retrieving a current ring index of the available ring according to respective processing information of the unprocessed descriptor;
and an indicating step of indicating to process the request corresponding to the unprocessed descriptor in the one or more requests and indicating to process the request corresponding to the descriptor in the available ring from the ring index next to the current ring index.
2. The method of claim 1, wherein each of the one or more processing information includes a processing state of a descriptor, a ring index of the descriptor corresponding in the available ring, and a carry of the corresponding ring index.
3. The method of claim 2, wherein the processing state is a first symbol when a request has been processed or has not begun processing and a second symbol when a request is in process.
4. The method according to claim 3, wherein in the retrieving step, the descriptor whose processing status is the second symbol is retrieved from the one or more descriptors as the unprocessed descriptor, and the current ring index is fetched based on the ring index and the carry in the processing information of each of the unprocessed descriptors.
5. An apparatus for fulfilling requests using a virtio driver, the apparatus comprising:
the receiving unit is used for receiving one or more requests, and the descriptor corresponding to each request is recorded into the virtual ring driven by the virtio;
an information generating and storing unit that generates processing information of the corresponding descriptor when each request is processed, obtains one or more pieces of processing information of one or more descriptors, and stores the processing information;
an information acquisition unit that acquires the one or more pieces of processing information stored after processing of the one or more requests is interrupted;
a retrieving unit that retrieves an unprocessed descriptor from the one or more descriptors according to the one or more pieces of processing information, and retrieves a current ring index of the available ring according to respective pieces of processing information of the unprocessed descriptor;
and the indicating unit is used for indicating the request corresponding to the unprocessed descriptor in the one or more requests to be processed and indicating the request corresponding to the descriptor in the available ring to be processed from the next ring index of the current ring index.
6. The apparatus of claim 5, wherein each of the one or more processing information comprises a processing state of a descriptor, a ring index to which a descriptor corresponds in the available ring, and a carry of the corresponding ring index.
7. The apparatus of claim 6, wherein the processing state is a first symbol when a request has been processed or has not begun processing and a second symbol when a request is in process.
8. The apparatus according to claim 7, wherein said retrieving unit retrieves, from the one or more descriptors, a descriptor whose processing status is the second symbol as the unprocessed descriptor, and retrieves the current ring index based on the ring index and the carry in the processing information of each of the unprocessed descriptors.
9. The apparatus of any of claims 5-8, wherein the apparatus further comprises a processing unit to process the one or more requests.
10. A storage medium on which a program for fulfilling a request using a virtio driver is stored, the program being executed by a computer to implement a method for fulfilling a request using a virtio driver, the program comprising:
receiving an instruction, receiving one or more requests, wherein a descriptor corresponding to each request is recorded in an available ring of the virtio driver;
an information generation and storage instruction, which is used for generating the processing information of the corresponding descriptor when each request is processed, obtaining one or more pieces of processing information of one or more descriptors and storing the processing information;
an information acquisition instruction that acquires the one or more pieces of processing information stored after processing of the one or more requests is interrupted;
a retrieval instruction, retrieving an unprocessed descriptor from the one or more descriptors according to the one or more processing information, and retrieving a current ring index of the available ring according to respective processing information of the unprocessed descriptor;
and the instruction indicates to process the request corresponding to the unprocessed descriptor in the one or more requests and indicates to start processing the request corresponding to the descriptor in the available ring from the ring index next to the current ring index.
CN201910221640.8A 2019-03-22 2019-03-22 Method, device and storage medium for realizing request by using virtio driver Active CN109976877B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910221640.8A CN109976877B (en) 2019-03-22 2019-03-22 Method, device and storage medium for realizing request by using virtio driver

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910221640.8A CN109976877B (en) 2019-03-22 2019-03-22 Method, device and storage medium for realizing request by using virtio driver

Publications (2)

Publication Number Publication Date
CN109976877A CN109976877A (en) 2019-07-05
CN109976877B true CN109976877B (en) 2021-05-04

Family

ID=67080105

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910221640.8A Active CN109976877B (en) 2019-03-22 2019-03-22 Method, device and storage medium for realizing request by using virtio driver

Country Status (1)

Country Link
CN (1) CN109976877B (en)

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7099898B1 (en) * 1999-08-12 2006-08-29 International Business Machines Corporation Data access system
US8667187B2 (en) * 2008-09-15 2014-03-04 Vmware, Inc. System and method for reducing communication overhead between network interface controllers and virtual machines
US9311119B2 (en) * 2012-05-30 2016-04-12 Red Hat, Inc. Reconfiguring virtual machines
CN105468552A (en) * 2014-09-12 2016-04-06 中兴通讯股份有限公司 USB equipment driving method, host and USB equipment
CN104506379B (en) * 2014-12-12 2018-03-23 北京锐安科技有限公司 Network Data Capturing method and system
CN104615495B (en) * 2015-01-28 2018-05-01 上海交通大学 Optimize the method for network throughput in virtual embedded network environment
CN104980438B (en) * 2015-06-15 2018-07-24 中国科学院信息工程研究所 The method and system of digital certificate revocation status checkout in a kind of virtualized environment
CN106970821B (en) * 2016-01-12 2021-02-02 阿里巴巴集团控股有限公司 Method and device for processing I/O request under KVM virtualization
CN105656805B (en) * 2016-01-20 2018-09-25 中国人民解放军国防科学技术大学 A kind of packet receiving method and device based on control block predistribution
CN108183871B (en) * 2017-11-23 2019-03-12 北京三快在线科技有限公司 A kind of virtual switch, virtual switch start method, electronic equipment

Also Published As

Publication number Publication date
CN109976877A (en) 2019-07-05

Similar Documents

Publication Publication Date Title
KR100810015B1 (en) System, management server, reception server, control method, control program, and recording medium
JP2012079130A (en) Debug support program, debug support device and debug support method
US11269902B2 (en) Time series data management method, device, and apparatus
US20210405111A1 (en) Test method and electronic device
JP5682996B2 (en) Client program, terminal, server device, server program, system and method
CN88100953A (en) Handle the method for disk sector error with direct access memory Cache
CN1831777A (en) System and method for managing multiple hot plug operations
CN109491958A (en) Error processing system and error handling method
CN112416338A (en) Code warehouse system based on label
CN112115105A (en) Service processing method, device and equipment
CN109976877B (en) Method, device and storage medium for realizing request by using virtio driver
CN112015476B (en) Display card driving method and device, electronic equipment and storage medium
WO2016078326A1 (en) Method, apparatus and system for displaying names of virtual machine
CN111782269A (en) Interrupt processing method and interrupt processing equipment
US9898490B2 (en) Systems and methods for supporting multiple database server versions on a database machine
US20200356382A1 (en) Application management apparatus, in-vehicle system, and application management method
CN111708288B (en) Data processing method and device, electronic equipment and storage medium
CN114003520A (en) Data transmission method, device, system and medium between host and equipment
CN108595123B (en) Data storage method and device of mobile terminal
CN108804343B (en) Embedded storage interface data transmission method and device, computer equipment and medium
CN108345431B (en) Data reading method and device
WO2004068356A1 (en) Data communication system, data communication method, and data communication program
CN115421804B (en) Data management method, system and device based on KPU unified interface
CN102163168A (en) Recovery method and recovery device of computer system
US9021220B2 (en) Orphan storage release

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant