|
|
#1 | |
|
bootstrapped user
Join Date: Sep 2008
Posts: 4
|
Hi All,
I am trying to run nvclock on my system so that I can slow down the fans on my two GeForce 6600's (which currently sound like jet engines). I downloaded the latest source and compiled it. When it ran I always got a segfault. I narrowed down the problem to the map_dev_mem function in src/backend/back_linux.c It is always returning -1 (error code EINVAL). Of course this causes a segfault when something tries to access the mapped data (there is no check for invalid mmap return in the code). Here are the relevant bits of code and the output it creates: Code:
static void *map_dev_mem (int fd, unsigned long Base, unsigned long Size)
{
void *base;
int mapflags = MAP_SHARED;
unsigned long realBase, alignOff;
realBase = (Base & ~((unsigned long)getpagesize() - 1));
alignOff = Base - realBase;
CBE_FPRINTF(stderr, "...getpagesize is %u - mask is 0x%x...\n", getpagesize(), ~(getpagesize() - 1));
CBE_FPRINTF(stderr, "...sizeof(Base) = %d...\n", sizeof(Base));
CBE_FPRINTF(stderr, "...calling mmap with the following args: \n\t 0, %u, %d, %u (0x%x) - Base %u (0x%x)...\n", Size, fd, realBase, realBase, Base, Base);
base = mmap((void *)0, Size + alignOff, PROT_READ|PROT_WRITE,
mapflags, fd, (off_t)realBase);
CBE_FPRINTF(stderr, "...map_dev_mem returning %p + %u...\n", base, alignOff);
return (void *) ((char *)base + alignOff);
}
Code:
...getpagesize is 4096 - mask is 0xfffff000...
...sizeof(Base) = 4...
...calling mmap with the following args:
0, 4096, 3, 3356495872 (0xc8101000) - Base 3356495872 (0xc8101000)...
...map_dev_mem returning 0xffffffff + 0...
...getpagesize is 4096 - mask is 0xfffff000...
...sizeof(Base) = 4...
...calling mmap with the following args:
0, 4096, 3, 3356491776 (0xc8100000) - Base 3356491776 (0xc8100000)...
...map_dev_mem returning 0xffffffff + 0...
...getpagesize is 4096 - mask is 0xfffff000...
...sizeof(Base) = 4...
...calling mmap with the following args:
0, 196607, 3, 3355443200 (0xc8000000) - Base 3355443200 (0xc8000000)...
...map_dev_mem returning 0xffffffff + 0...
...getpagesize is 4096 - mask is 0xfffff000...
...sizeof(Base) = 4...
...calling mmap with the following args:
0, 8192, 3, 3361738752 (0xc8601000) - Base 3361738752 (0xc8601000)...
...map_dev_mem returning 0xffffffff + 0...
...getpagesize is 4096 - mask is 0xfffff000...
...sizeof(Base) = 4...
...calling mmap with the following args:
0, 8192, 3, 3362258944 (0xc8680000) - Base 3362258944 (0xc8680000)...
...map_dev_mem returning 0xffffffff + 0...
...getpagesize is 4096 - mask is 0xfffff000...
...sizeof(Base) = 4...
...calling mmap with the following args:
0, 65535, 3, 3358588928 (0xc8300000) - Base 3358588928 (0xc8300000)...
...map_dev_mem returning 0xffffffff + 0...
strace confirms the error (output for last mmap call): Code:
mmap2(NULL, 65535, PROT_READ|PROT_WRITE, MAP_SHARED, 3, 0xc8300) = -1 EINVAL (Invalid argument) System specs: Ubuntu 7.10 i686 AMD Athlon XP 2400+ 2GB RAM Asus A8N-SLI Deluxe mobo 2x PNY nVidia GeForce 6600 SLI cards nVidia drivers: 100.14.19 My overall goal is just to be able to control the fan speeds on the 6600's, but I haven't found any other methods except for everyone raving about nvclock. Any help is appreciated. Thanks! |
|
|
|
|
|
|
#2 | |
|
Join Date: Jul 2002
Location: Netherlands, Europe
Posts: 2,105
|
Nvclock uses /dev/nvidia0 when it is available. The file is created when you load the nvidia kernel module but it is only activated when you enter X. If you don't have X running you could get this behavior. Nvclock can also use /dev/mem in such a case but that requires root ..
|
|
|
|
|
|
|
#3 |
|
bootstrapped user
Join Date: Sep 2008
Posts: 4
|
Hi Thunderbird,
Thanks for the reply. I am in an X session when running nvclock. Doing an ls -al on /dev/nvidia0 and /dev/nvidia1 shows a size of 195. (I'm not sure if the size reported by ls on character devices is reliable, though). How can I tell if these files are "activated"? Just by their existence? Code:
chad@svr-lnx:~$ ls -al /dev/nvi* crw-rw-rw- 1 root root 195, 0 2008-09-09 10:12 /dev/nvidia0 crw-rw-rw- 1 root root 195, 1 2008-09-09 10:13 /dev/nvidia1 crw-rw-rw- 1 root root 195, 255 2008-09-09 10:12 /dev/nvidiactl chad@svr-lnx:~$ Thanks for the help, -Chad |
|
|
|
|
|
#4 | |
|
bootstrapped user
Join Date: Sep 2008
Posts: 4
|
well, I figured out how to force /dev/mem
for those interested... in backend/backend_linux.c around line 170, change the switch statement to switch(0) to force /dev/mem: Code:
switch(0) //check_driver()
{
case 0:
nvclock.card[i].dev_name = (char*)strdup("/dev/mem");
nvclock.card[i].reg_address = reg_addr;
break;
case 1:
nvclock.card[i].dev_name = calloc(13, sizeof(char));
sprintf(nvclock.card[i].dev_name, "/dev/nvidia%d", nvclock.card[i].number);
nvclock.card[i].reg_address = 0;
break;
case 2:
nvclock.card[i].dev_name = calloc(13, sizeof(char));
sprintf(nvclock.card[i].dev_name, "/dev/nvidia%d", nvclock.card[i].number);
nvclock.card[i].reg_address = reg_addr;
break;
}
Unfortunately, my 6600's don't support fanspeed adjustment as I was greeted an error message when I tried to slow them down. Bummer. Oh well, I can always replace the fans, or just upgrade cards... Thanks again for the help! |
|
|
|
|
|
|
#5 |
|
Join Date: Jul 2002
Location: Netherlands, Europe
Posts: 2,105
|
Note that I don't support all fanspeed methods in nvclock. If it is supported on Windows I can offer it in nvclock as long as I know what register to modify. Wait a second you are using an SLI system. In that case for some reason /dev/nvidia1 is the primary card. When SLI is disabled /dev/nvidia0 is not active. I don't support this properly yet in the code.
|
|
|
|
|
|
#6 | |
|
bootstrapped user
Join Date: Sep 2008
Posts: 4
|
Hmm, I have SLI enabled on the system (set to "AFR" in xorg.conf). But, I haven't been able to control fanspeed under Windows either using RivaTuner or otherwise (using the same exact cards). So, I'm starting to wonder whether it is possible to change fanspeeds at all on these cards. However, after much googling and not finding a single statement that it is impossible to alter fanspeeds on 6600's, I am still somewhat hopeful there must be a way.
|
|
|
|
|
![]() |
| Thread Tools | |
|
|