1
0
Fork 0
Commit Graph

80 Commits (5bbcc0f595fadb4cac0eddc4401035ec0bd95b09)

Author SHA1 Message Date
Jeff Dike d3b7f69de2 [PATCH] uml: add locking to network transport registration
The registration of host network transports needed some locking.  The
transport list itself is locked, but calls to the registration routines are
not.  This is compensated for by checking that a transport structure is not
yet on any list.

I also took the opportunity to const all fields in the transport structure
except the list, which obviously can be modified.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-11 10:51:21 -08:00
Jeff Dike f28169d200 [PATCH] uml: return hotplug errors to host
I noticed that errors happening while hotplugging devices from the host were
never returned back to the mconsole client.  In some cases, success was
returned instead of even an information-free error.

This patch cleans that up by having the low-level configuration code pass back
an error string along with an error code.  At the top level, which knows
whether it is early boot time or responding to an mconsole request, the string
is printk'd or returned to the mconsole client.

There are also whitespace and trivial code cleanups in the surrounding code.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2007-02-11 10:51:21 -08:00
Peter Zijlstra eff3b634d9 [PATCH] uml: fix net_kern workqueue abuse
Fix up the work on stack and exit scope trouble by placing the work_struct
in the uml_net_private data.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Acked-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-12-13 09:05:47 -08:00
Yan Burman 0268bd0a80 um: replace kmalloc+memset with kzalloc
Replace kmalloc+memset with kzalloc

Signed-off-by: Yan Burman <burman.yan@gmail.com>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
2006-12-12 19:54:52 +01:00
David Howells 6d5aefb8ea WorkQueue: Fix up arch-specific work items where possible
Fix up arch-specific work items where possible to use the new work_struct and
delayed_work structs.

Three places that enqueue bits of their stack and then return have been marked
with #error as this is not permitted.

Signed-Off-By: David Howells <dhowells@redhat.com>
2006-12-05 19:36:26 +00:00
Al Viro 7bea96fd22 [PATCH] uml pt_regs fixes
Real fix for UML pt_regs stuff.  Note set_irq_regs() logics in there...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-10-08 16:34:08 -07:00
Dave Jones 038b0a6d8d Remove all inclusions of <linux/config.h>
kbuild explicitly includes this at build time.

Signed-off-by: Dave Jones <davej@redhat.com>
2006-10-04 03:38:54 -04:00
Ollie Wild d6c641026d [PATCH] uml build fix
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 15:58:21 -07:00
Jeff Dike fade5d5461 [PATCH] uml: don't roll my own random MAC generator
Use the existing random_ether_addr() instead of cooking up my own
version.  Pointed out by Dave Hollis and Jason Lunz.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Jeff Dike b10aeeef55 [PATCH] uml: mechanical tidying after random MACs change
Mechanical, hopefully non-functional changes stemming from
setup_etheraddr always succeeding now that it always assigns a MAC,
either from the command line or generated randomly:
   the test of the return of setup_etheraddr is removed, and code
dependent on it succeeding is now unconditional
   setup_etheraddr can now be made void
   struct uml_net.have_mac is now always 1, so tests of it can be
similarly removed, and uses of it can be replaced with 1
   struct uml_net.have_mac is no longer used, so it can be removed
   struct uml_net_private.have_mac is copied from struct uml_net, so
it is always 1
   tests of uml_net_private.have_mac can be removed
   uml_net_private.have_mac can now be removed
   the only call to dev_ip_addr was removed, so it can be deleted

It also turns out that setup_etheraddr is called only once, from the same
file, so it can be static and its declaration removed from net_kern.h.

Similarly, set_ether_mac is defined and called only from one file.

Finally, setup_etheraddr and set_ether_mac were moved to avoid needing forward
declarations.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Jeff Dike f3e7ed2b61 [PATCH] uml: assign random MACs to interfaces if necessary
Assign a random MAC to an ethernet interface if one was not provided on the
command line.  This became pressing when distros started bringing interfaces
up before assigning IPs to them.  The previous pattern of assigning an IP then
bringing it up allowed the MAC to be generated from the first IP assigned.
However, once the thing is up, it's probably a bad idea to change the MAC, so
the MAC stayed initialized to fe:fd:0:0:0:0.

Now, if there is no MAC from the command line, one is generated.  We use the
microseconds from gettimeofday (20 bits), plus the low 12 bits of the pid to
seed the random number generator.  random() is called twice, with 16 bits of
each result used.  I didn't want to have to try to fill in 32 bits optimally
given an arbitrary RAND_MAX, so I just assume that it is greater than 65536
and use 16 bits of each random() return.

There is also a bit of reformatting and whitespace cleanup here.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-29 09:18:04 -07:00
Al Viro a144ea4b7a [IPV4]: annotate struct in_ifaddr
ifa_local, ifa_address, ifa_mask, ifa_broadcast and ifa_anycast are
net-endian.  Annotated them and variables that are inferred to be
net-endian.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2006-09-28 18:00:55 -07:00
Jeff Dike 1183dc943c [PATCH] uml: fix allocation size
Fix an instance of ptr=alloc(sizeof(ptr)).  Grepping showed no more instances
of this pattern.

Also fixed the formatting in the area.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:16 -07:00
Paolo 'Blaisorblade' Giarrusso 48af05ed54 [PATCH] uml: fix proc-vs-interrupt context spinlock deadlock
This spinlock can be taken on interrupt too, so spin_lock_irq[save] must be
used.

However, Documentation/networking/netdevices.txt explains we are called with
rtnl_lock() held - so we don't need to care about other concurrent opens.
Verified also in LDD3 and by direct checking.  Also verified that the network
layer (through a state machine) guarantees us that nobody will close the
interface while it's being used.  Please correct me if I'm wrong.

Also, we must check we don't sleep with irqs disabled!!!  But anyway, this is
not news - we already can't sleep while holding a spinlock.  Who says this is
guaranted really by the present code?

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-27 08:26:15 -07:00
Paolo 'Blaisorblade' Giarrusso bf61f50d63 [PATCH] uml: clean our set_ether_mac
Clean set_ether_mac usage.  Maybe could also be removed, but surely it can't
be a global function taking a void* argument.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Acked-by: Jeff Dike <jdike@addtoit.com>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-09-26 08:49:09 -07:00
Thomas Gleixner bd6aa6502e [PATCH] irq-flags: UM: Use the new IRQF_ constants
Use the new IRQF_ constants and remove the SA_INTERRUPT define

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-07-02 13:58:48 -07:00
Jeff Dike 14d9ead05e [PATCH] uml: balance list_add and list_del in the network driver
The network driver added an interface to the "opened" list when it was
configured, not when it was brought up, and removed it when it was taken down.
 A sequence of ifconfig up, ifconfig down, ...  caused it to be removed
multiple times from the list without being added in between, resulting in a
crash.  This patch moves the add to when the interface is brought up.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-07 16:12:32 -08:00
Paolo 'Blaisorblade' Giarrusso 71c8d4c3aa [PATCH] uml: fix spinlock recursion and sleep-inside-spinlock in error path
In this error path, when the interface has had a problem, we call dev_close(),
which is disallowed for two reasons:

*) takes again the UML internal spinlock, inside the ->stop method of this
   device
*) can be called in process context only, while we're in interrupt context.

I've also thought that calling dev_close() may be a wrong policy to follow,
but it's not up to me to decide that.

However, we may end up with multiple dev_close() queued on the same device.
But the initial test for (dev->flags & IFF_UP) makes this harmless, though -
and dev_close() is supposed to care about races with itself.  So there's no
harm in delaying the shutdown, IMHO.

Something to mark the interface as "going to shutdown" would be appreciated,
but dev_deactivate has the same problems as dev_close(), so we can't use it
either.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:21 -08:00
Paolo 'Blaisorblade' Giarrusso e56a78855a [PATCH] uml: networking - clear transport-specific structure
Pre-clear transport-specific private structure before passing it down.

In fact, I just got a slab corruption and kernel panic on exit because kfree()
was called on a pointer which probably was never allocated, BUT hadn't been
set to NULL by the driver.

As the code is full of such errors, I've decided for now to go the safe way
(we're talking about drivers), and to do the simple thing.  I'm also starting
to fix drivers, and already sent a patch for the daemon transport.

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Cc: Jeff Dike <jdike@addtoit.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-18 19:20:21 -08:00
Jeff Dike 8d93c700a4 [PATCH] uml: free network IRQ correctly
Free the network IRQ when closing down the network devices at shutdown.
Delete the device from the opened devices list on close.

These prevent an -EBADF when later disabling SIGIO on all extant descriptors
and a complaint from free_irq about freeing the IRQ twice.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:48 -08:00
Jeff Dike 9010772cdf [PATCH] uml: Add static initializations and declarations
Some structure fields were being dynamically initialized when they could be
initialized at compile-time instead.  This also makes some declarations static
(in the C sense).

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:46 -08:00
Jeff Dike 970d6e3a34 [PATCH] uml: use kstrdup
There were a bunch of calls to uml_strdup dating from before kstrdup was
introduced.  This changes those calls.  It doesn't eliminate the definition
since there is still a couple of calls in userspace code (which should
probably call the libc strdup).

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-01-06 08:33:45 -08:00
Linus Torvalds 5643f000c1 Merge master.kernel.org:/home/rmk/linux-2.6-drvmodel 2005-11-11 09:24:26 -08:00
Russell King 3ae5eaec1d [DRIVER MODEL] Convert platform drivers to use struct platform_driver
This allows us to eliminate the casts in the drivers, and eventually
remove the use of the device_driver function pointer methods for
platform device drivers.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-11-09 22:32:44 +00:00
Christoph Hellwig 6d3874844f [PATCH] uml_net: use ethtool_ops
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2005-11-09 01:10:10 -05:00
Bodo Stroesser 0e76422ca5 [PATCH] uml: fix UML network driver endianness bugs
ifa->ifa_address and ifa->ifa_mask are defined as __u32, but used as if they
were char[4].

Network code uses htons() to convert it.  So UML's method to access these
fields is wrong for bigendians (e.g.  s390)

I replaced bytewise copying by memcpy(), maybe even that might be removed, if
ifa->ifa_address/mask may be used immediately.

Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Cc: <viro@parcelfarce.linux.theplanet.co.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-11-07 07:53:30 -08:00
Russell King d052d1beff Create platform_device.h to contain all the platform device details.
Convert everyone who uses platform_bus_type to include
linux/platform_device.h.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-by: Greg Kroah-Hartman <gregkh@suse.de>
2005-10-29 19:07:23 +01:00
Jeff Dike 29d56cfe3c [PATCH] uml: hot-unplug code cleanup
Clean up the hot-unplugging code.  There is now an id procedure which is
called to figure out what device we're talking to.  The error messages from
that are now done from mconsole_remove instead of the driver.  remove is now
called with the device number, after it has been checked, so doesn't need to
do sanity checking on it.

Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-25 16:24:36 -07:00
Paolo 'Blaisorblade' Giarrusso dbce706e25 [PATCH] uml: add and use generic hw_controller_type->release
With Chris Wedgwood <cw@f00f.org>

Currently UML must explicitly call the UML-specific
free_irq_by_irq_and_dev() for each free_irq call it's done.

This is needed because ->shutdown and/or ->disable are only called when the
last "action" for that irq is removed.

Instead, for UML shared IRQs (UML IRQs are very often, if not always,
shared), for each dev_id some setup is done, which must be cleared on the
release of that fd.  For instance, for each open console a new instance
(i.e.  new dev_id) of the same IRQ is requested().

Exactly, a fd is stored in an array (pollfds), which is after read by a
host thread and passed to poll().  Each event registered by poll() triggers
an interrupt.  So, for each free_irq() we must remove the corresponding
host fd from the table, which we do via this -release() method.

In this patch we add an appropriate hook for this, and remove all uses of
it by pointing the hook to the said procedure; this is safe to do since the
said procedure.

Also some cosmetic improvements are included.

This is heavily based on some work by Chris Wedgwood, which however didn't
get the patch merged for something I'd call a "misunderstanding" (the need
for this patch wasn't cleanly explained, thus adding the generic hook was
felt as undesirable).

Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
CC: Ingo Molnar <mingo@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-06-21 19:07:32 -07:00
Linus Torvalds 1da177e4c3 Linux-2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.

Let it rip!
2005-04-16 15:20:36 -07:00