Before a computing device may accomplish a desired task, it must receive an appropriate set of instructions. Executed by a device's processor(s), these instructions direct the operation of the device. These instructions can be stored in a memory of the computer. Instructions can invoke other instructions.
A computing device, such as a server, router, desktop computer, laptop, etc., and other devices having processor logic and memory, includes an operating system layer and an application layer to enable the device to perform various functions or roles. The operating system layer includes a “kernel”, i.e., master control program, that runs the computing device. The kernel provides task management, device management, and data management, among others. The kernel sets the standards for application programs that run on the computing device and controls resources used by application programs. The application layer includes programs, i.e., executable instructions, which are located above the operating system layer and accessible by a user. As used herein, “user” space, or “user-mode” implies a layer of code which is less privileged and more directly accessible by users than the layer of code which is in the operating system layer or “kernel” space.
In software development, there can be many different groups of programmers working on different portions of software code that will later be compiled to create a finished program. A compiler is software that converts a set of high-level language statements (e.g., high level programming language such as C/C++, COBOL, etc.) into a lower-level representation. For example, compiler software translates a program written in a high-level programming language (C/C++, COBOL, etc.) into machine language. A compiler may generate assembly language first and then translate the assembly language into machine language. A utility known as a “linker” then combines all required machine language modules into an executable program that can run in the computer.
A piece of code, e.g., code in a kernel module, can have functions or variables (collectively “symbols”) which are visible to other modules using that code, and other symbols which are not. In the C language, any symbol that has the “extern” storage class is typically referred to as a “global symbol” and is visible to other modules, i.e., shared between files. Since the C language requires any symbol shared between files within the module to be global, this can result in symbols being visible to across modules when it may be better that they not be. For example, modules can come from a variety of sources and suppliers, e.g. module developers, who may or may not know about one another. As a result one source and/or supplier's global symbols may not be known by another. Where multiple modules make the same symbol visible, namespace collisions can occur, resulting in either build breakage or potentially significant system misbehavior.
Another issue concerns the manner in which a linker tool combines modules into an executable program that can run in the computer. The linker tool takes object files as input and builds a binary, i.e., a file containing machine language instructions, out of them. The linker includes object files that are; (1) listed explicitly in the command line, e.g. usually required object files, and (2) contained in libraries listed on the command line and needed to satisfy symbol references from each other or the explicitly listed object files.
However, in a general operating system kernel, there may be various object files that do not fit into either of the above categories. Examples of object files that do not fit into either of the above categories include object files with the following: (1) debug information; (2) “what” string information; and (3) symbols that may be required by loadable modules, e.g., DLKMs (dynamically loadable kernel modules) that are not yet loaded.
In at least one traditional Unix system, these object files were included into the kernel as follows. The “what” strings from libraries were extracted from the libraries and added into a new C source file and then compiled before the kernel was linked. The debug information was packaged into a separate library from which the object files were extracted and listed explicitly on the linker command line. This collection of all modules' debug information into a single library violates basic concepts of modularity that are understood by one of ordinary skill in the art. This approach is not available to third parties, i.e., customer users, and does not work for loadable modules. In other cases, the object files with interfaces to be used only by loadable modules were forced into the kernel by having a fake interface that called these interfaces or by packaging the desired interfaces into object files that would be linked anyway (also a violation of modularity).
Program instructions are provided which execute to implement self descriptive data for a module within a build mechanism. The self descriptive data includes a list of symbols that a module wants to have visible to its users, along with a notation indicating that all other symbols are to be hidden. A build mechanism is provided which executes instructions to translate the self descriptive data into readable instructions for a linker utility. By allowing developers control over which of their global symbols are visible to their users, the potential for namespace collisions can be reduced and system reliability can be increased. Additionally, embodiments are provided to instruct to a linker to include object files with: (1) debug information; (2) “what” string information; and (3) symbols that may be required by loadable modules, e.g., DLKMs that are not yet loaded.
User interface input devices 122 may include a keyboard, pointing devices such as a mouse, trackball, touchpad, or graphics tablet, a scanner, a touchscreen incorporated into a display, audio input devices such as voice recognition systems, microphones, and other types of input devices. In general, use of the term “input device” is intended to include all possible types of devices and ways to input information into computer system 110 or onto computer network 118.
User interface output devices 120 may include a display subsystem, a printer, a fax machine, or non-visual displays such as audio output devices. The display subsystem may be a cathode ray tube (CRT), a flat-panel device such as a liquid crystal display (LCD) and/or plasma display, or a projection device (e.g., a digital light processing (DLP) device among others). The display subsystem may also provide non-visual display such as via audio output devices. In general, use of the term “output device” is intended to include all possible types of devices and ways to output information from computer system 110 to a user or to another machine or computer system 110.
Storage subsystem 124 can include the operating system “kernel” layer and an application layer to enable the device to perform various functions, tasks, or roles. File storage subsystem 126 can provide persistent (non-volatile) storage for additional program and data files, and may include a hard disk drive, a floppy disk drive along with associated removable media, a compact digital read only memory (CD-ROM) drive, an optical drive, or removable media cartridges. Memory subsystem 128 typically includes a number of memories including a main random access memory (RAM) 130 for storage of program instructions and data during program execution and a read only memory (ROM) 132 in which fixed instructions are stored. As used herein, a computer readable medium is intended to include the types of memory described above. Program embodiments as will be described further herein can be included with a computer readable medium and may also be provided using a carrier wave over a communications network such as the Internet, among others.
Bus subsystem 112 provides a mechanism for letting the various components and subsystems of computer system 110 communicate with each other as intended. Although bus subsystem 112 is shown schematically as a single bus, alternate embodiments of the bus subsystem 112 may utilize multiple busses.
Program embodiments according to the present invention can be stored in the memory subsystem 128, the file storage subsystem 126, and/or elsewhere in a distributed computing environment as the same will be known and understood by one of ordinary skill in the art. Due to the ever-changing nature of computers and networks, the description of computer system 110 depicted in
Computing networks can include multiple computing devices such as servers, desktop PCs, laptops, and workstations, among other peripheral devices, e.g., printers, facsimile devices, and scanners, networked together across a local area network (LAN) and/or wide area network (WAN). A LAN and/or WAN uses clients and servers that have network-enabled operating systems such as Windows, Mac, Linux, and Unix. An example of a client includes a user's workstation. Clients and servers can be connected in a client/server relationship in which the servers hold programs and data that are shared by the clients in the computing network.
As mentioned above, the kernel layer of a computer system manages the set of processes that are running on the system by ensuring that each process is provided with processor and memory resources at the appropriate time. A process refers to a running program, or application, with input, output, and a state. The kernel provides a set of services that allow processes to interact with the kernel and to simplify the work of an application writer. The kernel's set of services is expressed in a set of kernel modules. A module is a self contained set of instructions designed to handle particular tasks within a larger program. Kernel modules can be compiled and subsequently linked together to form a kernel. Other types of modules can be compiled and subsequently linked together to form other types of programs.
By way of example, and not by way of limitation, the operating system 260 of the computing system, e.g., system 110 in
As shown in the embodiment of
A piece of code, e.g., code in a kernel module, can have functions or variables (collectively “symbols”) which are visible to other modules, and symbols which are not. Functions and variables are known and understood by one of ordinary skill in the art. A function is a self-contained software routine that performs a task. Functions can do a large amount of processing or as little as adding two numbers and deriving a result. Functions in one code object file or module can be invoked (called) by code in the same or other code object file(s) or module(s). A variable is a structure that holds data and is uniquely named by the programmer. A variable holds the data assigned to it until a new value is assigned or the program is finished. A local variable is one that is referenced only within the subprogram, function or procedure it was defined in. A global variable can be used by the entire program.
As mentioned in the background, any symbol that is visible between code object files or modules is typically referred to as a “global symbol”. Where multiple modules make the same symbol visible, namespace collisions can occur, resulting in either build breakage or potentially significant system misbehavior.
As the reader will appreciate, a kernel is initially built with a basic set of modules. Each module contains executable code and data to provide some service to the kernel. Each module has an associated set of data that describes the module's capabilities and characteristics. These data have three audiences: the kernel itself needs the data to be able to use the module; kernel configuration (KC) tools that build the kernel need the data in order to resolve dependencies between modules; and the system administrator uses the data in order to decide which modules to choose.
As illustrated in
Upon successful creation of object files, the linker 314 “links” or combines the object files, e.g., 308 and 320 with standard libraries (e.g., graphics, I/O routines, startup code, and the like) to generate executable program modules, 322-1, 322-2, . . . , 322-N. As one of ordinary skill in the art will appreciate, a linker 314 is a tool which takes one or more of object files as input and builds a binary out of them, i.e. machine language. The linker includes object files that are; (1) listed explicitly in the command line, e.g. usually required object files, and (2) contained in libraries listed on the command line and needed to resolve symbol references from each other or the explicitly listed object files.
However, in a general program, there may be various object files that do not fit into either of the above categories. Examples of object files that do not fit into either of the above categories include object files with the following: (1) debug information; (2) “what” string information; and (3) symbols that may be required by loadable modules, e.g., DLKMs that are not yet loaded. As the reader will appreciate, “what” is the name of a standard Unix command that prints information about the version of a program or module (known as a “what” string). For example, for a module called “fred”, the command “what fred” would print the string, embedded in “fred”, that tells when it was built.
As noted above, in at least one traditional Unix system, these object files were included into the kernel as follows. The what strings from libraries were extracted from the libraries and added into a new C source file and then compiled before the kernel was linked. The debug information was packaged into a separate library from which the object files were extracted and listed explicitly on the linker command line. Again, this collection of all modules' debug information into a single library violated basic concepts of modularity that are understood by one of ordinary skill in the art. This approach is not available to third parties, i.e., customer users, and does not work for loadable modules. In other cases, the object files with interfaces to be used only by loadable modules were forced into the kernel by having a fake interface that called these interfaces or by packaging the desired interfaces into object files that would be linked anyway (also a violation of modularity).
To overcome the above described issues, embodiments of the present invention allow a module developer to specify a particular type of information to associate with an object file. The particular type of information is a list of symbols for the linker to include. The embodiments provide a build tool which can receive the particular type of information associated with an object file and translate the information into instructions provided to a linker utility.
As illustrated in
According to various embodiments and as illustrated in
Normal data structures also cannot be used because their use would require all modules to be recompiled whenever the structure definition changes. This is unacceptable in an environment where different modules are created by different authors in different companies at different times. To overcome this limitation with C data structures, the embodiments described herein use discriminated unions where the C data structures begin with special codes describing how the rest of the structures are interpreted.
As illustrated in the embodiment of
As one of ordinary skill in the art will appreciate upon reading this disclosure, when modules are linked together using the linker utility 324 to form a complete kernel, the special ELF format sections used for each of the component modules' metadata are combined into a single section, separate from all other types of data, in the resulting kernel. This combination of section data is a feature of the linker utility 324 used by embodiments of the present invention.
An example of what has been described above can be found in copending application entitled, “Self-Describing Kernel Modules”, application Ser. No. 10/440,144, filed on May 19, 2003, assigned to the instant assignee, and incorporated by reference to which the current application is a continuation in part.
Thus, as one example embodiment the reader will appreciate that a developer may write (i.e., specify a particular type of information) into the module metadata source file 302 a list of symbols (i.e., functions and/or variables) to be exported as an “exports only” statement, from a self describing module, to a linker utility. According to various embodiments described herein, the self describing information in the module will include instructions to hide all global symbols except those mentioned in the “exports only” statement, e.g., written into the module metadata source file, by the module developer. An example of what is described in this paragraph is illustrated in connection with
One example of such collisions is given by the following. In certain Unix environments, a compiler tool chain automatically inserts into any module one or more “millicode functions”, which implement features of the programming language used by the module developer. This is done without the knowledge or intervention of the developer. Since these symbols may be inserted into any module, there is a potential that such symbols will be inserted into multiple modules, and thereby lead to a collision if two or more such modules are used. Embodiments of the present invention allow the millicode symbols in each such module to be hidden from the other modules, and thus avoid potential collision. In other words, by allowing developers control over which of their global symbols are visible to other users, the potential for such collisions can be reduced and the reliability of a system increased.
From reading further below the reader will also appreciate that as another example embodiment a developer may write (i.e., specify a particular type of information) into the module metadata source file 302 a list of symbols (i.e., functions and/or variables) to be exported as an “exports” statement, from a self describing module, to a linker utility. According to various embodiments described herein, the self describing information in the module will include instructions to export various object files that do not typically fit into the above mentioned categories of object files that are; (1) listed explicitly in the command line, e.g. usually required object files, and (2) contained in libraries listed on the command line and needed to resolve symbol references from each other or the explicitly listed object files. Thus, by way of example and not by way of limitation, the “exports” statement can include instructions to export: (1) debug information; (2) “what” string information; and (3) symbols that may be required by loadable modules, e.g., DLKMs that are not yet loaded. That is, various embodiments include instructions which allow module developers to force the linker to include object files by exporting symbols in the “exports” statement that can then be used in the linker command line to force inclusion of the object files that define those symbols. This approach allows modularity. The export symbol information in the “exports” statement is compiled into the modules. An example of what is described in this paragraph is illustrated in connection with
Hence,
In the mechanism shown in
According to the various embodiments described herein, module link tool 310 upon reading and translating the information in the self describing module metadata object files 308 provides linker instructions 312 to make visible, i.e., export to other modules, a list of symbols that a module developer wants to have visible to other modules along with a notation, i.e., instruction to the linker, indicating that all other symbols are to be hidden. In effect, the linker instructions 312 instruct the linker 314 to hide all global symbols except those mentioned in an explicit list of symbols (functions and variables) supplied by a developer.
One rationale for this approach is that since the developer may not know of all the global symbols in the module, e.g., millicode, the developer would not be able to provide a list of all the symbols that should not be visible, i.e., may result in collisions. However, with the above described embodiments, the developer can provide instructions to hide all global symbols from other modules except those affirmatively identified. In effect, these embodiments of the present invention, including the module link tool, allow the developer to add “exports only” statements, listing particular global symbols, into module metadata source files 302. The module link tool 310 can execute program embodiments to read and translate a self describing module metadata object file 308 created from the module metadata source files 302 in order to provide instructions 312 to a linker 314 to hide all global symbols except those explicitly included in the list. As one of ordinary skill in the art will appreciate, the linker 314 facility, once provided with instructions 312, has the capability to honor those instructions, thus producing modules, 322-1, 322-2, . . . , 322-N, that make visible, i.e., export to other modules, only the symbols requested in the developer provided list. The details of the linker 314 are not the subject of the present disclosure and according more detail pertaining to the same is not provided so as not to obscure the subject embodiments.
Additionally, according to various embodiments described herein, the self describing information in the module will include instructions to export various symbols, thus forcing the linker to include object files that do not typically fit into the above mentioned categories of object files that are; (1) listed explicitly in the command line, e.g. usually required object files, and (2) contained in libraries listed on the command line and needed to resolve symbol references from each other or the explicitly listed object files.
In these embodiments, a kernel configuration tool (kconfig) 328 upon executing program instructions to read and translate the information in the self describing modules, 322-1, 322-2, . . . , 322-N, also provides linker instructions 330 to instruct the linker 324 to include object files with: (1) debug information; (2) “what” string information; and (3) symbols that may be used by loadable modules, e.g., DLKMs (dynamically loadable kernel modules) that are not yet loaded. Thus, the various embodiments include instructions which allow module developers to force the linker 324 to include object files by exporting symbols in an “exports” statement that can then be used in the linker command line to force include the object files.
As shown in the example illustration of
In the example illustrate in
In the example embodiment of
As the reader will appreciate, one advantage afforded by embodiments of the present invention is the reduction of conflicts between modules, e.g., 401-1 and 401-2. The modules 401-1 and 401-2 illustrated in
By use of the embodiments described herein, including a module link tool and the program embodiments associated therewith, the addition of “exports only” statements in the two modmeta source files, the occurrence of such above described issues can be reduced. As described in detail above, the use of these statements list the symbols (variables or functions) that should be visible outside the module; all others are hidden so that they cannot cause conflicts.
Another advantage is noted here in connection with the “exports only” embodiment of
Code file 502-2, labeled “abc_realcode.c”, contains the implementation of the module, as understood by one of ordinary skill in the art. Code file 502-3, labeled “abc_debug.c”, is the file which is compiled with special debug options to make sure that any data structure described there is visible to the kernel debugger. All of the C source files include a header file called “allstruct.h” (not shown in
As mentioned, the above description in connection with
At the time of the kernel build process, the kernel configuration tools 528, as described in connection with
As shown in the embodiment of
Although specific embodiments have been illustrated and described herein, those of ordinary skill in the art will appreciate that any arrangement calculated to achieve the same techniques can be substituted for the specific embodiments shown. This disclosure is intended to cover any and all adaptations or variations of various embodiments of the invention. It is to be understood that the above description has been made in an illustrative fashion, and not a restrictive one. Combination of the above embodiments, and other embodiments not specifically described herein will be apparent to those of skill in the art upon reviewing the above description. The scope of the various embodiments of the invention includes any other applications in which the above structures and methods are used. Therefore, the scope of various embodiments of the invention should be determined with reference to the appended claims, along with the full range of equivalents to which such claims are entitled.
In the foregoing Detailed Description, various features are grouped together in a single embodiment for the purpose of streamlining the disclosure. This method of disclosure is not to be interpreted as reflecting an intention that the embodiments of the invention require more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive subject matter lies in less than all features of a single disclosed embodiment. Thus, the following claims are hereby incorporated into the Detailed Description, with each claim standing on its own as a separate embodiment.
The present application is a continuation in part and claims priority to U.S. patent application Ser. No. 10/440,144, filed May 19, 2003, entitled “Self-Describing Kernel Modules”, the disclosure of which is incorporated by reference herein in its entirety.
Number | Date | Country | |
---|---|---|---|
Parent | 10440144 | May 2003 | US |
Child | 10927859 | Aug 2004 | US |