From nobody Wed Apr 17 08:22:52 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VKDSB23Kdz5J7SJ; Wed, 17 Apr 2024 08:23:06 +0000 (UTC) (envelope-from zec@fer.hr) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2137.outbound.protection.outlook.com [40.107.21.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mail.protection.outlook.com", Issuer "DigiCert Cloud Services CA-1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VKDS94stdz4Gd1; Wed, 17 Apr 2024 08:23:05 +0000 (UTC) (envelope-from zec@fer.hr) Authentication-Results: mx1.freebsd.org; none ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Okt8i8okNV9TwEuDLnrEr8LDED1+mObzec5h/i0IdaqP4ofRR70KfympMf/qv1BKjr5c7xnyrLycBneneZkT62KWH/taSj3pUqb70TDVkYTBhdlr/YIfYkVgozBdhmFbv4WVTzNRo4s/k279PxGQWvd5twQrLv9pbEBu8hCtnFqB3uFEm00hjmjxxWcf/wO575KWF9ASmVSB3ETYz5WgmDmcJTbcIYqM7ps45XXCcU51GJjzlkvalNk3ThJeRNzGkVg25X9pzZ6K1HWLqQLnkSbD7m/zHTUfXHnq7KWJKsGLN/JXKLP6DX36mBQnhyid3taRPMaarrQ5HiS79uIUJQ== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=o6T36yqdRtfvOKKJFbx21Cn6FT/vclMZ4CtGcGy33Fc=; b=WBwm9yUD7VIusaurp3R47msPyO6r3/1z9J9gG5MqaFgMio/KCumMiHEJbGxEAENAMAg/vC2eo5BiERbCTHweKVKMYsxwfvgL9OZxynFQhtWfmVhtumUY8DhGw9D05ZMU73B4OV06J4U5FB0+vuqiWNYKi52TDedLL0FAnACaYJ1ybkmWdan686gAoMRRpOVhez3mDtf5H1Vw28T5xkBiwSgvxQj5jvUNfoK+/cqArBa/Mz3MipxTeg/uMR7QljOPJ8kJUOW8840J5JYak6oPQe6BX6S5rubh5sLgaNmtVDdMmaoeFVini1JelQI+TrztwnbV5oKowsZmlaeFzlh4DQ== 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=o6T36yqdRtfvOKKJFbx21Cn6FT/vclMZ4CtGcGy33Fc=; b=X7JYE9Z3lH7I8De5pzQOjVBxGMyyzxLZ7xyDSGEsVoq9IYwT8N2iwnAcepCqtgfJPGosvzLaq5g54vq5dnErI6NTs8QgN7CB1IdlFIu5VpL+roE9B5micaXaEB00qVrH2alX0LStT8dnuCs4i9ExTyY/4ko0Rb2bk2DjK71e5eo= Received: from GV1PR08MB8257.eurprd08.prod.outlook.com (2603:10a6:150:8b::12) by PAXPR08MB6703.eurprd08.prod.outlook.com (2603:10a6:102:138::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.37; Wed, 17 Apr 2024 08:22:58 +0000 Received: from GV1PR08MB8257.eurprd08.prod.outlook.com ([fe80::8099:64c2:e811:e453]) by GV1PR08MB8257.eurprd08.prod.outlook.com ([fe80::8099:64c2:e811:e453%4]) with mapi id 15.20.7452.049; Wed, 17 Apr 2024 08:22:58 +0000 Date: Wed, 17 Apr 2024 10:22:52 +0200 From: Marko Zec To: Gleb Smirnoff Cc: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: Re: git: 8062f37d1c99 - stable/14 - vtnet: set VNET context in RX handler Message-ID: <20240417102252.27e1038d@x25> In-Reply-To: <202404161558.43GFwoEt095208@gitrepo.freebsd.org> References: <202404161558.43GFwoEt095208@gitrepo.freebsd.org> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; amd64-portbld-freebsd13.2) Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-ClientProxiedBy: VI1PR0102CA0054.eurprd01.prod.exchangelabs.com (2603:10a6:803::31) To GV1PR08MB8257.eurprd08.prod.outlook.com (2603:10a6:150:8b::12) List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: GV1PR08MB8257:EE_|PAXPR08MB6703:EE_ X-MS-Office365-Filtering-Correlation-Id: 3047e1d0-3ce2-4d37-7ad8-08dc5eb796da X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m5+fUY5slboR6NqdMtKhJqdzeY2RG+rrjIEeCw/S4b3EJ0oddTwmCRiFnNKK8J5eCFFJ+dFkdZa5aaHQc7S0F7NFMuWRsb/SDM7V1GY9wlcXzQ6WuXcyX3f9xXIXqTspJ3IUJR+wpme5K0c3FT/SqeEfc+/B4Gpz1vfWds5NUGGD03bICi+RKMIHQ1kNDrN2gLhtZfX/st78EVOPkis0JYtJfigv58Mw3odj7AMZsNzwqpU6XWKLH3Up1T+fcWMX7+/Vz1ualjuvtSt1Y5/ckQL3TKn+LVcV9+5MyYdGBZ6PPpj6efRUfkzh9oYqgz2Vaw24VNDfE2YHNcvCoIB3Bt6ZbFLdptKmssrh4xhuCNs15Lx4zsKLlWSXPOnpFwa7t51TRy7HSdVGR37pa+HgesDp84xu1v3bpSyFD9QqHMsp0ulTDrO/B/udET5uiXFsldjm7c5J3xBf6XgQb/NBRx/lMfz/lzmmKLzriqBNbyApKfUmd3xK8BpbVEPabdR538llC2/O1IO24gUcc+Pf/sZfBuFgfCX2d5J/2o2RCVFo1TGb2tSRJ/xzZ2vZgiNrGIeCJV5vgACEM+AYA7ruGyAOSfjOkQFZZCebyx+0Cqt5+puNW7jIPdccAHho2gbs5JA8gdT10h2KEFmCEj4Qylu6HInVA6aYa3K2ITAF8N0= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:GV1PR08MB8257.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(1800799015)(41320700004);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?HFw0Wrb1Wlw1R/fq47SOUwM/drB8UtEmEa+L6qrIPGDdOFluH7fvcJ7khnAY?= =?us-ascii?Q?ZLApJjrgvFNvjz2caxMODjsJmad+rFFW5kbmk7/KpeIwc7LkU7SgYrX+t9qc?= =?us-ascii?Q?cj+mM2S920sGRJYlzAHVRbo1YN8aoETbHnH0myWNqUDcQIBzw9N9Q0ON56gD?= =?us-ascii?Q?8+ByALFYLrepiIAV7yJALBMCMrbGajqit3I+fbsnHTz5oAb4XWaTT+5aDCql?= =?us-ascii?Q?QDgnqJFCTHhpVjGJsrGJCtIW49EQnF1H3bsQKoiAgk639nHl4J/cJYC97oOD?= =?us-ascii?Q?YroiO6cjqRUZnp74fvLYLNbXYACKwqrjY7RIWK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k4tMi2W3Ywz+tpBy4yap1Vh0swPngXIQZxblVnCoB4azU+2T0GcH3j4?= =?us-ascii?Q?pxE8LlrKPzmgiDPOHiAtLtDIbzcoeHPOTaC+2Oh9XExZPdb1UUMy7K9bT2eI?= =?us-ascii?Q?8Y9lFyBB3ZitvFiClqKYvd8s9Quxb8dYpAw0OSy/mpgkvfzwYqF5CrC/Ahv0?= =?us-ascii?Q?ZnlNiM5AfL2wTrd0a8/F4Z2gyKWpQGH13en9JhiVTRoi1ET9sklWwJ+bqckl?= =?us-ascii?Q?8m8KD2nSwcA/e0rMFeUw7+VqmgkZ5bZqOeOIjk1ha0O17clhy1Ch1+5df5OT?= =?us-ascii?Q?uM1f/TL9XgcCfigY5uDUrgZNBVn0yI189kzc9h6V+ALGsaXHbS9Ul+JGcA71?= =?us-ascii?Q?QHjXQdae2rexSgpUVN0=3D?= X-OriginatorOrg: fer.hr X-MS-Exchange-CrossTenant-Network-Message-Id: 3047e1d0-3ce2-4d37-7ad8-08dc5eb796da X-MS-Exchange-CrossTenant-AuthSource: GV1PR08MB8257.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Apr 2024 08:22:58.4441 (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: rubCBVhomlSqw7gRSBC5xhdOLD6QG4KTdJGcu8kZyz/yl0+cWVo7HP4GUngkCxKC X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR08MB6703 X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:8075, ipnet:40.104.0.0/14, country:US] X-Rspamd-Queue-Id: 4VKDS94stdz4Gd1 On Tue, 16 Apr 2024 15:58:50 GMT Gleb Smirnoff wrote: > The branch stable/14 has been updated by glebius: > > URL: > https://cgit.FreeBSD.org/src/commit/?id=8062f37d1c99ded250b36ad90fb32bb5f77ee600 ... > vtnet: set VNET context in RX handler Two questions: 1) why is vnet not resolved directly via ifp->if_vnet, i.e. why do we need to go through if_getvnet() here? Not only is if_getvnet() unnecessarily making a function call to return a value of a struct member already at hand, but is doing this on a hot path. if_getvnet() arrived in 0d2684e15e415cef652e0f75e88962a674bffe04 / D38202 as an "accessor" function with a declared intent to help a vendor maintaining their private out-of-tree drivers independent of changes in struct ifnet layout. While this indeed may make sense for certain vendor-specific use cases, why do we need to take a penalty of calling if_getvnet() in internal code, here and elsewhere? if_getvnet() use is starting to get widespread, and it would be nice if we could hear the reasoning behind this school of thought, and perhaps document when the call should be used, and when prefereably not? 2) why is CURVNET_SET_QUIET() used instead of CURVNET_SET()? Which VNET recursion are you trying to quiesce with the _QUIET() version? > > The context is required for NIC-level pfil(9) filtering. > > (cherry picked from commit > 3f2b9607756d0f92ca29c844db0718b313a06634) --- > sys/dev/virtio/network/if_vtnet.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/sys/dev/virtio/network/if_vtnet.c > b/sys/dev/virtio/network/if_vtnet.c index 7d6411876b3d..245a6b6d7359 > 100644 --- a/sys/dev/virtio/network/if_vtnet.c > +++ b/sys/dev/virtio/network/if_vtnet.c > @@ -2095,6 +2095,7 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) > > VTNET_RXQ_LOCK_ASSERT(rxq); > > + CURVNET_SET_QUIET(if_getvnet(ifp)); > while (count-- > 0) { > struct mbuf *m; > uint32_t len, nbufs, adjsz; > @@ -2188,6 +2189,7 @@ vtnet_rxq_eof(struct vtnet_rxq *rxq) > #endif > virtqueue_notify(vq); > } > + CURVNET_RESTORE(); > > return (count > 0 ? 0 : EAGAIN); > }