CN108897702A - A kind of method and system for verifying memory availability - Google Patents
A kind of method and system for verifying memory availability Download PDFInfo
- Publication number
- CN108897702A CN108897702A CN201810744942.9A CN201810744942A CN108897702A CN 108897702 A CN108897702 A CN 108897702A CN 201810744942 A CN201810744942 A CN 201810744942A CN 108897702 A CN108897702 A CN 108897702A
- Authority
- CN
- China
- Prior art keywords
- memory
- dev
- read
- mmap
- mapped
- 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.)
- Withdrawn
Links
- 238000000034 method Methods 0.000 title claims abstract description 35
- 230000006870 function Effects 0.000 claims description 19
- 230000006399 behavior Effects 0.000 claims 1
- 238000013507 mapping Methods 0.000 abstract description 10
- 238000004590 computer program Methods 0.000 description 7
- 230000000694 effects Effects 0.000 description 3
- 238000005516 engineering process Methods 0.000 description 3
- 238000012795 verification Methods 0.000 description 3
- 238000004891 communication Methods 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 239000013307 optical fiber Substances 0.000 description 2
- 238000012545 processing Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000011161 development Methods 0.000 description 1
- 238000005265 energy consumption Methods 0.000 description 1
- 230000002708 enhancing effect Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/08—Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
- G06F12/10—Address translation
- G06F12/1027—Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB]
- G06F12/1045—Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB] associated with a data cache
- G06F12/1054—Address translation using associative or pseudo-associative address translation means, e.g. translation look-aside buffer [TLB] associated with a data cache the data cache being concurrently physically addressed
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
Abstract
The invention discloses a kind of methods for verifying memory availability, the described method comprises the following steps:Obtain the start physical address of memory;Opening/dev/mem device file;Described/dev/mem device file is mapped in the memory;And it addresses on the address space of the memory to carry out memory read-write operation.The present invention sets up the channel of direct read/write physical memory by mapping/dev/mem, it allows users to directly access physical memory, efficiency is improved, especially in isomery mixing memory system, the advantage of isomery mixing memory system can be played by efficiently verifying Nonvolatile memory availability.
Description
Technical field
The present invention relates to memory verification technique fields, more specifically, particularly relating to a kind of method for verifying memory availability
And system.
Background technique
With the fast development of internet, data volume increases severely, and big data processing is to memory speed, capacity, energy consumption and reliable
Property aspect propose very high demand.Traditional DRAM medium faces enormous challenge in terms of handling big data.With non-easy
The appearance of the property lost memory, the novel isomery mixing memory system for extending calculator memory are got the attention.It is novel non-easy
The property lost memory has the characteristics that non-volatile, low-power consumption, fireballing relative to disk read-write, in isomery mixing memory system
Reason big data can improve efficiency.But in isomery mixing memory system, verifying Nonvolatile memory NVM availability is very necessary
, NVM is available only in isomery mixing memory system, and competence exertion goes out the advantage of isomery mixing memory system.
However, not yet disclosing the technical solution that can efficiently verify Nonvolatile memory availability in the prior art.
Summary of the invention
In view of this, the purpose of the embodiment of the present invention is to propose a kind of method and system for verifying memory availability, lead to
The channel that mapping/dev/mem sets up direct read/write physical memory is crossed, allows users to directly access physical memory, improve
Efficiency, especially in isomery mixing memory system, efficiently it is mixed can to play isomery for verifying Nonvolatile memory availability
Close the advantage of memory system.
Based on above-mentioned purpose, the one side of the embodiment of the present invention provides a kind of method for verifying memory availability, including
Following steps:
Obtain the start physical address of memory;
Opening/dev/mem device file;
General/dev/mem device file is mapped in memory;And
Addressing is on the address space of memory to carry out memory read-write operation.
In some embodiments, pass through the start physical address of dmesg acquisition of information memory.
In some embodiments, it is mapped in memory by shared drive mode general/dev/mem device file.
In some embodiments, it is mapped in memory by shared drive mode general/dev/mem device file and includes:
Mmap parameter is set and is mapped in memory using mmap parameter by mmap function general/dev/mem device file.
In some embodiments, mmap parameter includes PROT_READ, PROT_WRITE, MAP_SHARED and memory
Base address parameter.
In some embodiments, it is addressed on the address space of memory to carry out memory read-write operation and include:In memory
Address space on scan 64byte every 256Mbyte and carry out memory read-write operation.
The another aspect of the embodiment of the present invention additionally provides a kind of system for verifying memory availability, including:For obtaining
The module of the start physical address of memory;It is used to open/the module of dev/mem device file;For general/dev/mem equipment text
Part is mapped to the module in memory;With carry out the module of memory read-write operation for addressing on the address space of memory.
In some embodiments, for described/dev/mem device file to be mapped to the configuration of the module in the memory
At:Mmap parameter is set and is mapped in memory using mmap parameter by mmap function general/dev/mem device file.
In some embodiments, mmap parameter includes PROT_READ, PROT_WRITE, MAP_SHARED and memory
Base address parameter.
In some embodiments, match for being addressed on the address space of memory to carry out the module of memory read-write operation
It is set to:64byte is scanned to carry out memory read-write operation every 256Mbyte on the address space of memory.
The present invention has following advantageous effects:It is provided in an embodiment of the present invention verifying memory availability method and be
System, by the starting memory physical address for obtaining memory;Opening/dev/mem device file;The mapping of general/dev/mem device file
Into memory;And the technical solution that memory is written and read directly is accessed, it can be set up directly by mapping/dev/mem
The channel for connecing read-write physical memory, allows users to directly access physical memory, improves efficiency, especially in isomery mixing
In deposit system, the advantage of isomery mixing memory system can be played by efficiently verifying Nonvolatile memory availability.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is the schematic flow chart according to the method for the verifying memory availability of one embodiment of the invention;
Fig. 2 is the schematic block diagram according to the system of the verifying memory availability of one embodiment of the invention;
Specific embodiment
To make the objectives, technical solutions, and advantages of the present invention clearer, below in conjunction with specific embodiment, and reference
The embodiment of the present invention is further described in attached drawing.
Based on above-mentioned purpose, the first aspect of the embodiment of the present invention proposes a kind of method for verifying memory availability
One embodiment.Shown in fig. 1 is the schematic flow chart of this method.
As shown in fig. 1, this method may comprise steps of:
Step S101 obtains the start physical address of memory;
Step S102, using read-write mode opening/dev/mem device file, open it is, for example, possible to use open function/
Dev/mem device file;
Step S103, general/dev/mem device file is mapped in memory;And
Step S104, addressing is on the address space of memory to carry out memory read-write operation.
In a preferred embodiment, pass through the start physical address of dmesg acquisition of information memory.
In a preferred embodiment, it is mapped in memory by shared drive mode general/dev/mem device file, also
That is, mmap parameter is arranged and is mapped in memory using mmap parameter by mmap function general/dev/mem device file.
In a preferred embodiment, mmap parameter may include PROT_READ, PROT_WRITE, MAP_SHARED with
And memory base address parameter.Wherein, PROT_READ indicates that mapping area can be read, and PROT_WRITE indicates that mapping area can
It is written into, MAP_SHARED expression can replicate in back into file the write-in data of mapping area, and allow to map this document
Other processes are shared.
In a preferred embodiment, it is addressed on the address space of memory to carry out memory read-write operation and include:Inside
64byte is scanned to carry out memory read-write operation every 256Mbyte on the address space deposited.Specifically, it is operated by compilation
Movq and movnti carries out cache copy and flush operation to shared drive, is finally replicated using memcpy function to memory,
Complete memory read-write verification operation.
It should be noted that those of ordinary skill in the art will appreciate that realizing the whole in above-described embodiment method or portion
Split flow can instruct related hardware to complete by computer program, and it is computer-readable that the program can be stored in one
It takes in storage medium, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage
Medium can be magnetic disk, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random
Access Memory, RAM) etc..It is real to can achieve corresponding aforementioned any means for the embodiment of the computer program
Apply the identical or similar effect of example.
In addition, disclosed method is also implemented as the computer program executed by CPU according to embodiments of the present invention, it should
Computer program may be stored in a computer readable storage medium.When the computer program is executed by CPU, the present invention is executed
The above-mentioned function of being limited in method disclosed in embodiment.
Based on above-mentioned purpose, the second aspect of the embodiment of the present invention proposes a kind of system for verifying memory availability
200 one embodiment.Fig. 2 is the schematic block diagram of the system 200.As shown in Figure 2, which may include:For
Obtain the module 201 of the start physical address of memory;It is used to open/the module 202 of dev/mem device file, can be configured
At:Using read-write mode opening/dev/mem device file, it is, for example, possible to use open function opening/dev/mem equipment texts
Part;For described/dev/mem device file to be mapped to the module 203 in the memory;And on the ground of the memory
Location spatially addresses to carry out the module 204 of memory read-write operation.
In a preferred embodiment, pass through the start physical address of dmesg acquisition of information memory.
In a preferred embodiment, for described/dev/mem device file to be mapped to the module in the memory
203 can be configured to:Mmap parameter is set and is mapped to using mmap parameter by mmap function general/dev/mem device file
In memory.
In a preferred embodiment, mmap parameter may include PROT_READ, PROT_WRITE, MAP_SHARED with
And memory base address parameter.Wherein, PROT_READ indicates that mapping area can be read, and PROT_WRITE indicates that mapping area can
It is written into, MAP_SHARED expression can replicate in back into file the write-in data of mapping area, and allow to map this document
Other processes are shared.
In a preferred embodiment, memory read-write operation is carried out for addressing on the address space of the memory
Module 204 can be configured to:64byte is scanned to carry out memory read-write operation every 256Mbyte on the address space of memory.
Specifically, cache copy and flush operation are carried out to shared drive by compilation operation movq and movnti, finally used
Memcpy function replicates memory, completes memory read-write verification operation.
It is important to note that the embodiment of above system uses the embodiment of the above method to illustrate each mould
The course of work of block, those skilled in the art can be it is readily conceivable that other by these module applications to the method be implemented
In example.
It is emphasized that the method and system of verifying memory availability proposed by the present invention is not only suitable in non-volatile
It deposits NVM and is also applied for volatile ram, the memory being not only suitable in mixing memory system is also applied in existing for single form
It deposits, on condition that needing to know the initial physical addresses information of memory to be verified.However, due in isomery mixing memory system,
Verifying supports Nonvolatile memory NVM to be very important, and NVM is available only in isomery mixing memory system, competence exertion
The advantage of isomery mixing memory system out, therefore the method and system of verifying memory availability proposed by the present invention is in verifying isomery
Better effect is obvious in terms of mixing the availability of the NVM in memory system.
In addition, typically, it can be various electric terminal equipments, example that the embodiment of the present invention, which discloses described system, equipment etc.,
Such as mobile phone, personal digital assistant (PDA), tablet computer (PAD), smart television, are also possible to large-scale terminal device, such as service
Device etc., therefore protection scope disclosed by the embodiments of the present invention should not limit as certain certain types of system, equipment.
In addition, above method step and system unit or module also can use controller and for storing so that controlling
Device processed realizes that the computer readable storage medium of above-mentioned steps or unit or the computer program of functions of modules is realized.
In addition, it should be appreciated that computer readable storage medium (for example, memory) as described herein can be it is volatile
Property memory or nonvolatile memory, or may include both volatile memory and nonvolatile memory.As example
And not restrictive, nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable to son
ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory.Volatile memory may include arbitrary access
Memory (RAM), the RAM can serve as external cache.As an example and not restrictive, RAM can be with more
Kind form obtains, such as synchronous random access memory (DRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate SDRAM
(DDR SDRAM), enhancing SDRAM (ESDRAM), synchronization link DRAM (SLDRAM) and directly Rambus RAM (DRRAM).
The storage equipment of disclosed aspect is intended to the memory of including but not limited to these and other suitable type.
Those skilled in the art will also understand is that, various illustrative logical blocks, mould in conjunction with described in disclosure herein
Block, circuit and algorithm steps may be implemented as the combination of electronic hardware, computer software or both.It is hard in order to clearly demonstrate
This interchangeability of part and software, with regard to various exemplary components, square, module, circuit and step function to its into
General description is gone.This function is implemented as software and is also implemented as hardware depending on concrete application and application
To the design constraint of whole system.Those skilled in the art can realize described in various ways for every kind of concrete application
Function, but this realization decision should not be interpreted as causing a departure from range disclosed by the embodiments of the present invention.
Various illustrative logical blocks, module and circuit, which can use, in conjunction with described in disclosure herein is designed to
The following component of function described here is executed to realize or execute:General processor, digital signal processor (DSP), dedicated collection
At circuit (ASIC), field programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic, divide
Any combination of vertical hardware component or these components.General processor can be microprocessor, but alternatively, processing
Device can be any conventional processors, controller, microcontroller or state machine.Processor also may be implemented as calculating equipment
Combination, for example, the combination of DSP and microprocessor, multi-microprocessor, one or more microprocessors combination DSP and/or any
Other this configurations.
The step of method in conjunction with described in disclosure herein or algorithm, can be directly contained in hardware, be held by processor
In capable software module or in combination of the two.Software module may reside within RAM memory, flash memory, ROM storage
Device, eprom memory, eeprom memory, register, hard disk, removable disk, CD-ROM or known in the art it is any its
In the storage medium of its form.Illustrative storage medium is coupled to processor, enables a processor to from the storage medium
Information is written to the storage medium in middle reading information.In an alternative, the storage medium can be with processor collection
At together.Pocessor and storage media may reside in ASIC.ASIC may reside in user terminal.It is replaced at one
In scheme, it is resident in the user terminal that pocessor and storage media can be used as discrete assembly.
In one or more exemplary designs, the function can be real in hardware, software, firmware or any combination thereof
It is existing.If realized in software, can be stored in using the function as one or more instruction or code computer-readable
It is transmitted on medium or by computer-readable medium.Computer-readable medium includes computer storage media and communication media,
The communication media includes any medium for helping for computer program to be transmitted to another position from a position.Storage medium
It can be any usable medium that can be accessed by a general purpose or special purpose computer.As an example and not restrictive, the computer
Readable medium may include RAM, ROM, EEPROM, CD-ROM or other optical disc memory apparatus, disk storage equipment or other magnetic
Property storage equipment, or can be used for carry or storage form be instruct or data structure required program code and can
Any other medium accessed by general or specialized computer or general or specialized processor.In addition, any connection is ok
It is properly termed as computer-readable medium.For example, if using coaxial cable, optical fiber cable, twisted pair, digital subscriber line
(DSL) or such as wireless technology of infrared ray, radio and microwave to send software from website, server or other remote sources,
Then above-mentioned coaxial cable, optical fiber cable, twisted pair, DSL or such as wireless technology of infrared ray, radio and microwave are included in
The definition of medium.As used herein, disk and CD include compact disk (CD), laser disk, CD, digital versatile disc
(DVD), floppy disk, Blu-ray disc, wherein disk usually magnetically reproduce data, and CD using laser optics reproduce data.On
The combination for stating content should also be as being included in the range of computer-readable medium.
It is exemplary embodiment disclosed by the invention above, the disclosed sequence of the embodiments of the present invention is just to retouching
It states, does not represent the advantages or disadvantages of the embodiments.It should be noted that the discussion of any of the above embodiment is exemplary only, it is not intended that
Imply that range disclosed by the embodiments of the present invention (including claim) is limited to these examples, what is limited without departing substantially from claim
Under the premise of range, it may be many modifications and modify.According to the claim to a method of open embodiment described herein
Function, step and/or movement are not required to the execution of any particular order.In addition, although element disclosed by the embodiments of the present invention can be with
It is described or is required in the form of individual, but be unless explicitly limited odd number, it is understood that be multiple.
Claims (10)
1. a kind of method for verifying memory availability, which is characterized in that the described method comprises the following steps:
Obtain the start physical address of memory;
Opening/dev/mem device file;
Described/dev/mem device file is mapped in the memory;And
Addressing is on the address space of the memory to carry out memory read-write operation.
2. the method according to claim 1, wherein passing through the starting of memory described in dmesg acquisition of information
Physical address.
3. the method according to claim 1, wherein will described/dev/mem equipment text by shared drive mode
Part is mapped in the memory.
4. according to the method described in claim 3, it is characterized in that, will described/dev/mem equipment text by shared drive mode
Part is mapped in the memory:Mmap parameter is set and passes through mmap function for described/dev/ using the mmap parameter
Mem device file is mapped in the memory.
5. according to the method described in claim 4, it is characterized in that, the mmap parameter includes PROT_READ, PROT_
WRITE, MAP_SHARED and memory base address parameter.
6. the method according to claim 1, wherein addressing is on the address space of the memory to carry out memory
Read-write operation includes:64byte is scanned to carry out memory read-write behaviour every 256Mbyte on the address space of the memory
Make.
7. a kind of system for verifying memory availability, which is characterized in that the system comprises:
For obtaining the module of the start physical address of memory;
It is used to open/the module of dev/mem device file;
For described/dev/mem device file to be mapped to the module in the memory;And
The module of memory read-write operation is carried out for addressing on the address space of the memory.
8. system according to claim 7, which is characterized in that described for described/dev/mem device file to be mapped to
Module in the memory is configured to:Mmap parameter is set and passes through mmap function for described/dev/ using the mmap parameter
Mem device file is mapped in the memory.
9. system according to claim 8, which is characterized in that the mmap parameter includes PROT_READ, PROT_
WRITE, MAP_SHARED and memory base address parameter.
10. system according to claim 7, which is characterized in that described for being addressed on the address space of the memory
It is configured to carry out the module of memory read-write operation:It is scanned on the address space of the memory every 256Mbyte
64byte carries out memory read-write operation.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810744942.9A CN108897702A (en) | 2018-07-09 | 2018-07-09 | A kind of method and system for verifying memory availability |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810744942.9A CN108897702A (en) | 2018-07-09 | 2018-07-09 | A kind of method and system for verifying memory availability |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108897702A true CN108897702A (en) | 2018-11-27 |
Family
ID=64348686
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810744942.9A Withdrawn CN108897702A (en) | 2018-07-09 | 2018-07-09 | A kind of method and system for verifying memory availability |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108897702A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110442471A (en) * | 2019-08-01 | 2019-11-12 | 苏州浪潮智能科技有限公司 | Method, equipment and the medium of memory information in a kind of detection network system |
CN113626272A (en) * | 2021-08-27 | 2021-11-09 | 广东九联科技股份有限公司 | Memory read-write rate testing method, device and system based on mmap system |
-
2018
- 2018-07-09 CN CN201810744942.9A patent/CN108897702A/en not_active Withdrawn
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110442471A (en) * | 2019-08-01 | 2019-11-12 | 苏州浪潮智能科技有限公司 | Method, equipment and the medium of memory information in a kind of detection network system |
CN110442471B (en) * | 2019-08-01 | 2023-01-06 | 苏州浪潮智能科技有限公司 | Method, device and medium for detecting memory information in network system |
CN113626272A (en) * | 2021-08-27 | 2021-11-09 | 广东九联科技股份有限公司 | Memory read-write rate testing method, device and system based on mmap system |
CN113626272B (en) * | 2021-08-27 | 2024-02-20 | 广东九联开鸿科技发展有限公司 | Memory read-write rate testing method, device and system based on mmap system |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8788741B2 (en) | Method and apparatus adapted to prevent code data from being lost in solder reflow | |
US20180158527A1 (en) | Volatile memory architecutre in non-volatile memory devices and related controllers | |
US10496335B2 (en) | Method and apparatus for performing multi-object transformations on a storage device | |
KR100816761B1 (en) | Memory card system including nand flash memory and sram/nor flash memory and data storage method thereof | |
CN107423387A (en) | The method and apparatus of table is divided in a kind of point storehouse based on middleware | |
CN111538521A (en) | Intelligent contract deployment and transaction method and device | |
CN108897702A (en) | A kind of method and system for verifying memory availability | |
CN110502215A (en) | A kind of construction method, equipment and the storage medium of micro services program | |
CN108932141A (en) | Copy drawing implementation method and device, electronic equipment, storage medium | |
CN105094691A (en) | Data manipulation methods and system, and devices | |
CN107102889B (en) | Virtual machine resource adjusting method and device | |
CN109032993A (en) | A kind of the PCIE board expansion card and its control method of eight road server of binode | |
CN108388461A (en) | A kind of screen picture intercept method and device for firmware | |
US20130339575A1 (en) | Data storage device and data trimming method | |
CN114048169A (en) | Document access method, device, server and storage medium | |
CN108399076A (en) | A kind of firmware update and device based on UEFI | |
CN107807870B (en) | Method and system for testing power-down protection function of storage server mainboard | |
CN109165619A (en) | A kind of processing method of image, device and electronic equipment | |
CN111857571B (en) | Solid state disk physical block address distribution method, device, equipment and storage medium | |
CN109492292A (en) | A kind of method and system automatically generating PCB Component library | |
CN111143258B (en) | Method, system, device and medium for accessing FPGA (field programmable Gate array) by system based on Opencl | |
JP2006011533A (en) | Memory card, semiconductor device, and control method of semiconductor memory | |
CN111143250A (en) | Method, device and medium for accessing FPGA storage unit based on AXI-ST interface | |
CN109344082A (en) | A kind of method and system of automatic scratchpad register | |
CN102902629B (en) | memory space mapping method and device |
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 | ||
WW01 | Invention patent application withdrawn after publication |
Application publication date: 20181127 |
|
WW01 | Invention patent application withdrawn after publication |