[SLOF] [PATCH v3 1/6] Link libnet code to Paflof and add a wrapper for netboot()

Alexey Kardashevskiy aik at ozlabs.ru
Mon Oct 17 11:12:15 AEDT 2016


On 14/10/16 18:57, Thomas Huth wrote:
> On 13.10.2016 20:04, Thomas Huth wrote:
>> On 13.10.2016 01:41, Alexey Kardashevskiy wrote:
>>> On 12/10/16 21:44, Thomas Huth wrote:
>>>> Now that all necessary functions are provided by Paflof, too,
>>>> we can finally link the libnet code to this binary. To be able
>>>> to call the netboot() function from the Forth code now, we also
>>>> add a wrapper that takes the parameter string from the obp-tftp
>>>> package and converts it to an argv array that is expected by
>>>> the netboot() function.
>>>
>>> This breaks my netboot setup.
>> [...]
>>> What I get:
>>> ==============================================
>>> Trying to load:  from: /pci at 800000020000000/ethernet at 2 ...
>>>  Initializing NIC
>>>   Reading MAC address from device: c0:41:49:4b:00:00
>>>   Requesting information via DHCP: done
>>>   Using IPv4 address: 10.61.191.0
>>>   Requesting file "image.aiktest0" via TFTP from 10.61.2.7
>>>   Receiving data:  270 KBytes
>>>   TFTP: Received image.aiktest0 (270 KBytes)
>>>   Successfully loaded
>>>
>>> Try to netboot
>>>
>>>  Initializing NIC
>>>   Reading MAC address from device: c0:41:49:4b:00:00
>>>   Requesting information via DHCP:  010writemethod 'load' failed fffffbbc
>>> Error, can't read config file
>>
>> Bummer! I can reproduce this problem here. And I can fix it with the
>> following patch:
>>
>> -----------------------------------------------------------------------
>> diff a/slof/ppc64.c b/slof/ppc64.c
>> --- a/slof/ppc64.c
>> +++ b/slof/ppc64.c
>> @@ -180,7 +180,10 @@ int recv(int fd, void *buf, int len, int flags)
>>  	forth_push((unsigned long)buf);
>>  	forth_push(len);
>>
>> -	return forth_eval_pop("read");
>> +	forth_push((unsigned long)"read");
>> +	forth_push(4);
>> +	forth_push(fd_array[fd].ih);
>> +	return forth_eval_pop("$call-method");
>>  }
>>
>>  /**
>> @@ -200,7 +203,10 @@ int send(int fd, const void *buf, int len, int flags)
>>  	forth_push((unsigned long)buf);
>>  	forth_push(len);
>>
>> -	return forth_eval_pop("write");
>> +	forth_push((unsigned long)"write");
>> +	forth_push(5);
>> +	forth_push(fd_array[fd].ih);
>> +	return forth_eval_pop("$call-method");
>>  }
>>
>>  /**
>> -----------------------------------------------------------------------
>>
>> i.e. I must not assume that the NIC device tree node is still the
>> current one when the send() and recv() functions are called.
>>
>> Unfortunately this slows down the network boot again - all the nice
>> speed-up is gone, it's as slow again as the booting via the net-snk :-(
>>
>> I'll try to find a solution for that slowdown ... maybe it's possible to
>> cache the execution token of the corresponding Forth words or something
>> similar...
> 
> OK, caching the XTs seems to work. I just sent the fix as a separate
> patch ("Remember execution tokens of "write" and "read" for socket
> operations"), so could you please try again after applying that patch first?

Yup, having "Remember execution tokens of ..." applied before this patchset
helps, I'll push it all now. Thanks!




-- 
Alexey


More information about the SLOF mailing list