* [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec
@ 2006-09-18 4:31 Michael Ellerman
0 siblings, 0 replies; 13+ messages in thread
From: Michael Ellerman @ 2006-09-18 4:31 UTC (permalink / raw)
To: jgarzik
Cc: Santiago Leon, Anton Blanchard, netdev@vger.kernel.org,
linuxppc-dev list
Hi Jeff,
This patch has been floating around for a while now, Santi originally
sent it in March: http://www.spinics.net/lists/netdev/msg00471.html
You replied saying you thought it was "bonkers", I think I explained why
it wasn't, perhaps you disagree.
I'm resending it now in the hope you can either give us more info on
your objections, or merge it.
After a kexec the ibmveth driver will fail when trying to register with
the Hypervisor because the previous kernel has not unregistered.
So if the registration fails, we unregister and then try again.
We don't unconditionally unregister, because we don't want to disturb the
regular code path for 99% of users.
Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Acked-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Santiago Leon <santil@us.ibm.com>
---
ibmveth.c | 31 ++++++++++++++++++++++++++-----
1 file changed, 26 insertions(+), 5 deletions(-)
Index: to-merge/drivers/net/ibmveth.c
===================================================================
--- to-merge.orig/drivers/net/ibmveth.c
+++ to-merge/drivers/net/ibmveth.c
@@ -437,6 +437,31 @@ static void ibmveth_cleanup(struct ibmve
&adapter->rx_buff_pool[i]);
}
+static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter,
+ union ibmveth_buf_desc rxq_desc, u64 mac_address)
+{
+ int rc, try_again = 1;
+
+ /* After a kexec the adapter will still be open, so our attempt to
+ * open it will fail. So if we get a failure we free the adapter and
+ * try again, but only once. */
+retry:
+ rc = h_register_logical_lan(adapter->vdev->unit_address,
+ adapter->buffer_list_dma, rxq_desc.desc,
+ adapter->filter_list_dma, mac_address);
+
+ if (rc != H_SUCCESS && try_again) {
+ do {
+ rc = h_free_logical_lan(adapter->vdev->unit_address);
+ } while (H_IS_LONG_BUSY(rc) || (rc == H_BUSY));
+
+ try_again = 0;
+ goto retry;
+ }
+
+ return rc;
+}
+
static int ibmveth_open(struct net_device *netdev)
{
struct ibmveth_adapter *adapter = netdev->priv;
@@ -503,11 +528,7 @@ static int ibmveth_open(struct net_devic
ibmveth_debug_printk("receive q @ 0x%p\n", adapter->rx_queue.queue_addr);
- lpar_rc = h_register_logical_lan(adapter->vdev->unit_address,
- adapter->buffer_list_dma,
- rxq_desc.desc,
- adapter->filter_list_dma,
- mac_address);
+ lpar_rc = ibmveth_register_logical_lan(adapter, rxq_desc, mac_address);
if(lpar_rc != H_SUCCESS) {
ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc);
^ permalink raw reply [flat|nested] 13+ messages in thread[parent not found: <20060131041055.5623C68A46@ozlabs.org>]
[parent not found: <20060131042903.GF28896@krispykreme>]
* [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec [not found] ` <20060131042903.GF28896@krispykreme> @ 2006-03-02 19:40 ` Santiago Leon 2006-03-03 0:22 ` Michael Ellerman ` (2 more replies) 0 siblings, 3 replies; 13+ messages in thread From: Santiago Leon @ 2006-03-02 19:40 UTC (permalink / raw) To: anton, linuxppc64-dev, michael, jgarzik, netdev From: Michael Ellerman <michael@ellerman.id.au> After a kexec the veth driver will fail when trying to register with the Hypervisor because the previous kernel has not unregistered. So if the registration fails, we unregister and then try again. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Acked-by: Anton Blanchard <anton@samba.org> Signed-off-by: Santiago Leon <santil@us.ibm.com> --- drivers/net/ibmveth.c | 32 ++++++++++++++++++++++++++------ 1 files changed, 26 insertions(+), 6 deletions(-) Looks good to me, and has been around for a couple of months. Index: kexec/drivers/net/ibmveth.c =================================================================== --- kexec.orig/drivers/net/ibmveth.c +++ kexec/drivers/net/ibmveth.c @@ -436,6 +436,31 @@ static void ibmveth_cleanup(struct ibmve ibmveth_free_buffer_pool(adapter, &adapter->rx_buff_pool[i]); } +static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter, + union ibmveth_buf_desc rxq_desc, u64 mac_address) +{ + int rc, try_again = 1; + + /* After a kexec the adapter will still be open, so our attempt to + * open it will fail. So if we get a failure we free the adapter and + * try again, but only once. */ +retry: + rc = h_register_logical_lan(adapter->vdev->unit_address, + adapter->buffer_list_dma, rxq_desc.desc, + adapter->filter_list_dma, mac_address); + + if (rc != H_Success && try_again) { + do { + rc = h_free_logical_lan(adapter->vdev->unit_address); + } while (H_isLongBusy(rc) || (rc == H_Busy)); + + try_again = 0; + goto retry; + } + + return rc; +} + static int ibmveth_open(struct net_device *netdev) { struct ibmveth_adapter *adapter = netdev->priv; @@ -504,12 +529,7 @@ static int ibmveth_open(struct net_devic ibmveth_debug_printk("filter list @ 0x%p\n", adapter->filter_list_addr); ibmveth_debug_printk("receive q @ 0x%p\n", adapter->rx_queue.queue_addr); - - lpar_rc = h_register_logical_lan(adapter->vdev->unit_address, - adapter->buffer_list_dma, - rxq_desc.desc, - adapter->filter_list_dma, - mac_address); + lpar_rc = ibmveth_register_logical_lan(adapter, rxq_desc, mac_address); if(lpar_rc != H_Success) { ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-03-02 19:40 ` Santiago Leon @ 2006-03-03 0:22 ` Michael Ellerman 2006-03-03 0:34 ` Randy.Dunlap 2006-03-03 1:04 ` Jeff Garzik 2006-03-27 1:11 ` Michael Ellerman 2 siblings, 1 reply; 13+ messages in thread From: Michael Ellerman @ 2006-03-03 0:22 UTC (permalink / raw) To: jgarzik; +Cc: linuxppc64-dev, netdev, anton [-- Attachment #1.1: Type: text/plain, Size: 3053 bytes --] Hi Jeff, I realise it's late, but it'd be really good if you could send this up for 2.6.16, we're hosed without it. cheers On Fri, 3 Mar 2006 06:40, Santiago Leon wrote: > From: Michael Ellerman <michael@ellerman.id.au> > > After a kexec the veth driver will fail when trying to register with the > Hypervisor because the previous kernel has not unregistered. > > So if the registration fails, we unregister and then try again. > > Signed-off-by: Michael Ellerman <michael@ellerman.id.au> > Acked-by: Anton Blanchard <anton@samba.org> > Signed-off-by: Santiago Leon <santil@us.ibm.com> > --- > > drivers/net/ibmveth.c | 32 ++++++++++++++++++++++++++------ > 1 files changed, 26 insertions(+), 6 deletions(-) > > Looks good to me, and has been around for a couple of months. > > Index: kexec/drivers/net/ibmveth.c > =================================================================== > --- kexec.orig/drivers/net/ibmveth.c > +++ kexec/drivers/net/ibmveth.c > @@ -436,6 +436,31 @@ static void ibmveth_cleanup(struct ibmve > ibmveth_free_buffer_pool(adapter, &adapter->rx_buff_pool[i]); > } > > +static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter, > + union ibmveth_buf_desc rxq_desc, u64 mac_address) > +{ > + int rc, try_again = 1; > + > + /* After a kexec the adapter will still be open, so our attempt to > + * open it will fail. So if we get a failure we free the adapter and > + * try again, but only once. */ > +retry: > + rc = h_register_logical_lan(adapter->vdev->unit_address, > + adapter->buffer_list_dma, rxq_desc.desc, > + adapter->filter_list_dma, mac_address); > + > + if (rc != H_Success && try_again) { > + do { > + rc = h_free_logical_lan(adapter->vdev->unit_address); > + } while (H_isLongBusy(rc) || (rc == H_Busy)); > + > + try_again = 0; > + goto retry; > + } > + > + return rc; > +} > + > static int ibmveth_open(struct net_device *netdev) > { > struct ibmveth_adapter *adapter = netdev->priv; > @@ -504,12 +529,7 @@ static int ibmveth_open(struct net_devic > ibmveth_debug_printk("filter list @ 0x%p\n", adapter->filter_list_addr); > ibmveth_debug_printk("receive q @ 0x%p\n", > adapter->rx_queue.queue_addr); > > - > - lpar_rc = h_register_logical_lan(adapter->vdev->unit_address, > - adapter->buffer_list_dma, > - rxq_desc.desc, > - adapter->filter_list_dma, > - mac_address); > + lpar_rc = ibmveth_register_logical_lan(adapter, rxq_desc, mac_address); > > if(lpar_rc != H_Success) { > ibmveth_error_printk("h_register_logical_lan failed with %ld\n", > lpar_rc); > > > > _______________________________________________ > Linuxppc64-dev mailing list > Linuxppc64-dev@ozlabs.org > https://ozlabs.org/mailman/listinfo/linuxppc64-dev -- Michael Ellerman IBM OzLabs wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person [-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --] [-- Attachment #2: Type: text/plain, Size: 153 bytes --] _______________________________________________ Linuxppc64-dev mailing list Linuxppc64-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc64-dev ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-03-03 0:22 ` Michael Ellerman @ 2006-03-03 0:34 ` Randy.Dunlap 2006-03-03 1:00 ` Paul Mackerras 2006-03-03 1:10 ` Michael Ellerman 0 siblings, 2 replies; 13+ messages in thread From: Randy.Dunlap @ 2006-03-03 0:34 UTC (permalink / raw) To: michael; +Cc: linuxppc64-dev, netdev, jgarzik, anton On Fri, 3 Mar 2006 11:22:45 +1100 Michael Ellerman wrote: > Hi Jeff, > > I realise it's late, but it'd be really good if you could send this up for > 2.6.16, we're hosed without it. I'm wondering if this means that for every virtual/hypervisor situation, we have to modify any $interested_drivers. Why wouldn't we come up with a cleaner solution (in the long term)? E.g., could the hypervisor know when one of it's virtual OSes dies or reboots and release its resources then? This patch just looks like a short-term solution to me. > cheers > > On Fri, 3 Mar 2006 06:40, Santiago Leon wrote: > > From: Michael Ellerman <michael@ellerman.id.au> > > > > After a kexec the veth driver will fail when trying to register with the > > Hypervisor because the previous kernel has not unregistered. > > > > So if the registration fails, we unregister and then try again. > > > > Signed-off-by: Michael Ellerman <michael@ellerman.id.au> > > Acked-by: Anton Blanchard <anton@samba.org> > > Signed-off-by: Santiago Leon <santil@us.ibm.com> > > --- > > > > drivers/net/ibmveth.c | 32 ++++++++++++++++++++++++++------ > > 1 files changed, 26 insertions(+), 6 deletions(-) > > > > Looks good to me, and has been around for a couple of months. > > > > Index: kexec/drivers/net/ibmveth.c > > =================================================================== > > --- kexec.orig/drivers/net/ibmveth.c > > +++ kexec/drivers/net/ibmveth.c > > @@ -436,6 +436,31 @@ static void ibmveth_cleanup(struct ibmve > > ibmveth_free_buffer_pool(adapter, &adapter->rx_buff_pool[i]); > > } > > > > +static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter, > > + union ibmveth_buf_desc rxq_desc, u64 mac_address) > > +{ > > + int rc, try_again = 1; > > + > > + /* After a kexec the adapter will still be open, so our attempt to > > + * open it will fail. So if we get a failure we free the adapter and > > + * try again, but only once. */ > > +retry: > > + rc = h_register_logical_lan(adapter->vdev->unit_address, > > + adapter->buffer_list_dma, rxq_desc.desc, > > + adapter->filter_list_dma, mac_address); > > + > > + if (rc != H_Success && try_again) { > > + do { > > + rc = h_free_logical_lan(adapter->vdev->unit_address); > > + } while (H_isLongBusy(rc) || (rc == H_Busy)); > > + > > + try_again = 0; > > + goto retry; > > + } > > + > > + return rc; > > +} > > + > > static int ibmveth_open(struct net_device *netdev) > > { > > struct ibmveth_adapter *adapter = netdev->priv; > > @@ -504,12 +529,7 @@ static int ibmveth_open(struct net_devic > > ibmveth_debug_printk("filter list @ 0x%p\n", adapter->filter_list_addr); > > ibmveth_debug_printk("receive q @ 0x%p\n", > > adapter->rx_queue.queue_addr); > > > > - > > - lpar_rc = h_register_logical_lan(adapter->vdev->unit_address, > > - adapter->buffer_list_dma, > > - rxq_desc.desc, > > - adapter->filter_list_dma, > > - mac_address); > > + lpar_rc = ibmveth_register_logical_lan(adapter, rxq_desc, mac_address); > > > > if(lpar_rc != H_Success) { > > ibmveth_error_printk("h_register_logical_lan failed with %ld\n", > > lpar_rc); > > > > > > > > _______________________________________________ > > Linuxppc64-dev mailing list > > Linuxppc64-dev@ozlabs.org > > https://ozlabs.org/mailman/listinfo/linuxppc64-dev > > -- > Michael Ellerman > IBM OzLabs --- ~Randy ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-03-03 0:34 ` Randy.Dunlap @ 2006-03-03 1:00 ` Paul Mackerras 2006-03-03 1:10 ` Michael Ellerman 1 sibling, 0 replies; 13+ messages in thread From: Paul Mackerras @ 2006-03-03 1:00 UTC (permalink / raw) To: Randy.Dunlap; +Cc: michael, linuxppc64-dev, jgarzik, anton, netdev Randy.Dunlap writes: > E.g., could the hypervisor know when one of it's virtual OSes > dies or reboots and release its resources then? I think the point is that with kexec, the same virtual machine keeps running, so the hypervisor doesn't see the OS dying or rebooting. Paul. ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-03-03 0:34 ` Randy.Dunlap 2006-03-03 1:00 ` Paul Mackerras @ 2006-03-03 1:10 ` Michael Ellerman 2006-03-03 4:12 ` Randy.Dunlap 1 sibling, 1 reply; 13+ messages in thread From: Michael Ellerman @ 2006-03-03 1:10 UTC (permalink / raw) To: linuxppc64-dev; +Cc: netdev, Randy.Dunlap, jgarzik, anton [-- Attachment #1.1: Type: text/plain, Size: 1159 bytes --] On Fri, 3 Mar 2006 11:34, Randy.Dunlap wrote: > On Fri, 3 Mar 2006 11:22:45 +1100 Michael Ellerman wrote: > > Hi Jeff, > > > > I realise it's late, but it'd be really good if you could send this up > > for 2.6.16, we're hosed without it. > > I'm wondering if this means that for every virtual/hypervisor > situation, we have to modify any $interested_drivers. > Why wouldn't we come up with a cleaner solution (in the long term)? > > E.g., could the hypervisor know when one of it's virtual OSes > dies or reboots and release its resources then? It does exactly that for a regular reboot, but when we kexec we _don't_ die or reboot, as far as the Hypervisor is concerned it's all systems go. It's something of a double-edged sword, we're totally in control which gives us lots of flexibility, and _fast_ reboot times, but we also have to do a bit of extra stuff (ie. this patch) to keep things sane. cheers -- Michael Ellerman IBM OzLabs wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person [-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --] [-- Attachment #2: Type: text/plain, Size: 153 bytes --] _______________________________________________ Linuxppc64-dev mailing list Linuxppc64-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc64-dev ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-03-03 1:10 ` Michael Ellerman @ 2006-03-03 4:12 ` Randy.Dunlap 0 siblings, 0 replies; 13+ messages in thread From: Randy.Dunlap @ 2006-03-03 4:12 UTC (permalink / raw) To: michael; +Cc: linuxppc64-dev, jgarzik, anton, netdev On Fri, 3 Mar 2006 12:10:47 +1100 Michael Ellerman wrote: > On Fri, 3 Mar 2006 11:34, Randy.Dunlap wrote: > > On Fri, 3 Mar 2006 11:22:45 +1100 Michael Ellerman wrote: > > > Hi Jeff, > > > > > > I realise it's late, but it'd be really good if you could send this up > > > for 2.6.16, we're hosed without it. > > > > I'm wondering if this means that for every virtual/hypervisor > > situation, we have to modify any $interested_drivers. > > Why wouldn't we come up with a cleaner solution (in the long term)? > > > > E.g., could the hypervisor know when one of it's virtual OSes > > dies or reboots and release its resources then? > > It does exactly that for a regular reboot, but when we kexec we _don't_ die or > reboot, as far as the Hypervisor is concerned it's all systems go. > > It's something of a double-edged sword, we're totally in control which gives > us lots of flexibility, and _fast_ reboot times, but we also have to do a bit > of extra stuff (ie. this patch) to keep things sane. s/this patch/some patch/ Yes, you have certainly thought about this more/longer than I have, so why is something more generic like this bad instead of good: Somewhere early in start_kernel() (e.g.), do an hv call that says "free all assigned resources". Maybe hv doesn't know "all assigned resources." Maybe it's just that this patch is simpler than an hv change, although this (current) patch could leave some other drivers that need to be "fixed," while an hv change wouldn't do that. So I'm not opposed to this current patch as a short-term solution, but I don't think it's the right long-term solution. --- ~Randy ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-03-02 19:40 ` Santiago Leon 2006-03-03 0:22 ` Michael Ellerman @ 2006-03-03 1:04 ` Jeff Garzik 2006-03-03 2:11 ` Michael Ellerman 2006-03-27 1:11 ` Michael Ellerman 2 siblings, 1 reply; 13+ messages in thread From: Jeff Garzik @ 2006-03-03 1:04 UTC (permalink / raw) To: Santiago Leon; +Cc: michael, linuxppc64-dev, Paul Mackerras, anton, netdev Santiago Leon wrote: > From: Michael Ellerman <michael@ellerman.id.au> > > After a kexec the veth driver will fail when trying to register with the > Hypervisor because the previous kernel has not unregistered. > > So if the registration fails, we unregister and then try again. > > Signed-off-by: Michael Ellerman <michael@ellerman.id.au> > Acked-by: Anton Blanchard <anton@samba.org> > Signed-off-by: Santiago Leon <santil@us.ibm.com> > --- > > drivers/net/ibmveth.c | 32 ++++++++++++++++++++++++++------ > 1 files changed, 26 insertions(+), 6 deletions(-) > > Looks good to me, and has been around for a couple of months. This seems completely bonkers to me: are resources available? if no free resources try again It makes resource checking pointless. Jeff ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-03-03 1:04 ` Jeff Garzik @ 2006-03-03 2:11 ` Michael Ellerman 0 siblings, 0 replies; 13+ messages in thread From: Michael Ellerman @ 2006-03-03 2:11 UTC (permalink / raw) To: linuxppc64-dev; +Cc: Paul Mackerras, netdev, Jeff Garzik, anton [-- Attachment #1.1: Type: text/plain, Size: 1464 bytes --] On Fri, 3 Mar 2006 12:04, Jeff Garzik wrote: > Santiago Leon wrote: > > From: Michael Ellerman <michael@ellerman.id.au> > > > > After a kexec the veth driver will fail when trying to register with the > > Hypervisor because the previous kernel has not unregistered. > > > > So if the registration fails, we unregister and then try again. > > > > Signed-off-by: Michael Ellerman <michael@ellerman.id.au> > > Acked-by: Anton Blanchard <anton@samba.org> > > Signed-off-by: Santiago Leon <santil@us.ibm.com> > > --- > > > > drivers/net/ibmveth.c | 32 ++++++++++++++++++++++++++------ > > 1 files changed, 26 insertions(+), 6 deletions(-) > > > > Looks good to me, and has been around for a couple of months. > > This seems completely bonkers to me: > > are resources available? > if no > free resources > try again I'm not sure I follow, are you suggesting we do the h_free_logical_lan() unconditionally, followed by h_register_logical_lan() ?? If that's what you mean, I didn't do it that way because it would effect the normal code path. This patch only modifies the behaviour if we fail to register the adapter. I'm much more comfortable changing the failure case than the default. cheers -- Michael Ellerman IBM OzLabs wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person [-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --] [-- Attachment #2: Type: text/plain, Size: 153 bytes --] _______________________________________________ Linuxppc64-dev mailing list Linuxppc64-dev@ozlabs.org https://ozlabs.org/mailman/listinfo/linuxppc64-dev ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-03-02 19:40 ` Santiago Leon 2006-03-03 0:22 ` Michael Ellerman 2006-03-03 1:04 ` Jeff Garzik @ 2006-03-27 1:11 ` Michael Ellerman 2006-04-26 10:37 ` Michael Ellerman 2 siblings, 1 reply; 13+ messages in thread From: Michael Ellerman @ 2006-03-27 1:11 UTC (permalink / raw) To: jgarzik; +Cc: linuxppc64-dev, netdev On Thu, 2006-03-02 at 13:40 -0600, Santiago Leon wrote: > From: Michael Ellerman <michael@ellerman.id.au> > > After a kexec the veth driver will fail when trying to register with the > Hypervisor because the previous kernel has not unregistered. > > So if the registration fails, we unregister and then try again. > > Signed-off-by: Michael Ellerman <michael@ellerman.id.au> > Acked-by: Anton Blanchard <anton@samba.org> > Signed-off-by: Santiago Leon <santil@us.ibm.com> > --- > > drivers/net/ibmveth.c | 32 ++++++++++++++++++++++++++------ > 1 files changed, 26 insertions(+), 6 deletions(-) Looks like this hit the floor. Any chance of getting it into to 2.6.17 Jeff? AFAICT it should still apply cleanly. cheers -- Michael Ellerman IBM OzLabs wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-03-27 1:11 ` Michael Ellerman @ 2006-04-26 10:37 ` Michael Ellerman 2006-04-28 19:51 ` Santiago Leon 0 siblings, 1 reply; 13+ messages in thread From: Michael Ellerman @ 2006-04-26 10:37 UTC (permalink / raw) To: jgarzik; +Cc: anton, linuxppc64-dev, netdev, Santiago Leon [-- Attachment #1: Type: text/plain, Size: 1081 bytes --] On Mon, 2006-03-27 at 12:11 +1100, Michael Ellerman wrote: > On Thu, 2006-03-02 at 13:40 -0600, Santiago Leon wrote: > > From: Michael Ellerman <michael@ellerman.id.au> > > > > After a kexec the veth driver will fail when trying to register with the > > Hypervisor because the previous kernel has not unregistered. > > > > So if the registration fails, we unregister and then try again. > > > > Signed-off-by: Michael Ellerman <michael@ellerman.id.au> > > Acked-by: Anton Blanchard <anton@samba.org> > > Signed-off-by: Santiago Leon <santil@us.ibm.com> > > --- > > > > drivers/net/ibmveth.c | 32 ++++++++++++++++++++++++++------ > > 1 files changed, 26 insertions(+), 6 deletions(-) > > Looks like this hit the floor. Any chance of getting it into to 2.6.17 > Jeff? AFAICT it should still apply cleanly. /me knocks politely -- Michael Ellerman IBM OzLabs wwweb: http://michael.ellerman.id.au phone: +61 2 6212 1183 (tie line 70 21183) We do not inherit the earth from our ancestors, we borrow it from our children. - S.M.A.R.T Person [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 191 bytes --] ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-04-26 10:37 ` Michael Ellerman @ 2006-04-28 19:51 ` Santiago Leon 2006-08-29 12:58 ` Michael Ellerman 0 siblings, 1 reply; 13+ messages in thread From: Santiago Leon @ 2006-04-28 19:51 UTC (permalink / raw) To: michael; +Cc: jgarzik, anton, linuxppc64-dev, netdev [-- Attachment #1: Type: text/plain, Size: 314 bytes --] Michael Ellerman wrote: >>Looks like this hit the floor. Any chance of getting it into to 2.6.17 >>Jeff? AFAICT it should still apply cleanly. > > /me knocks politely Actually, it doesn't apply cleanly anymore. Here's a patch that does. -- Santiago A. Leon Power Linux Development IBM Linux Technology Center [-- Attachment #2: ibmveth_harden_init.patch --] [-- Type: text/plain, Size: 2193 bytes --] From: Michael Ellerman <michael@ellerman.id.au> After a kexec the ibmveth driver will fail when trying to register with the Hypervisor because the previous kernel has not unregistered. So if the registration fails, we unregister and then try again. Signed-off-by: Michael Ellerman <michael@ellerman.id.au> Acked-by: Anton Blanchard <anton@samba.org> Signed-off-by: Santiago Leon <santil@us.ibm.com> ibmveth.c | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) Index: kexec/drivers/net/ibmveth.c =================================================================== --- a/drivers/net/ibmveth.c 2006-04-28 13:16:22.244724056 -0500 +++ b/drivers/net/ibmveth.c 2006-04-28 13:29:49.429736784 -0500 @@ -436,6 +436,31 @@ static void ibmveth_cleanup(struct ibmve ibmveth_free_buffer_pool(adapter, &adapter->rx_buff_pool[i]); } +static int ibmveth_register_logical_lan(struct ibmveth_adapter *adapter, + union ibmveth_buf_desc rxq_desc, u64 mac_address) +{ + int rc, try_again = 1; + + /* After a kexec the adapter will still be open, so our attempt to + * open it will fail. So if we get a failure we free the adapter and + * try again, but only once. */ +retry: + rc = h_register_logical_lan(adapter->vdev->unit_address, + adapter->buffer_list_dma, rxq_desc.desc, + adapter->filter_list_dma, mac_address); + + if (rc != H_SUCCESS && try_again) { + do { + rc = h_free_logical_lan(adapter->vdev->unit_address); + } while (H_IS_LONG_BUSY(rc) || (rc == H_BUSY)); + + try_again = 0; + goto retry; + } + + return rc; +} + static int ibmveth_open(struct net_device *netdev) { struct ibmveth_adapter *adapter = netdev->priv; @@ -505,11 +530,7 @@ static int ibmveth_open(struct net_devic ibmveth_debug_printk("receive q @ 0x%p\n", adapter->rx_queue.queue_addr); - lpar_rc = h_register_logical_lan(adapter->vdev->unit_address, - adapter->buffer_list_dma, - rxq_desc.desc, - adapter->filter_list_dma, - mac_address); + lpar_rc = ibmveth_register_logical_lan(adapter, rxq_desc, mac_address); if(lpar_rc != H_SUCCESS) { ibmveth_error_printk("h_register_logical_lan failed with %ld\n", lpar_rc); ^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec 2006-04-28 19:51 ` Santiago Leon @ 2006-08-29 12:58 ` Michael Ellerman 0 siblings, 0 replies; 13+ messages in thread From: Michael Ellerman @ 2006-08-29 12:58 UTC (permalink / raw) To: Santiago Leon; +Cc: linuxppc64-dev, jgarzik, netdev, anton On 4/29/06, Santiago Leon <santil@us.ibm.com> wrote: > Michael Ellerman wrote: > > Any chance of getting it into to 2.6.17 ... 2.6.19 perhaps? cheers ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2006-09-18 4:31 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-09-18 4:31 [PATCH] powerpc: ibmveth: Harden driver initilisation for kexec Michael Ellerman
[not found] <20060131041055.5623C68A46@ozlabs.org>
[not found] ` <20060131042903.GF28896@krispykreme>
2006-03-02 19:40 ` Santiago Leon
2006-03-03 0:22 ` Michael Ellerman
2006-03-03 0:34 ` Randy.Dunlap
2006-03-03 1:00 ` Paul Mackerras
2006-03-03 1:10 ` Michael Ellerman
2006-03-03 4:12 ` Randy.Dunlap
2006-03-03 1:04 ` Jeff Garzik
2006-03-03 2:11 ` Michael Ellerman
2006-03-27 1:11 ` Michael Ellerman
2006-04-26 10:37 ` Michael Ellerman
2006-04-28 19:51 ` Santiago Leon
2006-08-29 12:58 ` Michael Ellerman
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox