Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 04-08-12, 11:44 AM   #1
uOpt
FreeBSD cheering section
 
uOpt's Avatar
 
Join Date: Nov 2004
Location: Boston, MA, USA
Posts: 609
Default Interesting observation with nvidia-settings and stderr redirection

If you redirect stderr (although nothing is printed on stderr), some but not all values disappear.

Code:
nvidia-settings -c :8.0 -q all 2>&1 |  egrep "Attribute '(ThermalSensorReading|GPUCurrentFanSpeed)'" | tee l
  Attribute 'GPUCurrentFanSpeed' (wavehh.hanse.de:8[fan:0]): 40.
  Attribute 'ThermalSensorReading' (wavehh.hanse.de:8[thermalsensor:0]):
  Attribute 'ThermalSensorReading' (wavehh.hanse.de:8[thermalsensor:1]):
  Attribute 'ThermalSensorReading' (wavehh.hanse.de:8[thermalsensor:2]):
Code:
nvidia-settings -c :8.0 -q all |  egrep "Attribute '(ThermalSensorReading|GPUCurrentFanSpeed)'" | tee l
  Attribute 'GPUCurrentFanSpeed' (wavehh.hanse.de:8[fan:0]): 40.
  Attribute 'ThermalSensorReading' (wavehh.hanse.de:8[thermalsensor:0]): 74.
  Attribute 'ThermalSensorReading' (wavehh.hanse.de:8[thermalsensor:1]): 64.
  Attribute 'ThermalSensorReading' (wavehh.hanse.de:8[thermalsensor:2]): 59.
__________________

My Unix benchmark results
uOpt is offline   Reply With Quote
Old 04-09-12, 07:17 AM   #2
sandipt
NVIDIA Corporation
 
sandipt's Avatar
 
Join Date: Dec 2010
Posts: 260
Default Re: Interesting observation with nvidia-settings and stderr redirection

Is this specific to your system, motherboard OR GPU ? Please attach logs by running nvidia-bug-report.sh as root user.
How frequently this happens ?
sandipt is offline   Reply With Quote
Old 04-09-12, 08:51 PM   #3
uOpt
FreeBSD cheering section
 
uOpt's Avatar
 
Join Date: Nov 2004
Location: Boston, MA, USA
Posts: 609
Default Re: Interesting observation with nvidia-settings and stderr redirection

It happens on several systems that have nothing in common except for having NVidia video cards. This looks purely like a userland issue with nvidia-settings or libraries it links to.

It happens every time and can be reproduced just by copy'n'pasting the two commands. I edited them for you for easier cut'n'paste since I use $DISPLAY=:8.x.

Code:
#works:
 DISPLAY=:0.0 nvidia-settings -q all |  egrep "Attribute '(ThermalSensorReading|GPUCurrentFanSpeed)'" 
# redirection breaks it, number is missing:
DISPLAY=:0.0 nvidia-settings -q all 2>&1 |  egrep "Attribute '(ThermalSensorReading|GPUCurrentFanSpeed)'"
__________________

My Unix benchmark results
uOpt is offline   Reply With Quote
Old 04-10-12, 01:06 AM   #4
sandipt
NVIDIA Corporation
 
sandipt's Avatar
 
Join Date: Dec 2010
Posts: 260
Default Re: Interesting observation with nvidia-settings and stderr redirection

I am not observing this issue with Quadro 4000 on Dell Workstation system T7500.
sandipt is offline   Reply With Quote
Old 04-10-12, 05:44 AM   #5
leigh123linux
Registered User
 
leigh123linux's Avatar
 
Join Date: Feb 2008
Posts: 163
Default Re: Interesting observation with nvidia-settings and stderr redirection

Works ok here
Code:
[leigh@main-pc ~]$ DISPLAY=:0.0 nvidia-settings -q all |  egrep "Attribute '(ThermalSensorReading|GPUCurrentFanSpeed)'" 
  Attribute 'GPUCurrentFanSpeed' (main-pc.home:0[fan:0]): 40.
  Attribute 'ThermalSensorReading' (main-pc.home:0[thermalsensor:0]): 41.
[leigh@main-pc ~]$ DISPLAY=:0.0 nvidia-settings -q all 2>&1 |  egrep "Attribute '(ThermalSensorReading|GPUCurrentFanSpeed)'"
  Attribute 'GPUCurrentFanSpeed' (main-pc.home:0[fan:0]): 40.
  Attribute 'ThermalSensorReading' (main-pc.home:0[thermalsensor:0]): 44.
[leigh@main-pc ~]$
__________________
leigh123linux
leigh123linux is offline   Reply With Quote
Old 04-11-12, 12:43 PM   #6
uOpt
FreeBSD cheering section
 
uOpt's Avatar
 
Join Date: Nov 2004
Location: Boston, MA, USA
Posts: 609
Default Re: Interesting observation with nvidia-settings and stderr redirection

I don't know why you can't see the same thing, or why only some attributes are affected and others are not.

However, an strace of this clearly shows a storm of
Code:
3348  ioctl(2, TIOCGWINSZ, {ws_row=83, ws_col=264, ws_xpixel=1867, ws_ypixel=1166}) = 0
That's not gonna work right if fd 2 isn't connected to the terminal. The straces clearly show that you do it regardless of whether fd 2 goes to the tty or is redirected. It seems a safe bet that not doing this to non-terminals will solve this problem.

ETA: You also do that "ioctl(2, ..." a total of 10404 times for the above command. That is probably one reason why it's so slow.
__________________

My Unix benchmark results
uOpt is offline   Reply With Quote
Old 04-11-12, 01:23 PM   #7
uOpt
FreeBSD cheering section
 
uOpt's Avatar
 
Join Date: Nov 2004
Location: Boston, MA, USA
Posts: 609
Default Re: Interesting observation with nvidia-settings and stderr redirection

Allright, so here is what happens:

you try to figure out the terminal size and then you do a manual line break at word boundaries. That makes the number drop to the next line and hence un-grepable in some cases.

The reason why you don't see it is that your wimpy hostnames are shorter than my awesome one Try narrowing the window and then do the one without redirection again.

In the case of fd2 not being connected to the terminal the whole thing seems to default to 80, which makes yours work (thanks to the short hostname) and mine fail regardless of actual window size. It seems to me that defaulting to INT_MAX would be the right fix for this.
__________________

My Unix benchmark results
uOpt is offline   Reply With Quote
Old 04-12-12, 08:59 AM   #8
bugspray
Registered User
 
Join Date: Sep 2005
Posts: 27
Default Re: Interesting observation with nvidia-settings and stderr redirection

This has been an issue since at least 2008. Here is a comment from a script last modifed that year:

NV="nvidia-settings -c $MHD -q [gpu:$G]/FrameLockMasterable[${K}-$P]"
# unbelievable. Running $NV 2>/dev/null gives different output than just running $NV
# even when no error.
bugspray is offline   Reply With Quote

Old 04-12-12, 01:34 PM   #9
uOpt
FreeBSD cheering section
 
uOpt's Avatar
 
Join Date: Nov 2004
Location: Boston, MA, USA
Posts: 609
Default Re: Interesting observation with nvidia-settings and stderr redirection

Now that you say it, I think I might have reported this before. Like years ago.
__________________

My Unix benchmark results
uOpt is offline   Reply With Quote
Old 04-12-12, 04:28 PM   #10
Plagman
NVIDIA Corporation
 
Plagman's Avatar
 
Join Date: Sep 2007
Posts: 254
Default Re: Interesting observation with nvidia-settings and stderr redirection

You'd think the army of open-source hackers would have sent in a patch by now if it was reported years ago.

git://people.freedesktop.org/~aplattner/nvidia-settings
Plagman is offline   Reply With Quote
Old 04-13-12, 06:19 AM   #11
sandipt
NVIDIA Corporation
 
sandipt's Avatar
 
Join Date: Dec 2010
Posts: 260
Default Re: Interesting observation with nvidia-settings and stderr redirection

NVIDIA internal Bug ID: 969308 to track this issue.
sandipt is offline   Reply With Quote
Old 04-13-12, 11:57 AM   #12
danix
NVIDIA Corporation
 
danix's Avatar
 
Join Date: Feb 2010
Location: Santa Clara, CA
Posts: 237
Default Re: Interesting observation with nvidia-settings and stderr redirection

Like Plagman says, you can easily change the default width to anything you want: see DEFAULT_MAX_WIDTH in src/msg.c. I think that defaulting to < 80 characters and defaulting to INT_MAX are both reasonable, for different reasons. Redirecting std{err,out} is a pretty common use case and when doing so, I imagine that we can often expect that the file descriptors won't be associated with any terminal, which might tip the scales slightly in the favor of INT_MAX.
danix is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:27 PM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.