Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 87887
b: refs/heads/master
c: 8c178be
h: refs/heads/master
i:
  87885: d02dbba
  87883: 6f85329
  87879: c871040
  87871: 2ebe08c
v: v3
  • Loading branch information
Linus Torvalds committed Mar 28, 2008
1 parent c0feb5c commit 14e97eb
Show file tree
Hide file tree
Showing 202 changed files with 2,510 additions and 1,766 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a2ceff5e555e664751bc653a4d9b133efa18c742
refs/heads/master: 8c178beeb20ce3801c4851d41342d0ca32ad292c
59 changes: 40 additions & 19 deletions trunk/Documentation/hw_random.txt
Original file line number Diff line number Diff line change
@@ -1,33 +1,26 @@
Hardware driver for Intel/AMD/VIA Random Number Generators (RNG)
Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com>
Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com>

Introduction:

The hw_random device driver is software that makes use of a
The hw_random framework is software that makes use of a
special hardware feature on your CPU or motherboard,
a Random Number Generator (RNG).
a Random Number Generator (RNG). The software has two parts:
a core providing the /dev/hw_random character device and its
sysfs support, plus a hardware-specific driver that plugs
into that core.

In order to make effective use of this device driver, you
To make the most effective use of these mechanisms, you
should download the support software as well. Download the
latest version of the "rng-tools" package from the
hw_random driver's official Web site:

http://sourceforge.net/projects/gkernel/

About the Intel RNG hardware, from the firmware hub datasheet:

The Firmware Hub integrates a Random Number Generator (RNG)
using thermal noise generated from inherently random quantum
mechanical properties of silicon. When not generating new random
bits the RNG circuitry will enter a low power state. Intel will
provide a binary software driver to give third party software
access to our RNG for use as a security feature. At this time,
the RNG is only to be used with a system in an OS-present state.
Those tools use /dev/hw_random to fill the kernel entropy pool,
which is used internally and exported by the /dev/urandom and
/dev/random special files.

Theory of operation:

Character driver. Using the standard open()
CHARACTER DEVICE. Using the standard open()
and read() system calls, you can read random data from
the hardware RNG device. This data is NOT CHECKED by any
fitness tests, and could potentially be bogus (if the
Expand All @@ -36,9 +29,37 @@ Theory of operation:
a security-conscious person would run fitness tests on the
data before assuming it is truly random.

/dev/hwrandom is char device major 10, minor 183.
The rng-tools package uses such tests in "rngd", and lets you
run them by hand with a "rngtest" utility.

/dev/hw_random is char device major 10, minor 183.

CLASS DEVICE. There is a /sys/class/misc/hw_random node with
two unique attributes, "rng_available" and "rng_current". The
"rng_available" attribute lists the hardware-specific drivers
available, while "rng_current" lists the one which is currently
connected to /dev/hw_random. If your system has more than one
RNG available, you may change the one used by writing a name from
the list in "rng_available" into "rng_current".

==========================================================================

Hardware driver for Intel/AMD/VIA Random Number Generators (RNG)
Copyright 2000,2001 Jeff Garzik <jgarzik@pobox.com>
Copyright 2000,2001 Philipp Rumpf <prumpf@mandrakesoft.com>


About the Intel RNG hardware, from the firmware hub datasheet:

The Firmware Hub integrates a Random Number Generator (RNG)
using thermal noise generated from inherently random quantum
mechanical properties of silicon. When not generating new random
bits the RNG circuitry will enter a low power state. Intel will
provide a binary software driver to give third party software
access to our RNG for use as a security feature. At this time,
the RNG is only to be used with a system in an OS-present state.

Driver notes:
Intel RNG Driver notes:

* FIXME: support poll(2)

Expand Down
2 changes: 1 addition & 1 deletion trunk/Documentation/i386/IO-APIC.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ Every PCI card emits a PCI IRQ, which can be INTA, INTB, INTC or INTD:

These INTA-D PCI IRQs are always 'local to the card', their real meaning
depends on which slot they are in. If you look at the daisy chaining diagram,
a card in slot4, issuing INTA IRQ, it will end up as a signal on PIRQ2 of
a card in slot4, issuing INTA IRQ, it will end up as a signal on PIRQ4 of
the PCI chipset. Most cards issue INTA, this creates optimal distribution
between the PIRQ lines. (distributing IRQ sources properly is not a
necessity, PCI IRQs can be shared at will, but it's a good for performance
Expand Down
4 changes: 4 additions & 0 deletions trunk/Documentation/kernel-parameters.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1130,6 +1130,10 @@ and is between 256 and 4096 characters. It is defined in the file
memmap=nn[KMG]$ss[KMG]
[KNL,ACPI] Mark specific memory as reserved.
Region of memory to be used, from ss to ss+nn.
Example: Exclude memory from 0x18690000-0x1869ffff
memmap=64K$0x18690000
or
memmap=0x10000$0x18690000

meye.*= [HW] Set MotionEye Camera parameters
See Documentation/video4linux/meye.txt.
Expand Down
70 changes: 38 additions & 32 deletions trunk/Documentation/lguest/lguest.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*P:100 This is the Launcher code, a simple program which lays out the
* "physical" memory for the new Guest by mapping the kernel image and the
* virtual devices, then reads repeatedly from /dev/lguest to run the Guest.
:*/
* "physical" memory for the new Guest by mapping the kernel image and
* the virtual devices, then opens /dev/lguest to tell the kernel
* about the Guest and control it. :*/
#define _LARGEFILE64_SOURCE
#define _GNU_SOURCE
#include <stdio.h>
Expand Down Expand Up @@ -43,7 +43,7 @@
#include "linux/virtio_console.h"
#include "linux/virtio_ring.h"
#include "asm-x86/bootparam.h"
/*L:110 We can ignore the 38 include files we need for this program, but I do
/*L:110 We can ignore the 39 include files we need for this program, but I do
* want to draw attention to the use of kernel-style types.
*
* As Linus said, "C is a Spartan language, and so should your naming be." I
Expand Down Expand Up @@ -320,7 +320,7 @@ static unsigned long map_elf(int elf_fd, const Elf32_Ehdr *ehdr)
err(1, "Reading program headers");

/* Try all the headers: there are usually only three. A read-only one,
* a read-write one, and a "note" section which isn't loadable. */
* a read-write one, and a "note" section which we don't load. */
for (i = 0; i < ehdr->e_phnum; i++) {
/* If this isn't a loadable segment, we ignore it */
if (phdr[i].p_type != PT_LOAD)
Expand Down Expand Up @@ -387,7 +387,7 @@ static unsigned long load_kernel(int fd)
if (memcmp(hdr.e_ident, ELFMAG, SELFMAG) == 0)
return map_elf(fd, &hdr);

/* Otherwise we assume it's a bzImage, and try to unpack it */
/* Otherwise we assume it's a bzImage, and try to load it. */
return load_bzimage(fd);
}

Expand Down Expand Up @@ -433,12 +433,12 @@ static unsigned long load_initrd(const char *name, unsigned long mem)
return len;
}

/* Once we know how much memory we have, we can construct simple linear page
/* Once we know how much memory we have we can construct simple linear page
* tables which set virtual == physical which will get the Guest far enough
* into the boot to create its own.
*
* We lay them out of the way, just below the initrd (which is why we need to
* know its size). */
* know its size here). */
static unsigned long setup_pagetables(unsigned long mem,
unsigned long initrd_size)
{
Expand Down Expand Up @@ -850,7 +850,8 @@ static void handle_console_output(int fd, struct virtqueue *vq)
*
* Handling output for network is also simple: we get all the output buffers
* and write them (ignoring the first element) to this device's file descriptor
* (stdout). */
* (/dev/net/tun).
*/
static void handle_net_output(int fd, struct virtqueue *vq)
{
unsigned int head, out, in;
Expand Down Expand Up @@ -924,7 +925,7 @@ static void enable_fd(int fd, struct virtqueue *vq)
write(waker_fd, &vq->dev->fd, sizeof(vq->dev->fd));
}

/* Resetting a device is fairly easy. */
/* When the Guest asks us to reset a device, it's is fairly easy. */
static void reset_device(struct device *dev)
{
struct virtqueue *vq;
Expand Down Expand Up @@ -1003,8 +1004,8 @@ static void handle_input(int fd)
if (select(devices.max_infd+1, &fds, NULL, NULL, &poll) == 0)
break;

/* Otherwise, call the device(s) which have readable
* file descriptors and a method of handling them. */
/* Otherwise, call the device(s) which have readable file
* descriptors and a method of handling them. */
for (i = devices.dev; i; i = i->next) {
if (i->handle_input && FD_ISSET(i->fd, &fds)) {
int dev_fd;
Expand All @@ -1015,8 +1016,7 @@ static void handle_input(int fd)
* should no longer service it. Networking and
* console do this when there's no input
* buffers to deliver into. Console also uses
* it when it discovers that stdin is
* closed. */
* it when it discovers that stdin is closed. */
FD_CLR(i->fd, &devices.infds);
/* Tell waker to ignore it too, by sending a
* negative fd number (-1, since 0 is a valid
Expand All @@ -1033,7 +1033,8 @@ static void handle_input(int fd)
*
* All devices need a descriptor so the Guest knows it exists, and a "struct
* device" so the Launcher can keep track of it. We have common helper
* routines to allocate and manage them. */
* routines to allocate and manage them.
*/

/* The layout of the device page is a "struct lguest_device_desc" followed by a
* number of virtqueue descriptors, then two sets of feature bits, then an
Expand Down Expand Up @@ -1078,7 +1079,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
struct virtqueue **i, *vq = malloc(sizeof(*vq));
void *p;

/* First we need some pages for this virtqueue. */
/* First we need some memory for this virtqueue. */
pages = (vring_size(num_descs, getpagesize()) + getpagesize() - 1)
/ getpagesize();
p = get_pages(pages);
Expand Down Expand Up @@ -1122,7 +1123,7 @@ static void add_virtqueue(struct device *dev, unsigned int num_descs,
}

/* The first half of the feature bitmask is for us to advertise features. The
* second half if for the Guest to accept features. */
* second half is for the Guest to accept features. */
static void add_feature(struct device *dev, unsigned bit)
{
u8 *features = get_feature_bits(dev);
Expand Down Expand Up @@ -1151,7 +1152,9 @@ static void set_config(struct device *dev, unsigned len, const void *conf)
}

/* This routine does all the creation and setup of a new device, including
* calling new_dev_desc() to allocate the descriptor and device memory. */
* calling new_dev_desc() to allocate the descriptor and device memory.
*
* See what I mean about userspace being boring? */
static struct device *new_device(const char *name, u16 type, int fd,
bool (*handle_input)(int, struct device *))
{
Expand Down Expand Up @@ -1383,7 +1386,6 @@ struct vblk_info
* Launcher triggers interrupt to Guest. */
int done_fd;
};
/*:*/

/*L:210
* The Disk
Expand Down Expand Up @@ -1493,15 +1495,18 @@ static int io_thread(void *_dev)
while (read(vblk->workpipe[0], &c, 1) == 1) {
/* We acknowledge each request immediately to reduce latency,
* rather than waiting until we've done them all. I haven't
* measured to see if it makes any difference. */
* measured to see if it makes any difference.
*
* That would be an interesting test, wouldn't it? You could
* also try having more than one I/O thread. */
while (service_io(dev))
write(vblk->done_fd, &c, 1);
}
return 0;
}

/* Now we've seen the I/O thread, we return to the Launcher to see what happens
* when the thread tells us it's completed some I/O. */
* when that thread tells us it's completed some I/O. */
static bool handle_io_finish(int fd, struct device *dev)
{
char c;
Expand Down Expand Up @@ -1573,11 +1578,12 @@ static void setup_block_file(const char *filename)
* more work. */
pipe(vblk->workpipe);

/* Create stack for thread and run it */
/* Create stack for thread and run it. Since stack grows upwards, we
* point the stack pointer to the end of this region. */
stack = malloc(32768);
/* SIGCHLD - We dont "wait" for our cloned thread, so prevent it from
* becoming a zombie. */
if (clone(io_thread, stack + 32768, CLONE_VM | SIGCHLD, dev) == -1)
if (clone(io_thread, stack + 32768, CLONE_VM | SIGCHLD, dev) == -1)
err(1, "Creating clone");

/* We don't need to keep the I/O thread's end of the pipes open. */
Expand All @@ -1587,14 +1593,14 @@ static void setup_block_file(const char *filename)
verbose("device %u: virtblock %llu sectors\n",
devices.device_num, le64_to_cpu(conf.capacity));
}
/* That's the end of device setup. :*/
/* That's the end of device setup. */

/* Reboot */
/*L:230 Reboot is pretty easy: clean up and exec() the Launcher afresh. */
static void __attribute__((noreturn)) restart_guest(void)
{
unsigned int i;

/* Closing pipes causes the waker thread and io_threads to die, and
/* Closing pipes causes the Waker thread and io_threads to die, and
* closing /dev/lguest cleans up the Guest. Since we don't track all
* open fds, we simply close everything beyond stderr. */
for (i = 3; i < FD_SETSIZE; i++)
Expand All @@ -1603,7 +1609,7 @@ static void __attribute__((noreturn)) restart_guest(void)
err(1, "Could not exec %s", main_args[0]);
}

/*L:220 Finally we reach the core of the Launcher, which runs the Guest, serves
/*L:220 Finally we reach the core of the Launcher which runs the Guest, serves
* its input and output, and finally, lays it to rest. */
static void __attribute__((noreturn)) run_guest(int lguest_fd)
{
Expand Down Expand Up @@ -1644,7 +1650,7 @@ static void __attribute__((noreturn)) run_guest(int lguest_fd)
err(1, "Resetting break");
}
}
/*
/*L:240
* This is the end of the Launcher. The good news: we are over halfway
* through! The bad news: the most fiendish part of the code still lies ahead
* of us.
Expand Down Expand Up @@ -1691,8 +1697,8 @@ int main(int argc, char *argv[])
* device receive input from a file descriptor, we keep an fdset
* (infds) and the maximum fd number (max_infd) with the head of the
* list. We also keep a pointer to the last device. Finally, we keep
* the next interrupt number to hand out (1: remember that 0 is used by
* the timer). */
* the next interrupt number to use for devices (1: remember that 0 is
* used by the timer). */
FD_ZERO(&devices.infds);
devices.max_infd = -1;
devices.lastdev = NULL;
Expand Down Expand Up @@ -1793,8 +1799,8 @@ int main(int argc, char *argv[])
lguest_fd = tell_kernel(pgdir, start);

/* We fork off a child process, which wakes the Launcher whenever one
* of the input file descriptors needs attention. Otherwise we would
* run the Guest until it tries to output something. */
* of the input file descriptors needs attention. We call this the
* Waker, and we'll cover it in a moment. */
waker_fd = setup_waker(lguest_fd);

/* Finally, run the Guest. This doesn't return. */
Expand Down
19 changes: 12 additions & 7 deletions trunk/Documentation/lguest/lguest.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Rusty's Remarkably Unreliable Guide to Lguest
- or, A Young Coder's Illustrated Hypervisor
http://lguest.ozlabs.org
__
(___()'`; Rusty's Remarkably Unreliable Guide to Lguest
/, /` - or, A Young Coder's Illustrated Hypervisor
\\"--\\ http://lguest.ozlabs.org

Lguest is designed to be a minimal hypervisor for the Linux kernel, for
Linux developers and users to experiment with virtualization with the
Expand Down Expand Up @@ -41,12 +42,16 @@ Running Lguest:
CONFIG_PHYSICAL_ALIGN=0x100000)

"Device Drivers":
"Block devices"
"Virtio block driver (EXPERIMENTAL)" = M/Y
"Network device support"
"Universal TUN/TAP device driver support" = M/Y
(CONFIG_TUN=m)
"Virtualization"
"Linux hypervisor example code" = M/Y
(CONFIG_LGUEST=m)
"Virtio network driver (EXPERIMENTAL)" = M/Y
(CONFIG_VIRTIO_BLK=m, CONFIG_VIRTIO_NET=m and CONFIG_TUN=m)

"Virtualization"
"Linux hypervisor example code" = M/Y
(CONFIG_LGUEST=m)

- A tool called "lguest" is available in this directory: type "make"
to build it. If you didn't build your kernel in-tree, use "make
Expand Down
3 changes: 1 addition & 2 deletions trunk/Documentation/nmi_watchdog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ kernel debugging options, such as Kernel Stack Meter or Kernel Tracer,
may implicitly disable the NMI watchdog.]

For x86-64, the needed APIC is always compiled in, and the NMI watchdog is
always enabled with I/O-APIC mode (nmi_watchdog=1). Currently, local APIC
mode (nmi_watchdog=2) does not work on x86-64.
always enabled with I/O-APIC mode (nmi_watchdog=1).

Using local APIC (nmi_watchdog=2) needs the first performance register, so
you can't use it for other purposes (such as high precision performance
Expand Down
Loading

0 comments on commit 14e97eb

Please sign in to comment.