From: Milton Miller <miltonm@bga.com>
To: Greg KH <greg@kroah.com>
Cc: Michael Ellerman <michael@ellerman.id.au>,
linux-kernel <linux-kernel@vger.kernel.org>,
Jesse Barnes <jbarnes@virtuousgeek.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-pci@vger.kernel.org
Subject: Re: [PATCH/RFC] pci: dynids.use_driver_data considered harmful
Date: Sat, 12 Jul 2008 16:08:13 -0500 [thread overview]
Message-ID: <e6b3109a0ab047bea58ceecb8734761d@bga.com> (raw)
In-Reply-To: <20080712041137.GA5933@kroah.com>
For those on lkml, I mistyped the address in the first mail. I just
did a second pass edit on the long debug session prompting this patch
fixed the cc to linux-kernel. So all those not on linux-pci should
be seeing that shortly, or one can look in mmotm.
On Jul 11, 2008, at 11:11 PM, Greg KH wrote:
> On Thu, Jul 10, 2008 at 04:29:37PM -0500, Milton Miller wrote:
>> The driver flag dynids.use_driver_data is almost consistently not
>> set, and
>> causes more problems than it solves. The only use of this flag is to
>> prevent the system administrator from telling a pci driver additional
>> data
>> when adding a dynamic match table entry via sysfs.
>>
>> We do not as a policy protect the kernel from bad acts by root.
>
> But we can try.
>
> As you found out, this flag should have been set in that specific
> driver, right? Why not just fix the driver instead of declaring that
> the flag is not useful at all, despite it actually being used properly
> by a number of drivers already?
Its not one driver, its more like 100 to 150.
Why is giving the driver the data it needs to support a card bad?
The debug session shows that not giving it the data it needs
is worse.
Worse, the kernel thinks it superior to the human and actively ignores
input with out even telling the user it did so.
The only argument I can come up with is if the data is a pointer, then
its likely that that root will not be able to find the correct value or
put it in a script that doesn't get updated on the next kernel install
and causes a crash. Root isn't likely to add driver data unless it
discovers that it is needed, so the existing default of passing 0
should remain.
If you want to argue that being able to tell the driver that it should
treat this card like card X is wrong, you should be arguing that the
whole notion of adding match table entries to the driver is wrong.
When it comes down to it, its the same thing. Yet, we support adding
ids today. The feature was added, and is used successfully with many
drivers. I'm trying to extend the population of drivers where it works
to include those that support more than one similar card but need to
know which one they are dealing with.
You left out:
>> Searching the next-20080709 tree shows the bit is set by exactly 3 pci
>> drivers. However, the use of per-match-entry driver data is much more
>> prevalent: A boot of allyesconfig on a powerpc64 pseries with a debug
>> patch
>> shows 27 drivers apparently use the field for a pointer, 14 use it for
>> setting flags, and 98 use it as a table index. (Pointers are defined
>> as
>> >PAGE_OFFSET, aka in the 64 bit kernel linear mapping. Flags are
>> defined as
>> the maximum value exceeds the number of entries in the match table.
>> Any
>> other nonzero value is classified as an index).
I did the work to establish the scope of the problem.
So 3 drivers set the flag. 98 + 14 should set it immediately. The 27
that
use the value as a pointer probably can be re-written to use it as an
index. And
the hundreds of other drivers (I don't have the tree here to count)
apparently
don't care, as they most likely never look at that field. (I am
ingoring
conditional copiles that are not enabled by all-yes-config).
> So no, this patch is not good, it should stay as-is.
Obviously I disagree.
Since we added passing the id table entry to get the driver data from
the
table entry, we have close to 150 drivers that use it, instead of old
methods
such has hard coded lists of chips in case statements. Besides making
it easier
to maintain the driver, it actually improves the chances that the
driver can be
used on a new revision or subsystem id of the card.
But we have not been reviewing the setting of the flag with the use in
the driver.
A usage pattern of storing an index or flags has developed, and I claim
that the
flag now hurts more than it helps.
milton
next prev parent reply other threads:[~2008-07-12 21:06 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-10 21:12 [RFC] (almost) booting allyesconfig -- please don't poke super-io without request_region Milton Miller
2008-07-10 21:14 ` mtd: remove __PPC__ hardcoded address from nand/diskonchip and devices/docprobe Milton Miller
2008-07-10 21:33 ` [lm-sensors] [RFC] (almost) booting allyesconfig -- please don't poke super-io without request_region Hans de Goede
2008-07-10 21:51 ` Milton Miller
2008-07-11 6:52 ` Jean Delvare
2008-07-11 7:27 ` Hans de Goede
2008-07-11 7:36 ` Jean Delvare
2008-07-13 6:31 ` Hans de Goede
2008-07-13 21:11 ` [lm-sensors] " David Hubbard
2008-07-13 21:22 ` Hans de Goede
2008-07-13 21:26 ` David Hubbard
2008-07-14 7:59 ` Jean Delvare
2008-07-14 17:09 ` Milton Miller
2008-07-14 17:30 ` [lm-sensors] " Hans de Goede
2008-07-14 17:55 ` David Hubbard
2008-07-15 8:36 ` Jean Delvare
2008-07-15 15:31 ` David Hubbard
2008-07-16 7:46 ` Jean Delvare
2008-07-16 8:09 ` Rene Herman
2008-07-15 8:28 ` Jean Delvare
[not found] ` <for-27-patch9@bga.com>
2008-07-12 20:02 ` [PATCH/RESEND] pci: dynids.use_driver_data considered harmful Milton Miller
2008-07-12 20:17 ` Greg KH
2008-07-12 20:58 ` Jean Delvare
2008-07-12 21:17 ` Milton Miller
2008-07-12 21:29 ` Milton Miller
[not found] ` <20080712041137.GA5933@kroah.com>
2008-07-12 21:08 ` Milton Miller [this message]
2008-07-12 22:48 ` [PATCH/RFC] " Milton Miller
2008-07-16 10:18 ` Milton Miller
2008-07-17 7:07 ` Greg KH
2008-07-17 14:36 ` Milton Miller
2008-08-06 7:31 ` Jean Delvare
2008-08-14 22:12 ` Greg KH
2008-08-15 14:50 ` Milton Miller
2008-08-15 15:50 ` Jean Delvare
2008-08-15 17:46 ` Jesse Barnes
2008-08-15 18:55 ` Jean Delvare
2008-08-15 19:15 ` Jesse Barnes
2008-08-16 6:22 ` Greg KH
2008-08-17 19:06 ` Jean Delvare
2008-08-18 3:50 ` Greg KH
2008-08-18 17:13 ` Jesse Barnes
2008-08-18 20:41 ` Jesse Barnes
2008-08-19 18:01 ` Milton Miller
2008-08-06 7:22 ` Jean Delvare
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=e6b3109a0ab047bea58ceecb8734761d@bga.com \
--to=miltonm@bga.com \
--cc=akpm@linux-foundation.org \
--cc=greg@kroah.com \
--cc=jbarnes@virtuousgeek.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=michael@ellerman.id.au \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome