Claims
- 1. A method of emulation in a multiprocessor system, comprising:
performing an emulation in which a host multiprocessing system of said multiprocessor system supports a weak consistency model, and the target multiprocessing system of the multiprocessor system supports a strong consistency model.
- 2. The method of claim 1, further comprising:
determining a sharing status of a page, said determining comprising:
determining whether a look-aside mask in a lookup table has more than one bit set; if it is determined that the look-aside mask has more than one bit set, then determining whether a read/write mask field in the lookup table has any bits set; if it is determined that the read/write mask has any bits set, then setting the status to a “shared write”; and if it is determined that the read/write mask does not have any bits set, then setting the status to a “shared read”.
- 3. The method of claim 2, wherein said determining further comprises:
if it is determined that the look-aside mask does not have more than one bit set, then determining whether the read/write mask has any bits set; and if it is determined that the read/write mask has bits set, then setting the status to an “exclusive write”.
- 4. The method of claim 2, where said determining further comprises:
if it is determined that the read/write mask does not have any bits set, then setting the status to an “exclusive read”.
- 5. The method of claim 1, further comprising:
providing a table maintained with sharing information about locations currently being referenced.
- 6. The method of claim 5, wherein said table includes a look-aside mask field and a read/write mask field, and includes information on whether a page is accessed by a processor in a read mode or in a write mode.
- 7. The method of claim 6, further comprising:
when a page is brought into the system, determining what state the page has, wherein when the page has a shared write state, then such a state is flagged.
- 8. The method of claim 6, wherein said table comprises a lookup table, said method further comprising:
determining a sharing status of a page, said determining comprising:
determining whether said look-aside mask in said lookup table has more than one bit set; if it is determined that the look-aside mask has more than one bit set, then determining whether a read/write mask field in the table has any bits set; if it is determined that the read/write mask has any bits set, then setting the status to a “shared write”; and if it is determined that the read/write mask does not have any bits set, then setting the status to a “shared read”.
- 9. The method of claim 8, wherein said determining further comprises:
if it is determined that the look-aside mask does not have more than one bit set, then determining whether the read/write mask has any bits set; if it is determined that the read/write mask has bits set, then setting the status to an “exclusive write”; if it is determined that the read/write mask does not have any bits set, then setting the status to an “exclusive read”; and ensuring sequential consistency when instructions are emulated one at a time.
- 10. In a multiprocessor computing system including an emulator for emulating a behavior of a target multiprocessor computing system, a method for emulating a memory consistency behavior of the target multiprocessor computing system, comprising:
executing, prior to a memory action, a memory barrier instruction, the memory barrier instruction ensuring that results of memory actions performed before execution of the memory barrier instruction have been obtained by all processors in a host computing system, wherein said host computing system of said multiprocessor computing system supports a weak consistency model, and the target multiprocessor system of the multiprocessor computing system supports a strong consistency model.
- 11. The method of claim 10, wherein the memory barrier instruction executed prior to a memory action is executed immediately following access to a memory location identified as having a particular state.
- 12. The method of claim 11, wherein said particular state comprises a shared write state.
- 13. The method of claim 10, further including:
ensuring memory consistency, if instructions in a group of instructions from the target multiprocessor computing system are reordered when translated to the host.
- 14. A method for efficient emulation of multiprocessor memory consistency, comprising:
forming a memory barrier instruction which ensures that memory actions that have been performed before execution of the memory barrier instruction, have been registered by all of the processors in a host computing system of a multiprocessor system, wherein the host computing system supports a relaxed consistency model, and a target computing system of said multiprocessor system specifies a strong consistency model.
- 15. The method of claim 14, wherein the host computing system supports said relaxed consistency model with memory coherence.
- 16. The method of claim 14, wherein the memory barrier instruction guarantees that all memory operations after the barrier instruction are performed after all memory operations before the barrier instruction as registered by all processors.
- 17. The method of claim 14, further comprising:
providing a table maintained with sharing information about locations currently being referenced by said target computing system and said host computing system.
- 18. The method of claim 17, wherein said table includes a look-aside mask field and a read/write mask field, and includes information on whether a page is accessed by a processor in a read mode or in a write mode.
- 19. The method of claim 14, further comprising:
when a page is brought into the system, determining what state the page has, wherein when the page has a shared write state, then such a state is flagged.
- 20. The method of claim 14, further comprising:
determining a sharing status of a page, said determining comprising:
determining whether a look-aside mask in a lookup table has more than one bit set; if it is determined that the look-aside mask has more than one bit set, then determining whether a read/write mask field in the table has any bits set; if it is determined that the read/write mask has any bits set, then setting the status to a “shared write”; and if it is determined that the read/write mask does not have any bits set, then setting the status to a “shared read”.
- 21. The method of claim 19, wherein said determining further comprises:
if it is determined that the look-aside mask does not have more than one bit set, then determining whether the read/write mask has any bits set; and if it is determined that the read/write mask has bits set, then setting the status to an “exclusive write”.
- 22. The method of claim 21, wherein said determining further comprises:
if it is determined that the read/write mask does not have any bits set, then setting the status to an “exclusive read”.
- 23. The method of claim 14, further comprising:
ensuring sequential consistency when instructions are emulated one at a time.
- 24. A method of ensuring memory consistency in a multiprocessing system, comprising:
determining whether an instruction is a load or a store; if it is determined that the instruction is a load or a store, then resolving an address of said instruction and determining whether the address is stored in a local look-aside buffer (LLB); if the address is in the LLB, then determining whether the location is in a shared-read state; and if it is determined that the location is in a shared-read state, then determining whether the current address is a write, wherein if the current address is not a write, then performing an emulation of the instruction.
- 25. The method of claim 24, wherein if the address is not stored in the LLB, then initiating a procedure for an LLB miss, and said method further comprises:
if the current access is determined to be a write, then setting the location a shared-write and emulating the instruction, and placing a memory barrier instruction thereat.
- 26. The method of claim 25, further comprising:
if it is determined that the location is not in a shared-read state, then determining whether the location is a shared-write; if the location is determined to be a shared-write state, then emulating the instruction and placing the memory barrier instructions thereat.
- 27. The method of claim 24, further comprising:
determining whether the address is a shared-write or whether the instruction becomes a shared-write; and placing a memory barrier instruction for shared-write instructions and instructions which may become a shared-write.
- 28. The method of claim 24, further comprising:
reordering instruction operations to minimize a number of memory barrier instructions.
- 29. The method of claim 28, further comprising:
providing a memory order buffer (MOB) for maintaining required consistency in memory operations during emulation even in a presence of said reordering.
- 30. The method of claim 28, further comprising:
when a group of instructions are to be translated together, attaching a stub code at a beginning of the translations to save all registers of a target processor that are potentially changed by instructions in the group; and associating each load and each store in the group of instructions with a memory sequence number that indicates its position in the sequence of memory references, and a store sequence number that indicates its position in the sequence of store reference subset.
- 31. The method of claim 30, further comprising:
constructing a memory-order buffer (MOB) table, where each entry has a plurality of fields, including whether it is a load or a store, an address of the reference, a length of the reference, and a value associated with the reference, wherein a number of entries in the table is equal to a number of memory references in a sequence; and mapping shared memory access to the MOB table.
- 32. The method of claim 31, further comprising:
constructing a store recovery table (SRT) which contains as many entries as a number of store references, and wherein each entry contains a plurality of fields including an address field and an old-value field, wherein stores are saved to the SRT for recovery, and the SRT is accessed when a current value of a location is determined to be incorrect and a correct value is needed, a correction operation being performed by the SRT by looping back through each of the stores one at a time and determining the location and what the old value was, and inserting the old value thereat.
- 33. A method of inserting code for maintaining consistency within a group of instructions in a multiprocessor system, comprising:
determining whether an instruction is a load or a store; if it is determined that the instruction is a load or a store, then resolving the address of the instruction, and determining whether the address is in a local look-aside buffer (LLB); if the address is in the LLB, then determining whether the location is in a shared-read state; if it is determined that the location is in a shared-read state, then determining whether a current access is a write; if the current access is determined to be a write, then setting the location to a shared-write and determining whether the current access is a load instruction; if it is determined that the current access is a load, then performing a load and determining whether the load is satisfied from a memory order buffer (MOB) table; and if the load is not satisfied from the MOB table, then inserting a corresponding entry into the MOB table indexed by a memory sequence number.
- 34. The method of claim 33, further comprising:
if it is determined that the current access is not a load, then inserting the entry into the MOB table indexed by a memory sequence number.
- 35. The method of claim 34, further comprising:
if it is determined that the location is not in a shared-write state, then determining whether the access is a write; and if the access is determined not to be a write, then emulating the instruction.
- 36. The method of claim 35, wherein if the access is determined to be a write, then the old value of the location is read, and a store is performed and the old value is inserted into a storage reference table (SRT) indexed by a store sequence number.
- 37. The method of claim 33, further comprising:
determining whether a page corresponding to a referenced location is a “shared-write”, and if it so, branching to a stub code, wherein said stub code indexes a memory order buffer (MOB) using a sequence number of the memory reference and records whether it is a load or a store, and an address of the memory reference, wherein if the memory reference is a store, then a value to be stored is recorded, and if it is a load, then the load is performed, and the value loaded is recorded.
- 38. The method of claim 37, wherein when a load is to a shared-write location that has been a target of a previous store in a translation, the load receives its contents from the MOB and the load is not recorded in the MOB, and
wherein if the reference is not to a “shared-write” location and if it is a store, then the old value of the location is read and recorded in the SRT before the store is performed.
- 39. A method of committing shared writes to memory at an end of a group execution of instructions, comprising:
at an end of translation, adding a stub code which checks to ensure that no other processor of a multiprocessor system has changed values to “shared-write” locations accessed by a block.
- 40. The method of claim 39, further comprising:
locking shared memory locations from access by other processors; and reloading and comparing each load location with a value stored in a corresponding memory order buffer (MOB) entry, wherein, if all reloads are determined to be the same as the original loads, then all stores from the MOB are made to their actual locations in memory.
- 41. The method of claim 39, further comprising:
if a mismatch occurs during a load validation process, canceling an entire execution of the group by restoring all registers to their old state and by reversing the stores made to non-“shared-write” locations by undoing operations in a store recovery table (SRT).
- 42. The method of claim 41, further comprising:
after bringing the system to its previously valid state, reattempting execution.
- 43. The method of claim 39, further comprising:
locking access to shared memory locations; setting a pointer to a first entry in a memory order buffer (MOB), and determining whether an end of the MOB has been reached; if the end has not been reached, then determining whether the entry in the MOB is empty; and if it is determined that the entry is not a load, then incrementing the pointer to the MOB.
- 44. The method of claim 43, further comprising:
if it is determined that the entry is a load, then reloading the entry from an address in the entry; determining whether the value reloaded matches that in the entry; if the value matches, then the pointer is incremented to the MOB; if the value does not match, then releasing the lock, and performing recovery to a beginning of the group by restoring the state and by restoring the non-shared writes using a store recovery table (SRT).
- 45. The method of claim 44, further comprising:
if an end of the MOB has been reached, then setting the pointer to the first entry in the MOB, and determining whether the end of the MOB has been reached; if the end has not been reached, then determining whether the entry in the MOB is empty; determining whether the entry in the MOB is a store; and if the entry is a store, writing the value to memory and incrementing the pointer in the MOB.
- 46. The method of claim 45, wherein if the entry in the MOB is not a store, then the pointer in the MOB is incremented.
- 47. The method of claim 39, further comprising:
processing instructions one-by-one.
- 48. The method of claim 39, further comprising:
processing instructions in groups of instructions by using a memory order buffer (MOB) and a store recovery table (SRT).
- 49. A storage reference table (SRT) for a shared multiprocessor system, comprising:
a table containing as many entries as a number of store references, and wherein each entry contains a plurality of fields including an address field and an old-value field for storing original values for recovery, wherein said table stores information concerning a shared write status of said entries.
- 50. A memory order buffer (MOB) for a shared multiprocessor system, comprising:
a table maintained with sharing information about locations currently being referenced, wherein said information includes information distinguishing whether a particular state of an entry comprises a shared write state.
- 51. The MOB of claim 50, wherein said table includes a look-aside mask field and a read/write mask field, and includes information on whether a page is accessed by a processor in a read mode or in a write mode, and
wherein said table further includes a validity/status bit field, a process identification field, a virtual address field, a real address field, and a protection bit field.
- 52. A system for emulation in a multiprocessor system, comprising:
an emulator for performing an emulation in which a host multiprocessing system of said multiprocessor system supports a weak consistency model, and the target multiprocessing system of the multiprocessor system supports a strong consistency model.
- 53. A signal-bearing medium tangibly embodying a program of machine-readable instructions executable by a digital processing apparatus to perform a method of emulation in a multiprocessor system, comprising:
performing an emulation in which a host multiprocessing system of said multiprocessor system supports a weak consistency model, and the target multiprocessing system of said multiprocessor system supports a strong consistency model.
CROSS-REFERENCE TO RELATED APPLICATIONS
[0001] The present application is related to U.S. patent application Ser. No. 10/___,___, filed on ______, to Altman et al., entitled “METHOD AND SYSTEM FOR MULTIPROCESSOR EMULATION ON A MULTIPROCESSOR HOST SYSTEM” having IBM Docket No. YOR920010533US1, to U.S. patent application Ser. No. 10/___,___, filed on ______, to Nair et al., entitled “HYBRID MECHANISM FOR MORE EFFICIENT EMULATION AND METHOD THEREFOR” having IBM Docket No. YOR920010534US1, to U.S. patent application Ser. No. 10/___,___, filed on ______, to Nair et al., entitled “METHOD AND SYSTEM FOR EFFICIENT EMULATION OF MULTIPROCESSOR ADDRESS TRANSLATION ON A MULTIPROCESSOR HOST” having IBM Docket No. YOR920010535US1, and to U.S. patent application Ser. No. 10/___,___, filed on ______, to Nair et al., entitled “METHOD AND SYSTEM FOR TRANSPARENT DYNAMIC OPTIMIZATION IN A MULTIPROCESSING ENVIRONMENT” having IBM Docket No. YOR920020056US1, each assigned to the present assignee, and incorporated herein by reference.