Re: SYSFS "errors"

2013-02-19 Thread Felipe Balbi
On Tue, Feb 19, 2013 at 11:35:21AM -0300, Mauro Carvalho Chehab wrote: > Em Tue, 19 Feb 2013 14:50:56 +0100 > Borislav Petkov escreveu: > > > On Tue, Feb 19, 2013 at 03:38:09PM +0200, Felipe Balbi wrote: > > > because changing the permission will cause the same issue: > > > > Actually, I take th

Re: SYSFS "errors"

2013-02-19 Thread Borislav Petkov
On Tue, Feb 19, 2013 at 11:35:21AM -0300, Mauro Carvalho Chehab wrote: > That's covers everything but Hannes arguments. I don't think that > adding just one more device_create_file() on a driver that creates > dozens (or hundreds) of sys nodes, depending on the number of DIMMS > on the system would

Re: SYSFS "errors"

2013-02-19 Thread Mauro Carvalho Chehab
Em Tue, 19 Feb 2013 14:50:56 +0100 Borislav Petkov escreveu: > On Tue, Feb 19, 2013 at 03:38:09PM +0200, Felipe Balbi wrote: > > because changing the permission will cause the same issue: > > Actually, I take that back. Mauro's patch will already create the file > anyway: > > if (mci->set

Re: SYSFS "errors"

2013-02-19 Thread Felipe Balbi
Hi, On Tue, Feb 19, 2013 at 11:14:40AM -0300, Mauro Carvalho Chehab wrote: > > Please consider adding a default attribute which return '-EINVAL' or > > somesuch when the function pointers are not set. > > But _not_ adding it via device_create_file(). That's evil. > > This thread started with Fel

Re: SYSFS "errors"

2013-02-19 Thread Mauro Carvalho Chehab
Em Tue, 19 Feb 2013 14:58:07 +0100 Hannes Reinecke escreveu: > On 02/19/2013 02:50 PM, Borislav Petkov wrote: > > On Tue, Feb 19, 2013 at 03:38:09PM +0200, Felipe Balbi wrote: > >> because changing the permission will cause the same issue: > > > > Actually, I take that back. Mauro's patch will al

Re: SYSFS "errors"

2013-02-19 Thread Borislav Petkov
On Tue, Feb 19, 2013 at 02:58:07PM +0100, Hannes Reinecke wrote: > Please consider adding a default attribute which return '-EINVAL' or > somesuch when the function pointers are not set. But _not_ adding it > via device_create_file(). That's evil. This is what we do now. We probably could add the

Re: SYSFS "errors"

2013-02-19 Thread Hannes Reinecke
On 02/19/2013 02:50 PM, Borislav Petkov wrote: On Tue, Feb 19, 2013 at 03:38:09PM +0200, Felipe Balbi wrote: because changing the permission will cause the same issue: Actually, I take that back. Mauro's patch will already create the file anyway: if (mci->set_sdram_scrub_rate || mci->

Re: SYSFS "errors"

2013-02-19 Thread Borislav Petkov
On Tue, Feb 19, 2013 at 10:50:48AM -0300, Mauro Carvalho Chehab wrote: > It is actually worse, as if someone is using a C code to open the device > with > fp = open ("/sys/devices/system/edac/mc/mc0/sdram_scrub_rate", O_RDWR); > > It will now start to fail if the device doesn't have both per

Re: SYSFS "errors"

2013-02-19 Thread Mauro Carvalho Chehab
Em Tue, 19 Feb 2013 15:38:09 +0200 Felipe Balbi escreveu: > Hi, > > On Tue, Feb 19, 2013 at 02:28:54PM +0100, Borislav Petkov wrote: > > On Tue, Feb 19, 2013 at 03:15:00PM +0200, Felipe Balbi wrote: > > > what's the problem with that ? > > > > Not a problem - simply annoying. > > > > $ ./test.

Re: SYSFS "errors"

2013-02-19 Thread Borislav Petkov
On Tue, Feb 19, 2013 at 03:38:09PM +0200, Felipe Balbi wrote: > because changing the permission will cause the same issue: Actually, I take that back. Mauro's patch will already create the file anyway: if (mci->set_sdram_scrub_rate || mci->get_sdram_scrub_rate) Adjusting the permissions

Re: SYSFS "errors"

2013-02-19 Thread Mauro Carvalho Chehab
Em Tue, 19 Feb 2013 14:06:26 +0100 Borislav Petkov escreveu: > > No, on both cases, open() will return an error (-ENOENT against -EPERM). > > What if it is a shell script doing: > > cat /sys/devices/system/edac/mc/mc0/sdram_scrub_rate > > or similar? Well, cat will return "1" if an error is f

Re: SYSFS "errors"

2013-02-19 Thread Felipe Balbi
Hi, On Tue, Feb 19, 2013 at 02:28:54PM +0100, Borislav Petkov wrote: > On Tue, Feb 19, 2013 at 03:15:00PM +0200, Felipe Balbi wrote: > > what's the problem with that ? > > Not a problem - simply annoying. > > $ ./test.sh > cat: /path/to/file/that/doesnt/exist.txt: No such file or directory > Set

Re: SYSFS "errors"

2013-02-19 Thread Borislav Petkov
On Tue, Feb 19, 2013 at 03:15:00PM +0200, Felipe Balbi wrote: > what's the problem with that ? Not a problem - simply annoying. $ ./test.sh cat: /path/to/file/that/doesnt/exist.txt: No such file or directory Setting scrubrate to: I'm sure someone would ask themselves why all of a sudden the file

Re: SYSFS "errors"

2013-02-19 Thread Felipe Balbi
On Tue, Feb 19, 2013 at 02:06:26PM +0100, Borislav Petkov wrote: > On Tue, Feb 19, 2013 at 09:46:40AM -0300, Mauro Carvalho Chehab wrote: > > Ah, now I see what you're meaning. That would require to dynamically > > create a per-mci DEVICE_ATTR(). > > Dude, look at the code, we do that already. And

Re: SYSFS "errors"

2013-02-19 Thread Borislav Petkov
On Tue, Feb 19, 2013 at 09:46:40AM -0300, Mauro Carvalho Chehab wrote: > Ah, now I see what you're meaning. That would require to dynamically > create a per-mci DEVICE_ATTR(). Dude, look at the code, we do that already. And you're using it with dev_attr_sdram_scrub_rate. Simply change the permiss

Re: SYSFS "errors"

2013-02-19 Thread Mauro Carvalho Chehab
Em Tue, 19 Feb 2013 13:35:02 +0100 Borislav Petkov escreveu: > On Tue, Feb 19, 2013 at 09:16:10AM -0300, Mauro Carvalho Chehab wrote: > > I'm not sure if is there a way to pass fs permissions to something similar > > to device_create_file(). > > struct device_attribute.attr.mode? I.e., second ar

Re: SYSFS "errors"

2013-02-19 Thread Borislav Petkov
On Tue, Feb 19, 2013 at 09:16:10AM -0300, Mauro Carvalho Chehab wrote: > I'm not sure if is there a way to pass fs permissions to something similar > to device_create_file(). struct device_attribute.attr.mode? I.e., second arg. > On both cases, an error will happen at open: > - if file does

Re: SYSFS "errors"

2013-02-19 Thread Mauro Carvalho Chehab
Em Tue, 19 Feb 2013 12:43:46 +0100 Borislav Petkov escreveu: > On Tue, Feb 19, 2013 at 08:11:49AM -0300, Mauro Carvalho Chehab wrote: > > > > I remember I saw some discussions about it in the past at bluesmoke ML, > > > > saying that -ENODEV is the expected behavior when this is not supported. >

Re: SYSFS "errors"

2013-02-19 Thread Borislav Petkov
On Tue, Feb 19, 2013 at 08:11:49AM -0300, Mauro Carvalho Chehab wrote: > > > I remember I saw some discussions about it in the past at bluesmoke ML, > > > saying that -ENODEV is the expected behavior when this is not supported. > > > > > > Changing from -ENODEV to "N/A" will break anything that wo

Re: SYSFS "errors"

2013-02-19 Thread Mauro Carvalho Chehab
Em Tue, 19 Feb 2013 12:11:21 +0200 Felipe Balbi escreveu: > Hi, > > On Tue, Feb 19, 2013 at 07:03:10AM -0300, Mauro Carvalho Chehab wrote: > > > But my gut feeling says to stay concervative and not touch this code - > > > we don't know what uses it and how much we would break by "fixing" it. > >

Re: SYSFS "errors"

2013-02-19 Thread Felipe Balbi
+netdev On Tue, Feb 19, 2013 at 08:41:47AM +0100, Alexander Stein wrote: > On Monday 18 February 2013 09:49:16, Greg KH wrote: > > > Invalid argument - /sys/devices/virtual/net/lo/speed > > > Invalid argument - /sys/devices/virtual/net/lo/duplex > > This is even true for ethernet devices which do

Re: SYSFS "errors"

2013-02-19 Thread Felipe Balbi
Hi, On Tue, Feb 19, 2013 at 07:03:10AM -0300, Mauro Carvalho Chehab wrote: > > But my gut feeling says to stay concervative and not touch this code - > > we don't know what uses it and how much we would break by "fixing" it. > > The current situation is not that big of a deal IMVHO and I'd be will

Re: SYSFS "errors"

2013-02-19 Thread Mauro Carvalho Chehab
Em Mon, 18 Feb 2013 23:44:05 +0100 Borislav Petkov escreveu: > On Mon, Feb 18, 2013 at 02:26:18PM -0800, Greg KH wrote: > > I don't know, it depends on if userspace can handle this properly or > > not. What tools rely on this sysfs file? WHat happens when they get a > > non-number in the file? T

Re: SYSFS "errors"

2013-02-18 Thread Alexander Stein
On Monday 18 February 2013 09:49:16, Greg KH wrote: > > Invalid argument - /sys/devices/virtual/net/lo/speed > > Invalid argument - /sys/devices/virtual/net/lo/duplex This is even true for ethernet devices which do not have a link currently or non-ethernet devices (e.g. CAN). > LANG=C cat /sys/cl

Re: SYSFS "errors"

2013-02-18 Thread Borislav Petkov
On Mon, Feb 18, 2013 at 02:26:18PM -0800, Greg KH wrote: > I don't know, it depends on if userspace can handle this properly or > not. What tools rely on this sysfs file? WHat happens when they get a > non-number in the file? I'm not aware of any, frankly speaking. If there are any, those tools s

Re: SYSFS "errors"

2013-02-18 Thread Greg KH
On Mon, Feb 18, 2013 at 11:13:06PM +0100, Borislav Petkov wrote: > On Mon, Feb 18, 2013 at 01:54:34PM -0800, Greg KH wrote: > > Because sysfs is "one value per file" the lack of a file showing up > > shouldn't cause any userspace tools any problems, that is why we did > > things this way. > > > > B

Re: SYSFS "errors"

2013-02-18 Thread Borislav Petkov
On Mon, Feb 18, 2013 at 01:54:34PM -0800, Greg KH wrote: > Because sysfs is "one value per file" the lack of a file showing up > shouldn't cause any userspace tools any problems, that is why we did > things this way. > > But, of course, userspace programmers do know how to mess things up... How ab

Re: SYSFS "errors"

2013-02-18 Thread Felipe Balbi
On Mon, Feb 18, 2013 at 04:48:06PM -0500, Alan Stern wrote: > On Mon, 18 Feb 2013, Felipe Balbi wrote: > > > Hi, On Mon, Feb 18, 2013 at 09:49:16AM -0800, Greg KH wrote: > > > > Input/output error - /sys/devices/cpu/power/autosuspend_delay_ms > > > > > > The issue with this file is, if the power.

Re: SYSFS "errors"

2013-02-18 Thread Greg KH
On Mon, Feb 18, 2013 at 06:47:42PM -0300, Mauro Carvalho Chehab wrote: > In the past, the sysfs node creation was done using the raw sysfs support. > Doing dynamic creation with the old code were much more complex. I guess > that's the reason why the code was written this way. Now that the code >

Re: SYSFS "errors"

2013-02-18 Thread Mauro Carvalho Chehab
Em Mon, 18 Feb 2013 22:05:42 +0200 Felipe Balbi escreveu: > Hi, > > On Mon, Feb 18, 2013 at 04:46:38PM -0300, Mauro Carvalho Chehab wrote: > > > > > No such device - /sys/devices/system/edac/mc/mc0/sdram_scrub_rate > > > > > > > > Odd, go ask the edac developers > > > > > > will do ;-) > > >

Re: SYSFS "errors"

2013-02-18 Thread Alan Stern
On Mon, 18 Feb 2013, Felipe Balbi wrote: > Hi, On Mon, Feb 18, 2013 at 09:49:16AM -0800, Greg KH wrote: > > > Input/output error - /sys/devices/cpu/power/autosuspend_delay_ms > > > > The issue with this file is, if the power.use_autosuspend flag is not > > set for the device, then it can't be rea

Re: SYSFS "errors"

2013-02-18 Thread Felipe Balbi
Hi, On Mon, Feb 18, 2013 at 04:46:38PM -0300, Mauro Carvalho Chehab wrote: > > > > No such device - /sys/devices/system/edac/mc/mc0/sdram_scrub_rate > > > > > > Odd, go ask the edac developers > > > > will do ;-) > > Well, the question is missing ;) /me assumes that you want to talk about > sus

Re: SYSFS "errors"

2013-02-18 Thread Felipe Balbi
On Mon, Feb 18, 2013 at 08:40:32PM +0100, Borislav Petkov wrote: > On Mon, Feb 18, 2013 at 08:47:35PM +0200, Felipe Balbi wrote: > > On Mon, Feb 18, 2013 at 06:45:27PM +0100, Borislav Petkov wrote: > > > On Mon, Feb 18, 2013 at 07:27:00PM +0200, Felipe Balbi wrote: > > > > No such device - /sys/dev

Re: SYSFS "errors"

2013-02-18 Thread Mauro Carvalho Chehab
Em Mon, 18 Feb 2013 20:46:33 +0200 Felipe Balbi escreveu: > Hi, On Mon, Feb 18, 2013 at 09:49:16AM -0800, Greg KH wrote: > > > Input/output error - /sys/devices/cpu/power/autosuspend_delay_ms > > > > The issue with this file is, if the power.use_autosuspend flag is not > > set for the device, th

Re: SYSFS "errors"

2013-02-18 Thread Borislav Petkov
On Mon, Feb 18, 2013 at 08:47:35PM +0200, Felipe Balbi wrote: > On Mon, Feb 18, 2013 at 06:45:27PM +0100, Borislav Petkov wrote: > > On Mon, Feb 18, 2013 at 07:27:00PM +0200, Felipe Balbi wrote: > > > No such device - /sys/devices/system/edac/mc/mc0/sdram_scrub_rate > > > > Looks like your edac mo

Re: SYSFS "errors"

2013-02-18 Thread Felipe Balbi
On Mon, Feb 18, 2013 at 06:45:27PM +0100, Borislav Petkov wrote: > On Mon, Feb 18, 2013 at 07:27:00PM +0200, Felipe Balbi wrote: > > No such device - /sys/devices/system/edac/mc/mc0/sdram_scrub_rate > > Looks like your edac module doesn't allow scrub rate setting. Which edac > driver is that? dmes

Re: SYSFS "errors"

2013-02-18 Thread Felipe Balbi
Hi, On Mon, Feb 18, 2013 at 09:49:16AM -0800, Greg KH wrote: > > Input/output error - /sys/devices/cpu/power/autosuspend_delay_ms > > The issue with this file is, if the power.use_autosuspend flag is not > set for the device, then it can't be read or written to. This flag > changes dynamically wi

Re: SYSFS "errors"

2013-02-18 Thread Greg KH
On Mon, Feb 18, 2013 at 07:27:00PM +0200, Felipe Balbi wrote: > On Mon, Feb 18, 2013 at 09:13:34AM -0800, Greg KH wrote: > > On Mon, Feb 18, 2013 at 05:52:15PM +0200, Felipe Balbi wrote: > > > Hi, > > > > > > On Mon, Feb 18, 2013 at 07:50:12AM -0800, Greg KH wrote: > > > > > If it helps in any way

Re: SYSFS "errors"

2013-02-18 Thread Borislav Petkov
On Mon, Feb 18, 2013 at 07:27:00PM +0200, Felipe Balbi wrote: > No such device - /sys/devices/system/edac/mc/mc0/sdram_scrub_rate Looks like your edac module doesn't allow scrub rate setting. Which edac driver is that? dmesg? Thanks. -- Regards/Gruss, Boris. Sent from a fat crate under my

Re: SYSFS "errors"

2013-02-18 Thread Greg KH
On Mon, Feb 18, 2013 at 05:52:15PM +0200, Felipe Balbi wrote: > Hi, > > On Mon, Feb 18, 2013 at 07:50:12AM -0800, Greg KH wrote: > > > If it helps in any way, I have printed below only the filenames > > > (without path) so I could pipe it through uniq: > > > > > > act_mask > > > audit > > > autos

Re: SYSFS "errors"

2013-02-18 Thread Felipe Balbi
Hi, On Mon, Feb 18, 2013 at 07:50:12AM -0800, Greg KH wrote: > > If it helps in any way, I have printed below only the filenames > > (without path) so I could pipe it through uniq: > > > > act_mask > > audit > > autosuspend_delay_ms > > bind > > This one the driver core creates, I'll fix that up

Re: SYSFS "errors"

2013-02-18 Thread Greg KH
On Mon, Feb 18, 2013 at 05:33:16PM +0200, Felipe Balbi wrote: > Hi folks, > > there are today a number of SYSFS files with read permission set but > can't really be read (tried with normal user and root). To make things > simpler, I wrote a simple ruby script (see below) to check if the file > is

SYSFS "errors"

2013-02-18 Thread Felipe Balbi
Hi folks, there are today a number of SYSFS files with read permission set but can't really be read (tried with normal user and root). To make things simpler, I wrote a simple ruby script (see below) to check if the file is world writeable or if it has Read permission but throws an exception when

[PATCH 2/9] drivers/dma: handle sysfs errors

2007-03-02 Thread Chris Leech
From: Jeff Garzik <[EMAIL PROTECTED]> Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]> Signed-off-by: Chris Leech <[EMAIL PROTECTED]> --- drivers/dma/dmaengine.c | 22 -- 1 files changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dma

Re: [PATCH] hwmon/abituguru: handle sysfs errors

2006-12-02 Thread Jean Delvare
Hans, On Tue, 10 Oct 2006 11:18:33 +0200, Hans de Goede wrote: > Jean Delvare wrote: > > The patch isn't wrong per se, but it could be made more simple, and is > > incomplete in comparison to what was done for all other hardware > > monitoring drivers: > > > > * We want to create all the files be