From owner-freebsd-net@freebsd.org Thu Jul 16 05:49:21 2020 Return-Path: Delivered-To: freebsd-net@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9E73355CEF for ; Thu, 16 Jul 2020 05:49:21 +0000 (UTC) (envelope-from zec@fer.hr) Received: from EUR03-DB5-obe.outbound.protection.outlook.com (mail-db5eur03on0602.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0a::602]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B6jxX4hMvz43vW for ; Thu, 16 Jul 2020 05:49:20 +0000 (UTC) (envelope-from zec@fer.hr) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=edZHhZJksLX5TDNRVnmRgUyao7YSwUsllnnwY/MmgBKTZwVWgOQTES4nFaOU7G4cJmg49fMFl7K+wjwG9KIcmZuGcbgMMc7WTKYkX5I+PNEAUtc7KTwjn/iE4YxHzKkI/KoCf4vz5JVemfM3qi0xd2ou+suAvbO8atV5X98P28j2hLCGoHSCxZUmrX84AjZ23o2StWlbeY/EBA9DdRfwbZutoa2E1NSJw0QU3jr7afJweIlt9FhFasDu6SXZ2ITX+H6k3RdUz/iOaXq8slG+lUlJiWJ6aTj1iq3ZYS8D3YYEbzQ7EJWUhefQfHKCkgV4J9bodG0ZOXk5JixJ8vbRPA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Oxafz9wkI3AiBto9xhWhZOGobN6i4Cdeiqx/ShjCWNw=; b=XQe/nYMkFaGfxICp7zljxSBTrbZhz3Xv+ZBfz0f+i1k/tFxiEBcHycHx3nZU8ZnJLEw0dE622rbtbSQQ04dAjSVNeLoteJEIiVsFXyPZLRBakfEnMyJEnKHS6of5F7RRjeqss25p91JqLpjTFEAm4TvE3DPDeRf4269n6d7c5DJwc7HgYQlm30UnOXsCDxF4QDGwJgdHj7nufKXqLob293+ziDbed7xVyIpt/ltCVUMpk/X3WHF7hkUSkSblHp09iIJ7pmC4KA2zmO5uSQtguf7PBqEvPqMluTxj4OrJb+L/PEttKEwLPbUD1YtQqUfigcWzHS0h+csy533nmoFJHQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=fer.hr; dmarc=pass action=none header.from=fer.hr; dkim=pass header.d=fer.hr; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ferhr.onmicrosoft.com; s=selector2-ferhr-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Oxafz9wkI3AiBto9xhWhZOGobN6i4Cdeiqx/ShjCWNw=; b=dGzLs5nOGWtyRq/FMbgyXe/YQYXYle5+DIw25wQgp5VqWHjDdSVXqnP8ORBmZw/gNhNA0hSERCzQOl+6ItlKc5Aoz5CBzvhWIEv9YgI6mLktlrZLek12chAiiGqZEKg9eQ9jUvpzSeheLzh7aIQRJzI6BU4JN6L1MxPqxN5gKfI= Received: from VE1PR08MB4783.eurprd08.prod.outlook.com (2603:10a6:802:a9::16) by VI1PR08MB4559.eurprd08.prod.outlook.com (2603:10a6:803:100::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3174.22; Thu, 16 Jul 2020 05:49:17 +0000 Received: from VE1PR08MB4783.eurprd08.prod.outlook.com ([fe80::c8e:e335:c7:319b]) by VE1PR08MB4783.eurprd08.prod.outlook.com ([fe80::c8e:e335:c7:319b%3]) with mapi id 15.20.3195.018; Thu, 16 Jul 2020 05:49:17 +0000 Date: Thu, 16 Jul 2020 07:49:17 +0200 From: Marko Zec To: John-Mark Gurney Cc: freebsd-net@FreeBSD.org Subject: Re: IF_DRV_PREPEND unlocked? Message-ID: <20200716074917.04445daa@x23> In-Reply-To: <20200716072622.5fa35ba2@x23> References: <20200715232624.GR4213@funkthat.com> <20200716072622.5fa35ba2@x23> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; amd64-portbld-freebsd11.3) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-ClientProxiedBy: VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) To VE1PR08MB4783.eurprd08.prod.outlook.com (2603:10a6:802:a9::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from x23 (31.147.103.178) by VI1PR04CA0063.eurprd04.prod.outlook.com (2603:10a6:802:2::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3195.17 via Frontend Transport; Thu, 16 Jul 2020 05:49:17 +0000 X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; amd64-portbld-freebsd11.3) X-Originating-IP: [31.147.103.178] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: b4796c57-e0e7-49d4-98b0-08d8294bfa63 X-MS-TrafficTypeDiagnostic: VI1PR08MB4559: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:9508; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: AcWo/AC1D07tG+anpcUnbw36XnWNud5oJmLWh0nkduFmFSk4mCiZbh0tK3OQg+z0tzRrHs0QTEC5kt3zJ8SC60d72nNAoGBlWMJj061qltoXgD8lRmzVm4TK4ZEzqSYtaL1OSNUjR+MzC9JySfNuwvQqA0u4UbQjT8atIeLN2aO4tc0uiwDN6LtJ1M/cTQMiPqRe1c7/wSxkGqaokVy8U8H5jFuO8t+eG0afqQGVFnURgadZ6wpZiLLeB+UCEYx8ebwi8/EPRfnFaiVA16JVn1jRAx9hn2ikqZ793hbypp8jQ7wP430SQ34KmyBWuncI6lBJNZseN8aH0G1fdisKEg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:VE1PR08MB4783.eurprd08.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(376002)(136003)(396003)(366004)(346002)(39850400004)(7116003)(6496006)(186003)(16526019)(26005)(1076003)(4326008)(786003)(6916009)(55016002)(9576002)(52116002)(33716001)(5660300002)(478600001)(83380400001)(8676002)(2906002)(956004)(8936002)(9686003)(66946007)(66556008)(86362001)(66476007)(316002); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: Kuy41XqGHpNLZDHejXgGpUTlpD9FFgrf/90e+1Tst4xWxJPP6LBLZzaOJflc9ZkQapqBWNRvxAwj6olycJNzEVsEMgzhsVS4pEkwXh2aeQPROMZf6Yl8Q+UAiw3jVQsPQiulT2nbOjd17wNZhaoG2DmOozTWrCULD8nixR6KgThe1lNdcruotC25DCFOWbK1K0kVsha9ouSFUj9mPrqFB6CzxBJlrYo7uL0qTt73prbiWq6eGQ+2VLkR571a86+YcaxRLoWRFI29LLbBf1DMoNwYw7vbOYEFem8N0tIZBwLLkH9en0mz5OnFQDGXAoRiU/5xvRpzQZC5xetHM9xWsxt3QbsnfCK3lmeYwxt5HzOurQhX9O0gyeKlI3YwU4BQsGYjQPWuoIp/gm4NJRm8c+LJcn9ZtACRq//KB7Mq1rKzS3DW7p4DsolyZCiESgqI8rhNjGQ2tBJJrX5DsB1v877VHkI0OHtcsiNoOl5zIs54PixV0xHOM/Rd9/O/Bzuc X-OriginatorOrg: fer.hr X-MS-Exchange-CrossTenant-Network-Message-Id: b4796c57-e0e7-49d4-98b0-08d8294bfa63 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4783.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 16 Jul 2020 05:49:17.5041 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: ca71eddc-cc7b-4e5b-95bd-55b658e696be X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rsxHBJgC7Ddnss5fMP9Fz+b/fJKEJs2aASR79XCy9AuGjwW5HTT2xy/GmXBnPzB9 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR08MB4559 X-Rspamd-Queue-Id: 4B6jxX4hMvz43vW X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=ferhr.onmicrosoft.com header.s=selector2-ferhr-onmicrosoft-com header.b=dGzLs5nO; dmarc=none; spf=pass (mx1.freebsd.org: domain of zec@fer.hr designates 2a01:111:f400:fe0a::602 as permitted sender) smtp.mailfrom=zec@fer.hr X-Spamd-Result: default: False [-2.90 / 15.00]; MID_RHS_NOT_FQDN(0.50)[]; NEURAL_HAM_MEDIUM(-1.04)[-1.036]; R_DKIM_ALLOW(-0.20)[ferhr.onmicrosoft.com:s=selector2-ferhr-onmicrosoft-com]; HAS_XOIP(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a01:111:f400::/48]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[fer.hr]; ARC_ALLOW(-1.00)[microsoft.com:s=arcselector9901:i=1]; RCVD_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[ferhr.onmicrosoft.com:+]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[2a01:111:f400:fe0a::602:from]; NEURAL_HAM_SHORT(-0.87)[-0.866]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; SUBJECT_ENDS_QUESTION(1.00)[]; ASN(0.00)[asn:8075, ipnet:2a01:111:f000::/36, country:US]; RCVD_TLS_LAST(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[31.147.103.178:received] X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Jul 2020 05:49:22 -0000 On Thu, 16 Jul 2020 07:26:22 +0200 Marko Zec wrote: > On Wed, 15 Jul 2020 16:26:25 -0700 > John-Mark Gurney wrote: > > > I happen to be looking at the implementation of IFQ_DRV_PREPEND, and > > unlike IFQ_DRV_DEQUEUE, it doesn't obtain the lock when manipulating > > the ifq. I took a brief look at a few drivers, and it looks like > > some of them expect that _PREPEND lock the Q like _DEQUEUE does. > > > > This is likely not an issue often, since it's an error path that > > likely rarely happens, but we should fix it. > > > > Should we just add the IFQ_LOCK/_UNLOCK to the macro? > > > > Comments or thoughts? > > I also have a hard time understanding the semantics of IFQ_DRV_* > macros: per altq(9) they appear to be variants of their IFQ_ > counterparts which are intended to be protected by some other > mechanism rather than IFQ_LOCK, but in some instances this isn't the > case, as they do grab the IFQ_LOCK. Hmm it's not that unclear after looking better: ifq_drv_* parts of struct ifaltq should be protected by some external mechanisms when using IFQ_DRV_ macros, and ifq_ parts are still protected by ifq_mtx. So it doesn't look like IFQ_LOCK/_UNLOCK should be added to IFQ_DRV_PREPEND()...