From owner-freebsd-net@freebsd.org Wed Dec 21 19:30:59 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C4AD6C8BA6C for ; Wed, 21 Dec 2016 19:30:59 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45DB01055; Wed, 21 Dec 2016 19:30:59 +0000 (UTC) (envelope-from rizzo.unipi@gmail.com) Received: by mail-wm0-x244.google.com with SMTP id u144so32267087wmu.0; Wed, 21 Dec 2016 11:30:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=HXVk0AE87fCTs3y79LkoaSyRgJ0hmOyqttEyD2PDW9A=; b=Y0ivVl0qq4R+g8nI5HFyAf3HLmfy/vUzc4dQImP0ffdYFVHGTLX3+L+TBFcqlaejHU P+kKrEThb81zJYgOYB6LypMI4jm4FyYGcvHMIQjZyTktjQMLjymHF73scpqnl9XNcZHp DnSUm2/gbCwbwy0tQfgDTmDoOXDp6QrMikqeFPcySIAUA5+ew07lsq/p7DiEEU7d8Ju2 PfQNZfGINRMCYw26pZjx2nkqUUxByol+cd++h1oKuzV8GxUYR+Hdj1QKgNRJ3LTQHFTH kqAvmxQaCGqdyrrVosD2MUAiJW1hBklwB6pv7IGfWlPNbZdrTpXeFvV3M7I81/TJSuSC QDyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=HXVk0AE87fCTs3y79LkoaSyRgJ0hmOyqttEyD2PDW9A=; b=oCZMqor+F2n/0lK3jewQI3vMrilbY4BgIsVG4ULKcWQit/d+0kEwb3RAQu2BsYY6b7 +7xh9LfmXjbkVbpxgqbItgfq8+JjYpG3XTSR5P75JcP40BNfMDFNVHhwKsPl9fA9JeFv XzNjrTELZH5mUzM56Q6oX8aNc2mV4OOiR/f2b7UNlG5eyUoUZAZ0rk5fzgrf8afTeEC+ HLjhvlwLcLSzeJUltMzCmJX0hcUddoMUvK7hQ1oa1h3pfqxqoC1Gkxr3WZnYLKBL0aFu H2MTCDLSXeRHbUW0LP+KcfCh70W3u+MOkQqQebOFrjos/WX0Wp4HCsBSQb5Vq8llwYPu vKLg== X-Gm-Message-State: AIkVDXIiDUGzH2xBb3T6nnnZdRh70ye2fM82s2Vh3VPo7OGvpf0RMdGJt2qVaa6HNkRrnRXTGbQ8y0YXwEfMvA== X-Received: by 10.28.211.72 with SMTP id k69mr6084817wmg.137.1482348657598; Wed, 21 Dec 2016 11:30:57 -0800 (PST) MIME-Version: 1.0 Sender: rizzo.unipi@gmail.com Received: by 10.28.196.207 with HTTP; Wed, 21 Dec 2016 11:30:56 -0800 (PST) In-Reply-To: References: <20161217222812.GA4979@ox> From: Luigi Rizzo Date: Wed, 21 Dec 2016 11:30:56 -0800 X-Google-Sender-Auth: N4tAfDYVQjNHQG8xvMbn4YwV9FE Message-ID: Subject: Re: cxgbe's native netmap support broken since r307394 To: Vincenzo Maffione Cc: Adrian Chadd , Navdeep Parhar , "freebsd-net@freebsd.org" , Luigi Rizzo , Giuseppe Lettieri Content-Type: text/plain; charset=UTF-8 X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Dec 2016 19:30:59 -0000 On Wed, Dec 21, 2016 at 11:15 AM, Vincenzo Maffione wrote: > Hi, > There is no commit related to that in the FreeBSD svn or git. > > The fix has been published to the github netmap repository here > (branch master): https://github.com/luigirizzo/netmap > > What we should do is to import all the recent updates from the github > into HEAD. I can prepare a patch for HEAD, if you wish. Just let me > know. I just checked and the diff between FreeBSD head and netmap head in github is almost 3k lines due to a lot of recent refactoring. So, if there is an easy way to extract just the locking change that would be preferable as an interim solution. cheers luigi > > Cheers, > Vincenzo > > > 2016-12-20 21:45 GMT+01:00 Adrian Chadd : >> hi, >> >> What's the commit? We should get it into -HEAD asap. >> >> >> -adrian >> >> >> On 20 December 2016 at 01:25, Vincenzo Maffione wrote: >>> Ok, applied to the netmap github repo. >>> This fix will be published when Luigi does the next commit on FreeBSD. >>> >>> Cheers, >>> Vincenzo >>> >>> 2016-12-19 20:05 GMT+01:00 Navdeep Parhar : >>>> IFNET_RLOCK will work, thanks. >>>> >>>> Navdeep >>>> >>>> On Mon, Dec 19, 2016 at 3:21 AM, Vincenzo Maffione wrote: >>>>> Hi Navdeep, >>>>> >>>>> Indeed, we have reviewed the code, and we think it is ok to >>>>> implement nm_os_ifnet_lock() with IFNET_RLOCK(), instead of using >>>>> IFNET_WLOCK(). >>>>> Since IFNET_RLOCK() results into sx_slock(), this should fix the issue. >>>>> >>>>> On FreeBSD, this locking is needed to protect a flag read by nm_iszombie(). >>>>> However, on Linux the same lock is also needed to protect the call to >>>>> the nm_hw_register() callback, so we prefer to have an "unified" >>>>> locking scheme, i.e. always calling nm_hw_register under the lock. >>>>> >>>>> Does this make sense to you? Would it be easy for you to make a quick >>>>> test by replacing IFNET_WLOCK with IFNET_RLOCK? >>>>> >>>>> Thanks, >>>>> Vincenzo >>>>> >>>>> 2016-12-17 23:28 GMT+01:00 Navdeep Parhar : >>>>>> Luigi, Vincenzo, >>>>>> >>>>>> The last major update to netmap (r307394 and followups) broke cxgbe's >>>>>> native netmap support. The problem is that netmap_hw_reg now holds an >>>>>> rw_lock around the driver's netmap_on/off routines. It has always been >>>>>> safe for the driver to sleep during these operations but now it panics >>>>>> instead. >>>>>> >>>>>> Why is IFNET_WLOCK needed here? It seems like a regression to disallow >>>>>> sleep on the control path. >>>>>> >>>>>> Regards, >>>>>> Navdeep >>>>>> >>>>>> begin_synchronized_op with the following non-sleepable locks held: >>>>>> exclusive rw ifnet_rw (ifnet_rw) r = 0 (0xffffffff8271d680) locked @ >>>>>> /root/ws/head/sys/dev/netmap/netmap_freebsd.c:95 >>>>>> stack backtrace: >>>>>> #0 0xffffffff810837a5 at witness_debugger+0xe5 >>>>>> #1 0xffffffff81084d88 at witness_warn+0x3b8 >>>>>> #2 0xffffffff83ef2bcc at begin_synchronized_op+0x6c >>>>>> #3 0xffffffff83f14beb at cxgbe_netmap_reg+0x5b >>>>>> #4 0xffffffff809846f1 at netmap_hw_reg+0x81 >>>>>> #5 0xffffffff809806de at netmap_do_regif+0x19e >>>>>> #6 0xffffffff8098121d at netmap_ioctl+0x7ad >>>>>> #7 0xffffffff8098682f at freebsd_netmap_ioctl+0x5f >>>>> >>>>> >>>>> >>>>> -- >>>>> Vincenzo Maffione >>>>> _______________________________________________ >>>>> freebsd-net@freebsd.org mailing list >>>>> https://lists.freebsd.org/mailman/listinfo/freebsd-net >>>>> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" >>> >>> >>> >>> -- >>> Vincenzo Maffione >>> _______________________________________________ >>> freebsd-net@freebsd.org mailing list >>> https://lists.freebsd.org/mailman/listinfo/freebsd-net >>> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org" > > > > -- > Vincenzo Maffione -- -----------------------------------------+------------------------------- Prof. Luigi RIZZO, rizzo@iet.unipi.it . Dip. di Ing. dell'Informazione http://www.iet.unipi.it/~luigi/ . Universita` di Pisa TEL +39-050-2217533 . via Diotisalvi 2 Mobile +39-338-6809875 . 56122 PISA (Italy) -----------------------------------------+-------------------------------