From mboxrd@z Thu Jan 1 00:00:00 1970 From: Brad Plant Subject: Re: pvops netconsole Date: Sun, 14 Feb 2010 15:56:35 +1100 Message-ID: <20100214155635.17d57bf7@daedalus> References: <20100205111507.4e7089fd@daedalus> <4B75DF98.3070307@goop.org> <20100214132820.4bfbd0d7@daedalus> <4B777483.80700@goop.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============1501867705==" Return-path: In-Reply-To: <4B777483.80700@goop.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Jeremy Fitzhardinge Cc: "xen-devel@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org --===============1501867705== Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/0IJzGRszK_v55_EOATAqoH_"; protocol="application/pgp-signature" --Sig_/0IJzGRszK_v55_EOATAqoH_ Content-Type: multipart/mixed; boundary="MP_/j=DIH407/WbDeBBd6YtkYoz" --MP_/j=DIH407/WbDeBBd6YtkYoz Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Sat, 13 Feb 2010 19:56:51 -0800 Jeremy Fitzhardinge wrote: > > 1. When the first message is sent over the net console, the WARN_ONCE()= at net/core/netpoll.c:327 triggers. I'm not sure what to do about this. >=20 > What's the backtrace in the warning? ------------[ cut here ]------------ WARNING: at net/core/netpoll.c:329 netpoll_send_skb+0x145/0x1db() netpoll_send_skb(): eth1 enabled interrupts in poll (xennet_start_xmit+0x0/= 0x6bb) Pid: 1, comm: swapper Not tainted 2.6.32.7 #36 Call Trace: [] warn_slowpath_common+0x72/0x8a [] warn_slowpath_fmt+0x3c/0x3e [] ? xen_restore_fl_direct_end+0x0/0x1 [] ? xennet_start_xmit+0x0/0x6bb [] netpoll_send_skb+0x145/0x1db [] ? _spin_unlock_irqrestore+0x19/0x1c [] netpoll_send_udp+0x1fe/0x20e [] ? firmware_loading_store+0x120/0x1b5 [] write_msg+0x89/0xca [] ? firmware_loading_store+0x120/0x1b5 [] __call_console_drivers+0x67/0x79 [] _call_console_drivers+0x59/0x5d [] release_console_sem+0x120/0x1c7 [] register_console+0x22e/0x2ae [] init_netconsole+0x15d/0x1c8 [] ? schedule_delayed_work+0x16/0x1b [] ? init_netconsole+0x0/0x1c8 [] do_one_initcall+0x59/0x154 [] kernel_init+0x152/0x1a8 [] child_rip+0xa/0x20 [] ? int_ret_from_sys_call+0x7/0x1b [] ? retint_restore_args+0x5/0x6 [] ? child_rip+0x0/0x20 ---[ end trace 0f898deb8e1e2914 ]--- =20 > I had a quick look at e1000's and it calls the interrupt handler; the=20 > netfront equivalent would be to call xennet_interrupt() with interrupts=20 > disabled. I'm not sure virtio_net is a good model because it doesn't=20 > seem to have any interrupt-related stuff in it; I guess that happens=20 > elsewhere in virtio. Actually, I tried something like this first because I first looked at pcnet= 32.c and e100.c: disable_irq(dev->irq); xennet_interrupt(dev->irq, dev); enable_irq(dev->irq); The same WARN_ONCE() was triggered. > > 2. When either netconsole is setup or the first message is sent, messag= es already logged to the main console get logged again. Maybe this will go = away when the above is fixed? >=20 > Probably not. It sounds like a feature. Ok. This one was the least of my worries anyway. > > 3. Initially netconsole would not initialise because the interface didn= 't yet have a mac address as setup_netfront hadn't yet been called. I chang= ed the module_init() in netconsole.c to late_initcall() if !CONFIG_MODULES&= & CONFIG_XEN. Is this allowed and sane? > > Probably not. In practice every kernel will have modules and Xen=20 > enabled, and it will change netconsole for all users. I guess we=20 > probably need to find some way to init the MAC address earlier, or=20 > trigger netconsole init once the mac address is known. I figured it was dodgy. How would you init the MAC address earlier though? = I've observed the xen devices being initialised at slightly different times= with respect to other devices which suggests to me that they (and possibly= all devices) are being initialised in separate threads. It would mean sett= ing the MAC address before device initialisation yes? Not sure how correct this is either, but another solution might be to set t= he MAC address to say 00:00:00:00:00:01 when the netdev structure is first = created. This lets netconsole initialise since the MAC address isn't all ze= ros or all 0xFF. By the time any net console logs are transmitted, setup_ne= tfront will have already been called and the correct MAC address set so no = packets will actually be sent with the above MAC address. I have attached a= patch that does this. Cheers, Brad --MP_/j=DIH407/WbDeBBd6YtkYoz Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=xen-netconsole2.patch diff -urpNX linux-2.6.32.7/Documentation/dontdiff linux-2.6.32.7/arch/x86/b= oot/compressed/piggy.S linux-2.6.32.7-xen-netconsole/arch/x86/boot/compress= ed/piggy.S --- linux-2.6.32.7/arch/x86/boot/compressed/piggy.S 2010-02-14 09:21:54.000= 000000 +1100 +++ linux-2.6.32.7-xen-netconsole/arch/x86/boot/compressed/piggy.S 2010-02-= 14 15:46:52.000000000 +1100 @@ -1,6 +1,6 @@ .section ".rodata.compressed","a",@progbits .globl z_input_len -z_input_len =3D 2406261 +z_input_len =3D 2406344 .globl z_output_len z_output_len =3D 11827328 .globl z_extract_offset diff -urpNX linux-2.6.32.7/Documentation/dontdiff linux-2.6.32.7/arch/x86/b= oot/zoffset.h linux-2.6.32.7-xen-netconsole/arch/x86/boot/zoffset.h --- linux-2.6.32.7/arch/x86/boot/zoffset.h 2010-02-14 09:21:54.000000000 +1= 100 +++ linux-2.6.32.7-xen-netconsole/arch/x86/boot/zoffset.h 2010-02-14 15:46:= 52.000000000 +1100 @@ -3,5 +3,5 @@ #define ZO_startup_32 0x0000000000000000 #define ZO_z_extract_offset 0x0000000000905000 #define ZO_z_extract_offset_negative 0xffffffffff6fb000 -#define ZO_z_input_len 0x000000000024b775 +#define ZO_z_input_len 0x000000000024b7c8 #define ZO_z_output_len 0x0000000000b47880 diff -urpNX linux-2.6.32.7/Documentation/dontdiff linux-2.6.32.7/drivers/ne= t/xen-netfront.c linux-2.6.32.7-xen-netconsole/drivers/net/xen-netfront.c --- linux-2.6.32.7/drivers/net/xen-netfront.c 2009-12-03 14:51:21.000000000= +1100 +++ linux-2.6.32.7-xen-netconsole/drivers/net/xen-netfront.c 2010-02-14 15:= 51:51.000000000 +1100 @@ -989,6 +989,15 @@ err: return work_done; } =20 +#ifdef CONFIG_NET_POLL_CONTROLLER +static void xennet_netpoll(struct net_device *dev) +{ + struct netfront_info *np =3D netdev_priv(dev); + + napi_schedule(&np->napi); +} +#endif + static int xennet_change_mtu(struct net_device *dev, int mtu) { int max =3D xennet_can_sg(dev) ? 65535 - ETH_HLEN : ETH_DATA_LEN; @@ -1113,6 +1122,9 @@ static const struct net_device_ops xenne .ndo_change_mtu =3D xennet_change_mtu, .ndo_set_mac_address =3D eth_mac_addr, .ndo_validate_addr =3D eth_validate_addr, +#ifdef CONFIG_NET_POLL_CONTROLLER + .ndo_poll_controller =3D xennet_netpoll, +#endif }; =20 static struct net_device * __devinit xennet_create_dev(struct xenbus_devic= e *dev) @@ -1181,6 +1193,9 @@ static struct net_device * __devinit xen =20 np->netdev =3D netdev; =20 + /* Set MAC to temporary (non-zero) value so that netconsole initialises */ + netdev->dev_addr[ETH_ALEN - 1] =3D 1; + netif_carrier_off(netdev); =20 return netdev; --MP_/j=DIH407/WbDeBBd6YtkYoz-- --Sig_/0IJzGRszK_v55_EOATAqoH_ Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (GNU/Linux) iEYEARECAAYFAkt3goMACgkQtFxK98yAy+nHTQCfTsuKbsD3NeKjEJQerVBkuW/c vh4An10olHdy8za6KXXswvvUFI7uhDn0 =fVz/ -----END PGP SIGNATURE----- --Sig_/0IJzGRszK_v55_EOATAqoH_-- --===============1501867705== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --===============1501867705==--