[ofa-general] Re: [PATCH] ibim/ibsim.c Fixed ibsim console so it doesn't eat up all CPU when creading from a pipe
Nicolas Morey-Chaisemartin
devel at morey-chaisemartin.com
Fri Mar 20 09:04:51 PDT 2009
Sasha Khapyorsky a écrit :
> On 13:59 Fri 20 Mar , Nicolas Morey Chaisemartin wrote:
>> @@ -618,7 +619,8 @@ static int sim_run(int con_fd)
>> for (;;) {
>> FD_ZERO(&rfds);
>> FD_SET(simctl, &rfds);
>> - FD_SET(con_fd, &rfds);
>> + if(console)
>> + FD_SET(con_fd, &rfds);
>> for (i = 0; i < IBSIM_MAX_CLIENTS; i++)
>> if (clients[i].pid)
>> FD_SET(clients[i].fd, &rfds);
>> @@ -634,7 +636,8 @@ static int sim_run(int con_fd)
>> sim_read_pkt(clients[i].fd, i);
>>
>> if (FD_ISSET(con_fd, &rfds))
>> - sim_run_console(con_fd);
>> + if(sim_run_console(con_fd)<=0)
>> + console = 0;
>
> Then one occasional failure will disable the console forever.
> Wouldn't it be better to analyze HUP state (similar to as it is done
> with OpenSM console)?
>
> Sasha
I guess so but in which case would it fail?
I'm not really good at poll/select and such so I did it my way ;)
We are running hundred thousand of tests using ibsim and it's much faster when not using a whole CPU for itself !
I look for a cleaner way to do this tommorow.
Nicolas
More information about the general
mailing list