From patchwork Thu Oct 13 18:04:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 681912 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3svzCL5Rttz9t0t for ; Fri, 14 Oct 2016 05:04:46 +1100 (AEDT) Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3svzCL45HkzDt1m for ; Fri, 14 Oct 2016 05:04:46 +1100 (AEDT) X-Original-To: slof@lists.ozlabs.org Delivered-To: slof@lists.ozlabs.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3svzCH4mt8zDt1g for ; Fri, 14 Oct 2016 05:04:43 +1100 (AEDT) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B65D9804E3; Thu, 13 Oct 2016 18:04:41 +0000 (UTC) Received: from [10.36.116.45] (ovpn-116-45.ams2.redhat.com [10.36.116.45]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9DI4F6I010408 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Thu, 13 Oct 2016 14:04:33 -0400 To: Alexey Kardashevskiy , slof@lists.ozlabs.org References: <1476269048-13895-1-git-send-email-thuth@redhat.com> <1476269048-13895-2-git-send-email-thuth@redhat.com> <612f5eec-0178-ddbc-b279-1e4c1f130d22@ozlabs.ru> From: Thomas Huth Message-ID: <7728ac39-2720-c087-923c-5ebf62347f6a@redhat.com> Date: Thu, 13 Oct 2016 20:04:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 MIME-Version: 1.0 In-Reply-To: <612f5eec-0178-ddbc-b279-1e4c1f130d22@ozlabs.ru> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 13 Oct 2016 18:04:41 +0000 (UTC) Subject: Re: [SLOF] [PATCH v3 1/6] Link libnet code to Paflof and add a wrapper for netboot() X-BeenThere: slof@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Patches for https://github.com/aik/SLOF" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: slof-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "SLOF" 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@800000020000000/ethernet@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: ----------------------------------------------------------------------- ----------------------------------------------------------------------- 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... Thomas 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"); } /**