From owner-freebsd-net@freebsd.org Wed Apr 19 17:36:55 2017 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 8E0B4D465D7 for ; Wed, 19 Apr 2017 17:36:55 +0000 (UTC) (envelope-from David.Somayajulu@cavium.com) Received: from NAM02-BL2-obe.outbound.protection.outlook.com (mail-bl2nam02on0050.outbound.protection.outlook.com [104.47.38.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "Microsoft IT SSL SHA2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 23DB31AA3 for ; Wed, 19 Apr 2017 17:36:54 +0000 (UTC) (envelope-from David.Somayajulu@cavium.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=CAVIUMNETWORKS.onmicrosoft.com; s=selector1-cavium-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=jftCtmVgsRSrJ0HELwHRF4pj+ZupUCLgItEBYDY4T94=; b=OcqRwif/WRQeujyele1cjs6P33aeG2IlQTw+fIptG8fxoGedSTgAZMx+6hxovDM8oHINWkvZYbi30ErpSFLjWkLQK2l3TFhamZ1kXTW5CiH8vGjnnYvp78Cut+5s9uxbhwEuI84Z/5dsdzrp7l4xNCZIfBwBew490DDa0FjHjYw= Received: from BY2PR07MB1474.namprd07.prod.outlook.com (10.162.76.152) by BY2PR07MB1476.namprd07.prod.outlook.com (10.162.76.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1034.10; Wed, 19 Apr 2017 17:36:52 +0000 Received: from BY2PR07MB1474.namprd07.prod.outlook.com ([10.162.76.152]) by BY2PR07MB1474.namprd07.prod.outlook.com ([10.162.76.152]) with mapi id 15.01.1034.015; Wed, 19 Apr 2017 17:36:52 +0000 From: "Somayajulu, David" To: Hans Petter Selasky , Sepherosa Ziehau CC: "freebsd-net@freebsd.org" Subject: RE: Question on taskqueue_drain Thread-Topic: Question on taskqueue_drain Thread-Index: AdK4na5gtgOJ17dzQtGmCh0DkfpjpgAGAVKwAAIiR4AAAZREAAAbs/Ew Date: Wed, 19 Apr 2017 17:36:52 +0000 Message-ID: References: <1fb80f2b-9086-0260-2f63-bdaf8afc1c4c@selasky.org> In-Reply-To: <1fb80f2b-9086-0260-2f63-bdaf8afc1c4c@selasky.org> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: selasky.org; dkim=none (message not signed) header.d=none;selasky.org; dmarc=none action=none header.from=cavium.com; x-originating-ip: [198.186.0.2] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1; BY2PR07MB1476; 7:kcaRcEnduA/S16Fiy9UDFU/ABlOVAPEiVpRw3o8dWYf6pjW0+H7k/s6LtmcKozL6pmxSryZNqDfQ4WjvJhC2weMgFnHt3+mfEGvpeR5pvEQFylF4D/6PrJbZfdI229XYMjSi+sYCL4gor1AQJ7gVdsRRNxgYAzRbJg02XON0uQUpwth1plDKNC2tjuTrwEaMPUUKuhTwtankra96krr1lBL8EZg2eJVsbItr2YO2Qtr1glSHjBzYI6fB8KFeCa8k2QHb41v6j1qc/RRrhNMBMXCmuTQpqyicaeOtdTVGFH2KfkHaKYWRiqcuY0XP5iABF29wmON7egNPrhswVX9dPw== x-ms-office365-filtering-correlation-id: a2847aa3-2171-4f79-8c78-08d4874aaac1 x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(2017030254075)(201703131423075)(201703031133081)(201702281549075); SRVR:BY2PR07MB1476; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:; x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6040450)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(93006095)(93001095)(6041248)(20161123562025)(20161123560025)(20161123555025)(20161123564025)(201703131423075)(201702281528075)(201703061421075)(6072148); SRVR:BY2PR07MB1476; BCL:0; PCL:0; RULEID:; SRVR:BY2PR07MB1476; x-forefront-prvs: 028256169F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(39840400002)(39450400003)(39410400002)(39400400002)(39850400002)(377454003)(51914003)(24454002)(13464003)(3660700001)(3280700002)(54356999)(7696004)(8936002)(5660300001)(7116003)(81166006)(33656002)(2906002)(53546009)(66066001)(8676002)(76176999)(6116002)(93886004)(229853002)(189998001)(102836003)(25786009)(3846002)(2950100002)(2900100001)(86362001)(50986999)(38730400002)(99286003)(39060400002)(305945005)(122556002)(4326008)(6436002)(55016002)(77096006)(53936002)(6506006)(6246003)(74316002)(7736002)(9686003); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR07MB1476; H:BY2PR07MB1474.namprd07.prod.outlook.com; FPR:; SPF:None; MLV:ovrnspm; PTR:InfoNoRecords; LANG:en; spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: cavium.com X-MS-Exchange-CrossTenant-originalarrivaltime: 19 Apr 2017 17:36:52.5571 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 711e4ccf-2e9b-4bcf-a551-4094005b6194 X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY2PR07MB1476 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, 19 Apr 2017 17:36:55 -0000 Hans, Thanks for the info. > No sleeping functions like taskqueue_drain() can be called when the MTX_D= EF lock is grabbed. I am guessing this is true irrespective of whether the taskqueue is "fast" = or not. Thanks David S. -----Original Message----- From: Hans Petter Selasky [mailto:hps@selasky.org]=20 Sent: Tuesday, April 18, 2017 9:22 PM To: Sepherosa Ziehau ; Somayajulu, David Cc: freebsd-net@freebsd.org Subject: Re: Question on taskqueue_drain On 04/19/17 05:37, Sepherosa Ziehau wrote: > On Wed, Apr 19, 2017 at 10:39 AM, Somayajulu, David=20 > wrote: >> Sorry what I meant to ask was, whether it is O.K to call taskqueue_drain= (), when an MTX_DEF lock is grabbed prior to calling taskqueue_drain(). >> > > You will hit WITNESS, if the drain needs to wait; that's probably the=20 > best case. If the lock will be acquired in the task being drained,=20 > this leads to deadlock. > Hi, No sleeping functions like taskqueue_drain() can be called when the MTX_DEF= lock is grabbed. --HPS