Summary of the invention
The invention provides a kind of sensing method for abnormal status of interrupt pins, to detect the interrupt pins of abnormal.
The present invention proposes a kind of sensing method for abnormal status of interrupt pins, is suitable for a computer system.Sensing method for abnormal status comprises: inquire about senior configuration and power interface (Advanced Configuration AndPower Interface, ACPI) form, with the interruption status position of each interrupt pins of obtaining computer system; Within a set time, check always whether each interruption status position is maintained a particular value always; When wherein the interruption status position of an interrupt pins is maintained above-mentioned particular value always within the set time, judge this interrupt pins abnormal.
In one embodiment of this invention, above-mentioned before the step of inquiry ACPI form, whether the utilization rate that also can judge first central processing unit arrives a threshold value, and when arriving threshold value with the utilization rate at central processing unit, inquiry ACPI form is to carry out the step of the unusual interrupt pins of follow-up detecting.
In one embodiment of this invention, the step of above-mentioned inquiry ACPI form can be inquired about the register address of each interrupt pins, with according to register address, obtains corresponding interruption status position.In addition, also can obtain according to the ACPI form the regional pin number of each interrupt pins.
In one embodiment of this invention, after the above-mentioned step judging the interrupt pins abnormal, can be a universe pin number with the regional pin number translated of the interrupt pins of abnormal.Then, obtain the corresponding device name of interrupt pins of abnormal according to universe pin number.Afterwards, the device name of the interrupt pins of recording exceptional, regional pin number and corresponding I/O APIC identification code.In addition, after judging the interrupt pins abnormal, also can point out an abnormal information.
In one embodiment of this invention, the device name of above-mentioned correspondence also can be obtained by driver corresponding to interrupt pins.
In one embodiment of this invention, above-mentioned sensing method for abnormal status also comprises the interrupt pins of forbidden energy abnormal.
In one embodiment of this invention, above-mentioned ACPI form comprises compound advanced programmable interrupt controller description list (Multiple APIC Description Table, MADT), compartment system description list (Differentiated System Description Table, DSDT) and fixing senior configuration and power interface description list (Fixed ACPI Description Table, FACP).
Based on above-mentioned, the present invention is by the difference of detection interrupt pins, and the device name of listing unusual interrupt pins and using this interrupt pins.Accordingly, can be with unusual interrupt pins forbidden energy so that the utilization rate of central processing unit recovers normal.And the developer can find out the problem points of abnormal and then with its reparation by the path that measures interrupt pins.
For above-mentioned feature and advantage of the present invention can also be become apparent, the below is especially exemplified by embodiment, and the cooperation accompanying drawing is described in detail below.
Embodiment
Under operating system, if not carrying out other software when central processing unit almost always is near 100% utilization rate, the user must guess that what reason to cause central processing unit by is busy condition by its experience.For this reason, the present invention proposes a kind of sensing method for abnormal status of interrupt pins, by detecting whether abnormal of interrupt pins, goes out side by side the interrupt pins of abnormal and uses the device name of this interrupt pins.In order to make content of the present invention also for understanding, below the example that really can implement according to this as the present invention especially exemplified by embodiment.
For convenience of description, in following examples, for example be by an application software being installed to the storage unit of computer system, to carry out the sensing method for abnormal status of interrupt pins.This application software for example is to utilize C language, Java language supervisor language to write, to finish the sensing method for abnormal status of interrupt pins by the mode of automatic electronic.So do not limit to its range of application with this at this.
Fig. 1 is the process flow diagram of sensing method for abnormal status of the interrupt pins of one embodiment of the invention.The present embodiment is for the interrupt pins of detecting computer system abnormal whether.In the present embodiment, the operating system of computer system is to move under Advanced Programmable Interrupt Controllers APICs (Advanced Programmable InterruptController, APIC) pattern.At this, the central processing unit internal configurations of computer system has local APIC (Local APIC) unit, has in addition input and output APIC (I/O APIC) unit, process the interrupting information that input-output unit sends by I/O APIC unit, and Local APIC and I/O APIC then has respectively identification code separately.For example, suppose that computer system has two Local APIC and two I/O APIC, then its identification code is respectively 0~3.
Please refer to Fig. 1, at first, in step S105, inquire about senior configuration and power interface (AdvancedConfiguration And Power Interface, ACPI) form, with the interruption status position of each interrupt pins of obtaining computer system.In the present embodiment, the ACPI form comprises compound advanced programmable interrupt controller description list (Multiple APIC Description Table, MADT), compartment system description list
(Differentiated System Description Table, DSDT) and fixing senior configuration and power interface description list (Fixed ACPI Description Table, FADT).
Wherein, MADT comprises the address of memory mapped formula input and output (Memory-Mapped I/O, MMIO) of each I/O APIC and the identification code of I/O APIC.FADT comprises the universe pin number (global pinnumber) of system's control look-at-me (System Control Interrupt, SCI).DSDT comprises the corresponding device name of each interrupt pins.
At this, can obtain by inquiry MADT the MMIO address of each I/O APIC in the computer system, obtain respectively more regional pin number and the interruption status position of all interrupt pins on each I/O APIC by MMIO.Wherein, each interrupt pins has the register address of a correspondence, to deposit the interruption status position.For example, when the interruption mode bit is 0, represent that this interrupt pins is idle state (idle status) at present; When the interruption mode bit is 1, represent that this interrupt pins is pending status (pending status) at present.
Need to prove, when central processing unit is in busy condition when not carrying out any software, begin to carry out the sensing method for abnormal status of the present embodiment.For example, when operating system was not carried out other softwares, whether the utilization rate of judging central processing unit arrived a threshold value (for example, 90% or near 100%, can be set up on their own by the user).If operating system is not carried out other softwares, and the utilization rate of central processing unit has arrived above-mentioned threshold value, then expression abnormality may occur at present, therefore, begins to carry out the sensing method for abnormal status of the present embodiment, finds out according to this unusual interrupt pins.
Then, after obtaining the interruption status position of each interrupt pins, shown in step S110, within one period set time, check always whether each interruption status position is maintained a particular value always, judge according to this whether abnormal of corresponding interrupt pins.That is to say, sequentially check whether abnormal of each interrupt pins.
When the interruption mode bit is maintained above-mentioned particular value always within the set time, shown in step S115, judge the interrupt pins abnormal of this interruption status position correspondence.Otherwise, when the interruption mode bit changes (for example, the interruption status position is cleared), shown in step S120, judge the interrupt pins no exceptions of this interruption status position correspondence within the set time.
Generally speaking, if interrupt pins transmits look-at-me and triggers central processing unit, just then driver corresponding to this look-at-me can begin to carry out to serve this look-at-me.Under rational state, after through one period set time, (represent that this look-at-me is serviced complete), the interruption status position can be cleared.Therefore, if within one period set time, the interruption status position continues to maintain under the particular value (for example being 1) always, is irrational state.So situation may be that the look-at-me that corresponding device sends is unreasonable, or hardware connection mistake and cause interrupt pins constantly to send look-at-me.
For instance, the above-mentioned set time can be set as 0.5 second.When the interruption mode bit was 1 always in 0.5 second, the look-at-me that represents this interrupt pins can't be serviced, therefore judges the interrupt pins abnormal of this interruption status position correspondence.
Below for an embodiment treatment scheme after judging the interrupt pins abnormal is described again.Fig. 2 is the process flow diagram of the recording exceptional interrupt pins method of one embodiment of the invention.Please refer to Fig. 2, shown in step S205, after checking out unusual interrupt pins, is universe pin number (global pin number) with the regional pin number translated of unusual interrupt pins.Because the described interrupt vector table of the DSDT ASL code use of ACPI is universe pin number, therefore in order to make things convenient for subsequent treatment, be universe pin number with regional pin number translated just.
For instance, Fig. 3 is the schematic diagram of the computer system of one embodiment of the invention.In the present embodiment, peripheral element interface (Peripheral Component Interface, PCI) device is that PCI device 310 is connected to respectively I/O APIC unit 330 and I/O APIC unit 340 with PCI device 320.And PCI device 310 is connected to PCI bridge (PCI Bridge) 370 with PCI device 320.Chip 350 is connected to I/O APIC unit 330 with system timer 360.At this, I/O APIC unit 330 is respectively 2 and 3 with the identification code of I/O APIC unit 340.Identification code is each interrupt pins of 2 I/O APIC unit 330, and its universe pin number namely equals regional pin number; And identification code is each interrupt pins of 3 I/O APIC unit 340, and its universe pin number namely is that identification code is that the pin number of 2 I/O APIC unit adds each regional pin number, and is as shown in the table.
Afterwards, in step S210, obtain corresponding device name according to universe pin number.For example, inquiry DSDT is to obtain the device name of unusual interrupt pins according to universe pin number.And DSDT designs according to high level architecture power interface source language (ACPI Source Language, ASL) code.Can learn by DSDT which interrupt pins by which device is used at present.
Need to prove, if be Non-Plug and Play (Non Plug and Play, Non-PnP) device (for example system timer) can pass through its hardware identification code (hardware identification, HID) and obtain corresponding device name.In addition, if PnP device (for example PCI device), can obtain its device name with device identification code and manufacturer's identification code on its peripheral element interface configuration space (PCI configuration space, PCI=Peripheral ComponentInterface).In addition, if these devices have corresponding driver, then can obtain more accurate device name by driver.
For instance, Fig. 4 A and Fig. 4 B are the part schematic diagram of the ASL code of one embodiment of the invention.Wherein, Fig. 4 A be PCI device 310, PCI device 320 in the relevant information of the interrupt pins of ASL code, Fig. 4 B is that system timer 360 is in the relevant information of the interrupt pins of ASL code.
In Fig. 4 A, with universe pin number 26 (being the interrupt pins 2 of I/O APIC unit 340), its information corresponding in DSDT be " Package () { 0x0005FFFF; 0; 0; 26} ", and wherein " 0x0005 " is the PCI device and numbers (PCI device number).Just can obtain device identification code and manufacturer's identification code on its peripheral element interface configuration space (PCI configuration space) by pci bus numbering (PCI Busnumber), PCI device numbering (PCI device number), just can obtain again manufacturer and the device name of PCI device 320 by manufacturer's identification code and device identification code.
In Fig. 4 B, " IRQNoFlags () { 0} " represents universe pin number 0, the namely regional pin number 0 of I/O APIC unit 330.Wherein, " Name (_ HID, EISAID (" PNP0100 ")) " recorded HID, is " PNP0100 ".Accordingly, just can obtain the device name of system timer 360 by HID.
In addition, need to prove, also can inquire about the universe pin number that FADT obtains SCI, can learn by this whether by the SCI Anomalies Caused.In other words, when being checked through interrupt pins INT 9 abnormal of I/O APIC unit 330, by the inquiry FADT can learn that INT 9 receives SCI, but accordingly just decision-making system unusually may be since SCI cause.
Afterwards, return Fig. 2, in step S215, the information of the interrupt pins of recording exceptional, for example, the identification code of device name, regional pin number and I/O APIC unit is with the reference of safeguarding as the user.In addition, also can point out an abnormal information to notify the present system of user abnormality to occur.
At last, in step S220, with the interrupt pins forbidden energy of abnormal.For instance, also comprise mask (mask) position in register address corresponding to each interrupt pins.Wherein, masked bits is 0 o'clock, represents that the look-at-me that this interrupt pins triggers can send out; Masked bits is 1 o'clock, represents that this interrupt pins is forbidden energy, and can't transmit any look-at-me.Accordingly, detect unusual interrupt pins after, just masked bits can be set as 1, with this interrupt pins of forbidden energy.Thus, System Operation is just recovered normal.
In sum, the present invention is by the difference of detection interrupt pins, and the device name of listing unusual interrupt pins and using this interrupt pins.Accordingly, can find fast unusual interrupt pins, with unusual interrupt pins forbidden energy so that the utilization rate of central processing unit recovers normal.And the developer can find out the problem points of abnormal and then with its reparation effectively by the path that measures interrupt pins.
It should be noted that at last: above embodiment only in order to technical scheme of the present invention to be described, is not intended to limit; Although with reference to previous embodiment the present invention is had been described in detail, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment puts down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the spirit and scope of various embodiments of the present invention technical scheme.