From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B511B26B95D; Thu, 27 Feb 2025 18:41:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=198.175.65.13 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740681705; cv=fail; b=tqXA8KDOxhnau1tbB3c8wfQ7jshDgspZwxqdji0dhOThnf16sqckMsnFhCaDqtU8EuJkOtfha+m9wfDwJUD2DuISdCn8VqauCZKhQKj0kL+xjH4PaHIc0k5qpjfhLcLwbpXE54gM/eCm9+lcFL8vICFJ4RjMbPKSl2RVk8bKo2c= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1740681705; c=relaxed/simple; bh=g7Uzs+lOBkE9lfeVvRFe7I6kRlSTyr/34XWM94lo6J4=; h=Date:From:To:CC:Subject:Message-ID:References:Content-Type: Content-Disposition:In-Reply-To:MIME-Version; b=rDFCVuSBIm1PCbI03ns3MeJahSKWIrudviqYpurrm0ajtr7OXk6mfamo4piC0SJyUAkYwuVNWQveCTXVLPIGDmtrZaC8gWaJs/JkFhySzJzpeV69tci98nouReLc7J1e3o6oUj4dey6L7dt0m0zOtxQyIMzV/4E+hHgkA9cROkU= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=Fkjmx0i5; arc=fail smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="Fkjmx0i5" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1740681704; x=1772217704; h=date:from:to:cc:subject:message-id:references: content-transfer-encoding:in-reply-to:mime-version; bh=g7Uzs+lOBkE9lfeVvRFe7I6kRlSTyr/34XWM94lo6J4=; b=Fkjmx0i5GwpxB4QOZMO0uPVTEP8Nq9TUTMdl8lgisBzeyhcqns9TdBJg yIajk65/XyFxj48A8iljTCvgWFvLG7zVUdrEH8xqZMbzmvF6hWXm85cXz HIiwkDNYNnU/xdgRNK57XQDwIDt6wxk+BXabMiuGHMzPkvVlvHZ1fgVwh 5XHkQa3+glTElm+4fj9rmGHafKkBTSLj0gy4bRJM5X661hr9UJ0/h0ATW jLjNFN4nH4JMlEzCXaXVNIEB19soayJpxuhtXEvYGiUCBbqJwMfH9xOCo LrCHByb3VGeoGRwUf3VM2g7oTZZpbMae/q5KH267DwKtlFid0JozXTj4v w==; X-CSE-ConnectionGUID: eKrIsla0T3yfI7EmLb1jvg== X-CSE-MsgGUID: qp9YqophTyagntqx9wuz/Q== X-IronPort-AV: E=McAfee;i="6700,10204,11358"; a="52576424" X-IronPort-AV: E=Sophos;i="6.13,320,1732608000"; d="scan'208";a="52576424" Received: from orviesa010.jf.intel.com ([10.64.159.150]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2025 10:41:41 -0800 X-CSE-ConnectionGUID: EewwpXHJT4+MyRlIYE4LPQ== X-CSE-MsgGUID: V2jI6DqlS4qdihdMB2SwTA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,224,1728975600"; d="scan'208";a="116978825" Received: from orsmsx903.amr.corp.intel.com ([10.22.229.25]) by orviesa010.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 27 Feb 2025 10:41:41 -0800 Received: from orsmsx601.amr.corp.intel.com (10.22.229.14) by ORSMSX903.amr.corp.intel.com (10.22.229.25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.2.1544.14; Thu, 27 Feb 2025 10:41:40 -0800 Received: from orsedg603.ED.cps.intel.com (10.7.248.4) by orsmsx601.amr.corp.intel.com (10.22.229.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.44 via Frontend Transport; Thu, 27 Feb 2025 10:41:40 -0800 Received: from NAM10-MW2-obe.outbound.protection.outlook.com (104.47.55.42) by edgegateway.intel.com (134.134.137.100) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.44; Thu, 27 Feb 2025 10:41:40 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=E718tS7oZ8jtQjVdwbbzjWGklRq7SPoAc1WGaADianNs77wCkClzrcNy2EYHR0y8/199VRLDvixHyIel6L4KjfoOf3QlkS52wMDXrXiLZHbt70dxH0gJ1Ho+ysNlcmlkfSdbnwatjTHo0hiP7BbdeCunWY/enyhk5m52gIuMt2U/1lUZSIfiQP7vLObE/EXR1E4dQSDd3WZ4Ro76iMYmiC/hmHXiBBdYxyj4yrdWxtXr3J91LOpRAyrV4ob/1RualXNsWlBd22FFsyVuKBzZ7yguTfjfKz1F6pbZ/WAYqf6fLUyZqeefEBOkAgUCRo+b3jEdVquFq558Q216CBl9oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=ZqRZ5DGjA8yqANadDEqHHv/848jHvF95+NTu3k/B8SE=; b=y8ERevMF0U0dXZAXpByIaw/hm/D5mnaNHaUwdcVQI4EMKrQO80okSeoUOKk1yNMuwAYN4ExAfMDxA7SPdG9cjjMBTC2g6UHvN0X+erriX7PR7VLCohFPM8wfwqlL4auwEldVEQhU1iARlWGmAz83fATfJIDqtpWjOef4Bt9DBBjoNjINVL9WeDoATXxiz2Gh+AMEOrKTPqXrp1YsU6+NgXJqQKogLHZkcSznwZtyktVdpqXq23GiQrMMIKZOGpf8VUfIYKRwRE6eCwKaIUSpy/I/T/nV29KG6X1HVxM1RXjsPsafgC6lxObcKdLE7INnQEk/rv5i5zrcv18YtYaTtw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; Received: from DM4PR11MB6117.namprd11.prod.outlook.com (2603:10b6:8:b3::19) by LV2PR11MB5997.namprd11.prod.outlook.com (2603:10b6:408:17f::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8489.18; Thu, 27 Feb 2025 18:41:06 +0000 Received: from DM4PR11MB6117.namprd11.prod.outlook.com ([fe80::d19:56fe:5841:77ca]) by DM4PR11MB6117.namprd11.prod.outlook.com ([fe80::d19:56fe:5841:77ca%3]) with mapi id 15.20.8466.024; Thu, 27 Feb 2025 18:41:06 +0000 Date: Thu, 27 Feb 2025 19:40:55 +0100 From: Maciej Fijalkowski To: Alexei Starovoitov CC: Jakub Kicinski , bpf , "Alexei Starovoitov" , Daniel Borkmann , "Andrii Nakryiko" , Network Development , "Karlsson, Magnus" , Martin KaFai Lau , Amery Hung Subject: Re: [PATCH bpf-next 0/3] bpf: introduce skb refcount kfuncs Message-ID: References: <20250220134503.835224-1-maciej.fijalkowski@intel.com> Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-ClientProxiedBy: WA1P291CA0012.POLP291.PROD.OUTLOOK.COM (2603:10a6:1d0:19::9) To DM4PR11MB6117.namprd11.prod.outlook.com (2603:10b6:8:b3::19) Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM4PR11MB6117:EE_|LV2PR11MB5997:EE_ X-MS-Office365-Filtering-Correlation-Id: ead60025-329f-4fd0-5e1c-08dd575e4b96 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014; X-Microsoft-Antispam-Message-Info: =?utf-8?B?eGozQjR5R2NyUjNRditGYmthd0dnS1VDNjgxU3p1VFU4Sm5XT3Azd3psUDE0?= =?utf-8?B?VlVxN3ZlcklMcGdRYnZQZGMyTEgyLzAyeEV6eTJiTUtobyttNUdqSWJCN3hG?= =?utf-8?B?QlFtd0Q0Q1ViK3BlYmRlVTFoZTNhdkpudVRMWnZxZjlicWdJTTBlUW1BQ0JR?= =?utf-8?B?SStOOGhERExFd1BiTHFVaklFSDhTWGI3S3EyN3lSaTAxM3Rpc0NwY2d0NVgx?= =?utf-8?B?QytDZVNLaEJGZFRBS0w5Q2RKTzUzaXRtajJGZWRHcVBMdFVSbW5TNW5nV3p4?= =?utf-8?B?ajRiR1M3aDdHVzhTRDdGc0tQcTEva0g0NlY4NU0rN2VUeWhmK2Z0T0VHeXMw?= =?utf-8?B?ZW0vVzlLQUpBYmJsSWlGMGVmeVRHOG1YVFZFbi9yZmFmRElSM1hhTjBoY1hV?= =?utf-8?B?eDlMS3NsckpySDlrL0wrcy9jb2g3Z21oNmd3N1F0Z3BvUWRVQ3QxeHJidmRV?= =?utf-8?B?d0JSeTgyUHBBUHN6UGZDd1d4ZlJUbXVNV0Q3R24vUDhNUHRjR2NTTkdFOVRV?= =?utf-8?B?KzBEZE5J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VExCdGxRL2x5emF1RmdrOEpJWFZpY3JXNnJ4d3VVVG5iRGJEKy8vZ0JIY0Vw?= =?utf-8?B?NmtyUWVXT3JVTVpWdmRNUTZuZ3RjN01FbGJZRkNFWS9UREp6QXp6ckRScW1q?= =?utf-8?B?dTJzZ3lKZmtRdVNieFZLSVpYUytxUzI3YU9PRnhwZld6K3ZzbDUvUitLYm9O?= =?utf-8?B?ejJRbFNzUUF2SDk2ajNidGpTczJHaHpvRW5DczFUUmdJYTVDc29hM2JyUGM3?= =?utf-8?B?UGlkVEtDRTdWN1VmWFRlK28wRWo4ZzFUU1FwVURZZnYzY21xaDh5N3UrY2JI?= =?utf-8?B?MjdrUG4wZWlTZUUxem16ZzB5bVBPeXVjZHZ6WUhTYkorVjRIRHFOZnFlMUFp?= =?utf-8?B?NEhhWk1rREhRNExKdGtpZz09?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM4PR11MB6117.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?ZFM1b3l5Qk9icWNBa0Vpa1NPQTVmUzFUZkRpUWFPYVA4UFI2WUdCM0c0WFBr?= =?utf-8?B?Mk9CV3p1UFZlMHlxMVdRQnNWUVMyZHZNa21rKzVKbEdrVmRGOElJUUJEcnBU?= =?utf-8?B?Uzh0SjRrVGk4eitJeUh2UXlVQ0xZSU9RNndGcmZqeXRpQ0I2TkZBdUw4dzR6?= =?utf-8?B?QTNSMVJZV2EzNHdrZ3llR1JrK05vY3p6VlNXTmliZlVjMUFUNnRXejVuNjdK?= =?utf-8?B?MFVnYVJVbXVSMDF6bGR5Z2ZaZlpCVFc2TmlDRDZJeUQ0Y1RTNFAycCtLOXRL?= =?utf-8?B?Ry95NHlMdnBLcFF1azh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?utf-8?B?VUlTaHJJR0pSRmVHZEY2bEgzQW1DZVJEdDlyRHQxaHlTWVY4TkdCSXFkZG0x?= =?utf-8?B?SVE9PQ==?= X-MS-Exchange-CrossTenant-Network-Message-Id: ead60025-329f-4fd0-5e1c-08dd575e4b96 X-MS-Exchange-CrossTenant-AuthSource: DM4PR11MB6117.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Feb 2025 18:41:06.4354 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DBJVxubn0QUTPAPAWOkZBjjsuiHzKRfzlUXMXoZksa6KrlwKjLHULaKxXcrG05gyORtODQQzvX9sr57DmrKX+gaXi55Pxv6p7SzSc3gs5KU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV2PR11MB5997 X-OriginatorOrg: intel.com On Wed, Feb 26, 2025 at 09:30:18AM -0800, Alexei Starovoitov wrote: > On Tue, Feb 25, 2025 at 6:27 AM Maciej Fijalkowski > wrote: > > > > On Fri, Feb 21, 2025 at 05:55:57PM -0800, Alexei Starovoitov wrote: > > > On Thu, Feb 20, 2025 at 5:45 AM Maciej Fijalkowski > > > wrote: > > > > > > > > Hi! > > > > > > > > This patchset provides what is needed for storing skbs as kptrs in bpf > > > > maps. We start with necessary kernel change as discussed at [0] with > > > > Martin, then next patch adds kfuncs for handling skb refcount and on top > > > > of that a test case is added where one program stores skbs and then next > > > > program is able to retrieve them from map. > > > > > > > > Martin, regarding the kernel change I decided to go with boolean > > > > approach instead of what you initially suggested. Let me know if it > > > > works for you. > > > > > > > > Thanks, > > > > Maciej > > > > > > > > [0]: https://lore.kernel.org/bpf/Z0X%2F9PhIhvQwsgfW@boxer/ > > > > > > Before we go further we need a lot more details on "why" part. > > > In the old thread I was able to find: > > > > > > > On TC egress hook skb is stored in a map ... > > > > During TC ingress hook on the same interface, the skb that was previously > > > stored in map is retrieved ... > > > > > > This is too cryptic. I see several concerns with such use case > > > including netns crossing, L2/L3 mismatch, skb_scrub. > > > > > > I doubt we can make such "skb stash in a map" safe without > > > restricting the usage, so please provide detailed > > > description of the use case. > > > > Hi Alexei, > > > > We have a system with two nodes: one is a fully fledged Linux system (big node) > > and the other one a smaller embedded system. The big node runs Linux PTP for > > time synchronization, the smaller node we have no control over (might run Linux > > or something else). The problem is that we would like to use the Tx timestamps > > from the small node in the Linux PTP application on the big node. When a packet > > is sent out from the big node it arrives at the small node that send it out one > > of its interfaces. It then replies with another packet back to the big node > > with the Tx timestamp in it. > > > > Our current PoC for attacking this is to store the skb in a map (using this > > patch set) when it is sent out from the big node then retrieve it from the map > > when the reply from the small node is received. We then take the timestamp from > > the packet and put it in the skb and send it up to the socket error queue so > > that Linux PTP works out of the box. > > This sounds like you're actually xmit-ing the skb out of the big node > and storing it in a map via simple refcnt++. > That may work in some setups, but in general is not quite correct > from networking stack pov. > You need to skb_clone() it and keep the clone, so only cloned skb > can go into the socket error queue and up to user space. > xmit-ing the same skb and sending to user space > is going to cause issues. This skb only goes to errqueue and then gets its refcount decremented and dropped, we do not xmit that skb per-se. > > Cleaner design would probably involve bpf_clone_redirect() > and may be some form of bpf-qdisc where packet is waiting in the queue > until its hwtimestamp is adjusted and its released from the queue > into user space. We were working on clone initially but map storage turned out to be much cleaner approach, but we can re-iterate on that in case explanation provided above regarding not xmitting stored skb still feels off for you. > > What happens when small node doesn't send that timestamped packet? > The map will eventually overflow, right? > Overall it feels that stashing skb-s in a map isn't the right approach. We did not handle that in our demo but I believe BPF timers would be useful here, wouldn't they? > > > Note that for the purpose of setting skb->hwtstamp and sending it up to the > > error queue we are adding a kfunc (bpf_tx_tstamp) responsible for it, which is > > not included in this set, so I understand it is not obvious what we achieved > > with the current form of this patch set being discussed. > > > > We did not consider the restrictions that should be implemented from netns POV, > > so that is a good point. How would you see this being fixed? > >