Mechanism for controlling subset of devices

A computer detects a request by a process for access to a shadow control page, wherein the shadow control page allows the process access to one or more devices. The computer assigns the shadow control page and a key to the process associated with the request. The computer detects a request by the process via the assigned shadow control page for creation of a subset of devices from the one or more devices. The computer inputs information detailing an association between the subset of devices and the assigned key into a subset definition table, wherein the subset definition table includes one or more keys and one or more corresponding subsets.

TECHNICAL FIELD

The present invention relates generally to utilization of hardware devices, and more particularly to protected control of subsets of devices.

BACKGROUND

Hardware devices often have multiple, independent instances. For example, within the context of an accelerator performing multiple computations, the accelerator may have several processing units. Different subsets of these units may be allocated to different user-mode processes. With such a large number of subsets, it may be important to make sure that a process is only able to access a subset or subsets of devices which are allocated to the process.

SUMMARY

The present invention provides a method, system, and computer program product for allowing control of a subset of devices. A computer detects a request by a process for access to a shadow control page, wherein the shadow control page allows the process access to one or more devices. The computer assigns the shadow control page and a key to the process associated with the request. The computer detects a request by the process via the assigned shadow control page for creation of a subset of devices from the one or more devices. The computer inputs information detailing an association between the subset of devices and the assigned key into a subset definition table, wherein the subset definition table includes one or more keys and one or more corresponding subsets.

DETAILED DESCRIPTION

FIG. 1illustrates process control system100, in accordance with an embodiment of the invention. In an exemplary embodiment, process control system100includes computing device110. In other embodiments, process control system100may comprise a cluster of computing devices, each containing one or multiple processing units.

In the example embodiment, computing device110includes controller112, control page114, subset definition table116, and operating system118. Computing device110may be a desktop computer, a notebook, a laptop computer, a tablet computer, a handheld device, a smart-phone, a thin client, or any other electronic device or computing system capable of receiving and sending data to and from other computing devices, via a network connection, such as, for example, a wired, wireless, or fiber optic connection. Although not shown, optionally, computing device110can comprise a cluster of devices executing the same software to collectively process requests. Computing device110is described in more detail with reference toFIG. 3.

Control Page114is an input/output page located in the physical address space that contains control structure mechanisms for subsets of devices contained in process control system100. In the example embodiment, each control structure contained in control page114corresponds to a subset of devices and provides a structure that can be utilized by a process (via a shadow control page) to manipulate the subset of devices.

Subset Definition Table116is a table containing information detailing an access key and a set characterization for one or more subsets of devices. In the example embodiment, the set characterization for a given subset of devices is a bit vector which contains a plurality of bits, with each bit corresponding to a device. Each bit corresponding to each device denotes whether the device is in the subset or not in the subset based on whether the bit is “on” or “off” (on—in the subset, off—not in the subset). Subset Definition Table116is explained in further detail below with regard toFIG. 5.

Operating System118is software that manages the hardware and software resources of computing device110and provides common services for software located on computing device110. In the example embodiment, operating system118is capable of defining one or more subsets of devices. Furthermore, the operating system is capable of assigning a key to a process (or a user), with the key corresponding to the one or more subsets of devices. The operations and functions of operating system118are described in more detail with reference toFIG. 2.

Controller112is a hardware device or software application capable of verifying whether a key associated with a process (or a user) allows the process to manipulate a subset of devices by way of allowing manipulation of devices in a subset of devices by way of a device control structure of a control page, such as control page114, that corresponds to the subset. The operations and functions of controller112are described in more detail with reference toFIG. 3.

FIG. 2is a flowchart illustrating the operations of operating system118in assigning a key value to a process. In the example embodiment, operating system118detects an operation call made by the process for a key (key value) and a shadow control page (step202). In the example embodiment, a finite number of keys are created for the purposes of prohibiting access to devices by processes/users that are not authorized to utilize the devices. Each key has a corresponding shadow control page. A shadow control page is a logical copy of control page114. In order to manipulate a subset, a process utilizes a shadow control page (which contains the device control structures contained in control page114) to manipulate a subset of devices. Furthermore, the corresponding key for each shadow control page is embedded in the real address of the shadow control page.

In the example embodiment, operating system118identifies an unused or unassigned key and assigns the key to the process (step204). In the example embodiment, operating system118maintains information regarding device ownership, subset ownership and key allocation in data structures that may be referenced when identifying an unused or unassigned key to assign to the process. In the example embodiment, operating system118assigns the key to the process by way of mapping the shadow control page corresponding to the key into the virtual address space allocated to the process.

Operating system118detects an operation call requesting to utilize a set of devices (step206). Once the request is detected by operating system118, operating system118verifies whether any devices included in the request are owned by another process. In the example embodiment, operating system118references subset definition table116, which contains key values and corresponding subsets of devices, in order to determine whether any of the devices in the request are owned by another process. As stated above, a bit vector denotes which devices contained within each subset. Therefore, if a device is contained in a subset which has a corresponding key value (as per subset definition table116), the device is owned by another process.

Operating system118detects an operation call requesting the creation of one or more subsets from the set of devices (step208). In the example embodiment, once the operation call is detected, operating system118identifies an unused row/entry of subset definition table116and inputs a bit vector detailing the requested subset and the calling process's assigned key value into the identified row of subset definition table116(step210). As stated above, a bit vector denotes whether the device is in the subset or not in the subset based on whether the bit is “on” or “off” (on—in the subset, off—not in the subset). Therefore, operating system118turns the bits on which correspond to the devices in the requested subset. In addition, each row has a corresponding device control structure that may be utilized by the process in order to manipulate the subset of devices. Once the bit vector information has been input into subset definition table116, operating system118communicates with the process/user in order to notify the process/user of the row/entry of the subset definition table so that the process/user is aware of the corresponding device control structure that is to be utilized. For example, if operating system118detects a request from a process to create a subset of devices which include device A, device B, and device C, and operating system118determines that row4of subset definition table116is unused, operating system118may input a bit vector denoting device A, device B, and device C into row4along with the key assigned to the process. Continuing the example, row4of subset definition table116may be associated with device control structure4of control page114, and therefore, operating system118notifies the process that it should use device control structure4to interact with the device subset consisting of device A, device B, and device C.

FIG. 3illustrates the operations of controller112in identifying whether a key value associated with a process allows access to one or more subsets of devices, in accordance with an embodiment of the invention. In the example embodiment, controller112detects an operation by the process (step302). For example, controller112may detect a store request to a virtual address. Once the process requests the store, the virtual address is translated to a real/physical address by the memory management unit of computing device110. In the example embodiment, bits that specify the relevant device control structure and bits that specify a specific byte within the device control structure that the store request pertains to are embedded in the virtual address. Furthermore, the key associated with the process is embedded in the translated physical address (which is a physical address falling within the shadow control page mapped into the virtual address space of the process as described above).

Controller112determines whether the key (key value) matches the key configured for the subset (decision304). In the example embodiment, controller112determines whether the key embedded in the physical address matches the key value associated with the subset of devices associated with the operation being performed by the process. As stated above, each subset of devices has a corresponding device control structure. Therefore, controller112identifies the relevant device control structure from the bits embedded in the virtual address associated with the operation and determines the subset based on the relevant device control structure. In the example embodiment, controller112references subset definition table116in order to determine the key (key value) corresponding to the particular subset of devices. Controller112then compares the key embedded in the physical address to the key identified in subset definition table116.

If controller112determines that the key does not match the key configured for the subset (decision304, “NO” branch), controller112denies access to the subset of devices (step306). If controller112determines that the key matches the key configured for the subset (decision304, “YES” branch), controller112distributes the control-structure manipulation to all devices contained within the particular subset (step308). For example, if the process is trying to perform a store operation to subset4(which contains device A, device B, and device C), the process performs a store operation to a virtual address which is mapped to the physical address of device control structure4within the shadow control page, as stated above. Controller112then compares the key embedded in the physical address of the shadow control page to the key identified in subset definition table116as corresponding to subset4. If the keys match, controller112allows access to the devices in subset4by way of the corresponding device control structure (i.e.—device control structure4), and distributes the store operation to all devices contained in the subset. If the keys do not match, controller112does not allow the process to access device control structure4.

FIG. 4is an illustration describing the relationship between the components of process control system100, in accordance with an embodiment of the invention.FIG. 4includes process virtual address space402, shadow control pages404, control page406, and devices408. As described above, a shadow control page of shadow control pages404is mapped into process virtual address space402as shown. The process is then able to perform an operation to the virtual address space which is then translated to a real/physical address (which is depicted by shadow control pages404). Shadow control pages404are logical copies of control page406which are able to be utilized by the process to manipulate a subset (if process has permission to access the subset). For example, the process may utilize control structure1of an assigned shadow control page of shadow control pages404to manipulate the corresponding subset of devices (in this case devices3and4). The process may also utilize control structure2of an assigned shadow control page of shadow control pages404in order to manipulate the corresponding subset of devices (in this case devices3,4,5, and6).

FIG. 5is an illustration of the subset definition table116, in accordance to an embodiment of the invention. As described above, subset definition table116includes key values and corresponding subsets of devices input by operating system118. In the example embodiment, subset definition table116includes entry502, entry504, and entry506. Entry502includes key0which corresponds to subset0, entry504includes key1which corresponds to subset1, and entry506includes key2which corresponds to subset2. As described above, after the process performs an operation to a virtual address in virtual address space402, the virtual address is translated to a real/physical address. Controller112then verifies whether the key embedded in the real/physical address allows access to the subset pertaining to the operation request. For example, if the process performs an operation to a virtual address corresponding to control structure0, which corresponds to subset0, controller112verifies whether the key value embedded in the real/physical address of the translated real address allows access to subset0. In the example embodiment, controller112performs this verification step by referencing subset definition table116and comparing the embedded key value to the key value in entry502(key0) to see if the keys match. If the keys match, controller112allows the process to access the devices of subset0. If the keys do not match, controller112does not all the process to access the devices of subset0.

The foregoing description of various embodiments of the present invention has been presented for purposes of illustration and description. It is not intended to be exhaustive nor to limit the invention to the precise form disclosed. Many modifications and variations are possible. Such modifications and variations that may be apparent to a person skilled in the art of the invention are intended to be included within the scope of the invention as defined by the accompanying claims.

Computing device110includes communications fabric602, which provides communications between computer processor(s)604, memory606, persistent storage608, communications unit612, and input/output (I/O) interface(s)614. Communications fabric602can be implemented with any architecture designed for passing data and/or control information between processors (such as microprocessors, communications and network processors, etc.), system memory, peripheral devices, and any other hardware components within a system. For example, communications fabric602can be implemented with one or more buses.

The programs controller112, control page114, subset definition table116, and operating system118in computing device110are stored in persistent storage608for execution by one or more of the respective computer processors604via one or more memories of memory606. In this embodiment, persistent storage608includes a magnetic hard disk drive. Alternatively, or in addition to a magnetic hard disk drive, persistent storage608can include a solid state hard drive, a semiconductor storage device, read-only memory (ROM), erasable programmable read-only memory (EPROM), flash memory, or any other computer-readable storage media that is capable of storing program instructions or digital information.

Communications unit612, in these examples, provides for communications with other data processing systems or devices. In these examples, communications unit612includes one or more network interface cards. Communications unit612may provide communications through the use of either or both physical and wireless communications links. The programs controller112, control page114, subset definition table116, and operating system118in computing device110, may be downloaded to persistent storage608through communications unit612.

I/O interface(s)614allows for input and output of data with other devices that may be connected to computing device110. For example, I/O interface614may provide a connection to external devices620such as, a keyboard, keypad, a touch screen, and/or some other suitable input device. External devices620can also include portable computer-readable storage media such as, for example, thumb drives, portable optical or magnetic disks, and memory cards. Software and data used to practice embodiments of the present invention, e.g., controller112, control page114, subset definition table116, and operating system118in computing device110, can be stored on such portable computer-readable storage media and can be loaded onto persistent storage608via I/O interface(s)614. I/O interface(s)614can also connect to a display622.

The programs described herein are identified based upon the application for which they are implemented in a specific embodiment of the invention. However, it should be appreciated that any particular program nomenclature herein is used merely for convenience, and thus the invention should not be limited to use solely in any specific application identified and/or implied by such nomenclature. The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.