Nicolas Mailhot [Thu, 21 Nov 2002 06:25:51 +0000 (22:25 -0800)]
[PATCH] Via KT400 agp support
This adds the KT400 pci ID and lists it as using Via generic setup
routines. This patch has been tested with all GL xscreensavers I could
find, and been reviewed by Dave Jones (full patch history at
http://bugzilla.kernel.org/show_bug.cgi?id=3D14).
Dave Jones [Thu, 21 Nov 2002 04:24:53 +0000 (20:24 -0800)]
[PATCH] A new Athlon 'bug'.
Very recent Athlons (Model 8 stepping 1 and above) (XPs/MPs and mobiles)
have an interesting problem. Certain bits in the CLK_CTL register need
to be programmed differently to those in earlier models. The problem arises
when people plug these new CPUs into boards running BIOSes that are unaware
of this fact.
The fix is to reprogram CLK_CTL to 200xxxxx instead of 0x600xxxxx as it was
in previous models. The AMD folks have found that this improves stability.
The patch below does this reprogramming if an affected model/bios is
detected.
I'm interested if someone with an affected model could run some
benchmarks before and after to also see if this affects performance.
Patrick Mochel [Wed, 20 Nov 2002 15:08:40 +0000 (09:08 -0600)]
partitions: use the name in disk->kobj.name, instead of disk->disk_name.
Some names (for some reason) have a '/' in them, making them no good for directory
names. disk->kobj.name has already been transformed to turn those into '!', so this
makes sure we use those when setting the name for the partitions' names.
Patrick Mochel [Wed, 20 Nov 2002 14:08:19 +0000 (08:08 -0600)]
driver model: update and clean bus and driver support.
This a multi-pronged attack aimed at exploiting the kobject infrastructure mor.
- Remove bus_driver_list, in favor of list in bus_subys.
- Remove bus_for_each_* and driver_for_each_dev(). They're not being used by
anyone, have questionable locking semantics, and really don't provide that
much use, as the function returns once the callback fails, with no indication
of where it failed. Forget them, at least for now.
- Make sure that we return success from bus_match() if device matches, but
doesn't have a probe method.
- Remove extraneous get_{device,driver}s from bus routines that are serialized
by the bus's rwsem. bus_{add,remove}_{device,driver} all take the rwsem, so there
is no way we can get a non-existant object when in those functions.
- Use the rwsem in the struct subsystem the bus has embedded in it, and kill the
separate one in struct bus_type.
- Move bulk of driver_register() into bus_add_driver(), which holds the bus's
rwsem during the entirety. this will prevent the driver from being unloaded while
it's being registered, and two drivers with the same name getting registered
at the same time.
- Ditto for driver_unregister() and bus_remove_driver().
- Add driver_release() method for the driver bus driver subsystems. (Explained later)
- Use only the refcounts in the buses' kobjects, and kill the one in struct bus_type.
- Kill struct bus_type::present and struct device_driver::present. These didn't
work out the way we intended them to. The idea was to not let a user obtain a
rerference count to the object if it was in the process of being unregistered.
All the code paths should be fixed now such that their registration is protected with
a semaphore, so no partially initialized objects can be removed, and enough
infrastructure is moved to the kobject model so that once the object is publically
visible, it should be usable by other sources.
- Add a bus_sem to serialize bus registration and unregistration.
- Add struct device_driver::unload_sem to prevent unloading of drivers
with a positive reference count.
The driver model has always had a bug that would allow a driver with a
positive reference count to be unloaded. It would decrement the reference
count and return, letting the module be unloaded, without accounting for
the other users of the object. This has been discussed many times, though
never resolved cleanly. This should fix the problem in the simplest manner.
struct device_driver gets unload_sem, which is initialized to _locked_. When
the reference count for the driver reaches 0, the semaphore is unlocked.
driver_unregister() blocks on acquiring this lock before it exits. In the
normal case that driver_unregister() drops the last reference to the driver,
the lock will be acquired immediately, and the module will unload.
In the case that someone else is using the driver object, driver_unregister()
will not be able to acquire the lock, since the refcount has not reached 0,
and the lock has not been released.
This means that rmmod(8) will block while drivers' sysfs files are open.
There are no sysfs files for drivers yet, but note this when they do have
some.
Patrick Mochel [Wed, 20 Nov 2002 13:37:09 +0000 (07:37 -0600)]
sysfs: various updates.
- Don't do extra dget() when creating symlink.
This is a long-standing bug with a simple and obvious fix. We were doing
an extra dget() on the dentry after d_instantiate(). It only gets decremented
once on removal, so the dentry was never really going away, and the directory
wasn't, either.
- Use simple_unlink() instead of sysfs_unlink().
- Use simple_rmdir() instead of our own, unrolled, version.
- Remove MODULE_LICENSE(), since it's always in the kernel.
[PATCH] remove unused includes and misleading comments from scsi_lib.c
On Sun, Nov 17, 2002 at 11:54:49PM +0100, Christoph Hellwig wrote:
> --- 1.46/drivers/scsi/scsi_lib.c Thu Nov 14 18:09:17 2002
> +++ edited/drivers/scsi/scsi_lib.c Sun Nov 17 21:37:05 2002
> @@ -7,50 +7,18 @@
> * of people at Linux Expo.
> */
>
> -/*
> - * The fundamental purpose of this file is to contain a library of utility
> - * routines that can be used by low-level drivers. Ultimately the idea
> - * is that there should be a sufficiently rich number of functions that it
> - * would be possible for a driver author to fashion a queueing function for
> - * a low-level driver if they wished. Note however that this file also
> - * contains the "default" versions of these functions, as we don't want to
> - * go through and retrofit queueing functions into all 30 some-odd drivers.
> - */
> -
> -#include <linux/module.h>
> -
> -#include <linux/sched.h>
> -#include <linux/timer.h>
> #include <linux/string.h>
> #include <linux/slab.h>
> #include <linux/bio.h>
> -#include <linux/ioport.h>
> #include <linux/kernel.h>
> -#include <linux/stat.h>
> #include <linux/blk.h>
> -#include <linux/interrupt.h>
> -#include <linux/delay.h>
> -#include <linux/smp_lock.h>
> #include <linux/completion.h>
>
> -
> -#define __KERNEL_SYSCALLS__
> -
> -#include <linux/unistd.h>
I had to add back the smp_lock.h include to compile with CONFIG_PREEMPT,
as kernel_locked was not defined and is used by in_atomic().
Petr Vandrovec [Wed, 20 Nov 2002 04:00:09 +0000 (20:00 -0800)]
[PATCH] Merge lcall7 and lcall27 code paths in ia32
lcall7 and lcall27 code paths are almost identical, except one
constant. This code merges these two paths together, by moving
constant to the beginning of function.
It is possible to eliminate even more of lcall7 and lcall27
code paths, but at cost of splitting SAVE_ALL into two halves,
and I do not want to do that. But if you think that it is worth
of effort, I can save 16 more bytes, but at cost of speed.
Side effects of merge is that now stack is addressed relative
to %ebx instead of relative to %esp, so generated code is
shorter and faster.
Ivan Kokshaysky [Wed, 20 Nov 2002 01:42:06 +0000 (17:42 -0800)]
[PATCH] PCI setup: misc cleanups and fixes
- Use PCI_BUS_NUM_RESOURCES instead of hardcoded `4' in
pci_find_parent_resource;
- clean up pci_claim_resource() and make it a bit more informative
on errors;
- pdev_sort_resources() must be __devinit, as it's called from
pbus_assign_resources_sorted(), which is __devinit now;
- fix one remaining dev->name in debugging printk.
Ivan Kokshaysky [Wed, 20 Nov 2002 01:42:00 +0000 (17:42 -0800)]
[PATCH] PCI: transparent bridge detection fix
The detection of subtractive decoding bridges is broken: `class' variable
doesn't contain ProgIf byte at this point, I should check `dev->class'
instead.
This fixes resource allocation problems on certain docking stations.
The dev_t argument of sys_mknod is passed to vfs_mknod, and is then cast
to int when foo_mknod is called, and is subsequently very often cast
back to dev_t. (For example, minix_mknod() calls minix_set_inode() that
takes a dev_t.)
This is a cleanup that avoids this back-and-forth casting by giving
foo_mknod a prototype with dev_t. In most cases now the dev_t is
transmitted untouched until init_special_inode.
It also makes the two routines hugetlbfs_get_inode() and
shmem_get_inode() static.
Rusty Russell [Wed, 20 Nov 2002 01:32:41 +0000 (17:32 -0800)]
[PATCH] Module length calculation fix and module with no init fix
Fixes miscalculation of required module size due to alignment issues of
first section after common, and also doesn't think that no init section
is an allocation failure.
Rusty Russell [Wed, 20 Nov 2002 01:31:18 +0000 (17:31 -0800)]
[PATCH] module device table restoration
Patch from Adam Richter. I have a nicer solution based on aliases, but
it requires coordination with USB, PCI and PCMCIA maintainers, which is
taking time.
This restores the old code in the meantime: one week without this is too
long for people who need it.
Paul Mackerras [Thu, 21 Nov 2002 09:10:09 +0000 (20:10 +1100)]
PPC32: clean up the arch/ppc/boot Makefiles.
This removes Rules.make inclusions, makes make clean work properly,
removes EXTRA_TARGETS where not needed, and fixes a couple of compile
warnings in the boot wrappers where <linux/string.h> wasn't included.
Zwane Mwaikambo [Tue, 19 Nov 2002 16:10:26 +0000 (08:10 -0800)]
[PATCH] USB core/config.c == memory corruption
parse_interface allocates the incorrect storage size for additional
altsettings (new buffer) leading to a BUG being triggered in
mm/slab.c:1453 when we do the memcpy from the old buffer to the new
buffer (writing beyond new buffer).
Patch appended, tested with an OV511 on an Intel PIIX4
Patrick Mochel [Tue, 19 Nov 2002 14:42:26 +0000 (08:42 -0600)]
driver model: exploit kobject contstructs.
This makes the driver model core (for devices) exploit the kobject
infrastructure more and make the resulting code quite a bit simpler.
For one, device_register() mimmicks kobject_register() in that it now only
calls device_initialize() and device_add() back to back. Similarly,
device_unregister() calls device_del() and put_device() consecutively.
device_del() no longer removes and frees the device, it only removes them.
It also removes the devices from the global and sibling lists. This was
previously done by device_put(), but moved here to be symmetrical with
device_add().
The device's parent is now only incremented in device_add() and decremented
in device_del(), fixing a bug in which the parent's refcount was incremented
twice.
Because of these simplifications, the core can easily be converted to use
the kobject reference counting infrastructure. get_device() now simply
forwards the call to kobject_get() and ditto for put_device().
device_release() is implemented to handle the freeing of devices once their
reference count reaches 0.
Since we're using the kobject refcounting model, we no longer need the
checking or setting of the device state field, so it has been removed.
The only users of it were the power routines. In those, it is implicit that
we have a valid device, since we've already taken device_sem, and we're
walking the list (all modifications are protected by device_sem).
struct device::lock, and the helpers to lock/unlock have been removed. No
one has ever used them, and no one is likely to use them.
On Tue, Nov 19, 2002 at 10:45:25AM +1100, Douglas Gilbert wrote:
> That directory (and all who sail in her, e.g. /proc/scsi/scsi)
> seems to have disappeared. When the scsi_debug module is
> loaded a /proc/scsi_debug/0 entry appears (that used to be
> /proc/scsi/scsi_debug/0).
>
> Doug Gilbert
It looks like the merge of Doug and Christoph's code dropped two calls
(unless the exit devfs_unregister was supposed to be removed).
Here's a patch for the addition of scsi_init_procfs, devfs_mk_dir and
bus_unregister calls, and a small reordering so calls in exit_scsi
match the reverse of those in init_scsi.
Douglas Gilbert [Tue, 19 Nov 2002 13:19:09 +0000 (07:19 -0600)]
scsi_debug 1.65 for lk 2.5.48
The scsi_debug version in lk 2.5.48 is the second last one
I sent to this list. So this patch includes the changes from
the last one I sent:
- fix "in use" counting [hch]
- clean up bios_param() code
It also merges a sysfs re-organisation from Mike Anderson.
[PATCH] rationalize allocation and freeing of struct scsi_device
Currently allocation and freeing of struct scsi_device is a mess.
We have two nice functions in scsi_scan.c (scsi_allocate_sdev/
scsi_free_sdev) that are the right interfaces to deal with it, so I moved
them to scsi and made them non-static. I've changed all functions
allocation freeing them to use it.
Chris Wright [Tue, 19 Nov 2002 11:01:48 +0000 (03:01 -0800)]
[PATCH] remove duplicated assignment from sys_capget.
This removes the code from cap_sysget that fills out the capability set
being returned to userspace. The module handles this in a policy
specific way. This updates the dummy.c module to fill in return data
according to superuser policy, and also disables setting capabilities in
superuser policy.
Patrick Mochel [Tue, 19 Nov 2002 07:33:36 +0000 (01:33 -0600)]
sysfs: do permission checking on open.
sysfs has always had a bug that would allow a read-only file to be opened
for writing. It has also returned 0 on write when there was no store method
defined for the file.
This addresses both via sysfs_open_file(). It checks the flags the file was
opened with and compares them with the mode of the inode. If the mode does
not support the flags passed, -EPERM is returned.
If the sysfs_ops for the object does not have the correct method for the
flags, -EACCESS is returned.
Since all checks happen on open(), the corresponding checks in the read()
and write() methods have been removed.
Patrick Mochel [Mon, 18 Nov 2002 15:46:04 +0000 (09:46 -0600)]
kobject - expose backend helpers to registration interface.
The interface should now be more sane and protect against races better.
kobject_register() was split into two helpers: kobject_init() and kobject_add().
It calls both consecutively, though both are also exposed for use by users
that want to use the objects w/o adding them to the object hierarchy.
kobject_unregister() was made simply a wrapper for kobject_del() and
kobject_put(), which are both also exposed. The guts of kobject_put() was
moved into kobject_cleanup(), which it calls when the reference count hits
0. (This was done for clarity).
The infrastructure now takes a lot in kobject_get() and kobject_put() when
checking and modifying the objects' reference counts. This was an obvious
one that hsould have been fixed long ago.
kobject_add() increments the refcount of the object, which is decremented
when kobject_del() is called. This guarantees that the object's memory
cannot be freed if it has been added to the hierarchy, and kobject_del()
has not been called on it.
kobject_init() is now the function that increments the refcount on the
object's subsystem, which is decremented only after its release() method
has been called for the object in kobject_cleanup().
The documentation has been updated to reflect these changes.