From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8653F20C037 for ; Wed, 29 Oct 2025 07:52:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.130 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761724328; cv=none; b=ZuY0j6+5jhH7ONdU5MDj/nfhqfqbhprJB/xvVPGtmLDFgylR91c+P1mvHAAQ294CaoFQClb4QYh4kalkVycQmlCL/s06Ds1aV0cfWdTAEYo3iRVRNqv0BOurCvIP4A7pKE6FTsThOVbBZu59/9nMqCy+k4+EI++iYEZIYY/0BdU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761724328; c=relaxed/simple; bh=EdxIjKui8u45fzpK9ep7REM1Y/DVveM7ve5cTI4ft+k=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=f1D43926pH65gvG6YHUdHx/XfDztGoyTbTlrvr1S9gTYA3Q7IPKuf86lU9rPZoy5gvxDpZd9AWulG3zbnSa1THdMnI3dvwAF7AS83QAurpQ/U69khbH3el+lCHtwBUIlaat5qlaz06/jTrUDIUCDdy7yB+vy9btVJ7a+nrjhCDk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=VlmSMFxl; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=g18in9NY; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=VlmSMFxl; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=g18in9NY; arc=none smtp.client-ip=195.135.223.130 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="VlmSMFxl"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="g18in9NY"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="VlmSMFxl"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="g18in9NY" Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 99D7322752; Wed, 29 Oct 2025 07:52:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1761724324; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vu+F0d+EF+KmPmt6EnZZvWO28Q6HugHteealXWB3bpc=; b=VlmSMFxllvxjFJ2kuDNbi/W3QfFvcZXWp9HhCQo+5UnMl4dSEhuXS404+nEkaZQofaNuPa L8H6Zh0m4/BqNv19bLnGMvzWaS9DSHs9rXW1Bg0al1iwfT1HbGeHhwUsw3C38eEiEhzp6s qvhfemF9BkDxy3VPtGWzbctll75fadQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1761724324; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vu+F0d+EF+KmPmt6EnZZvWO28Q6HugHteealXWB3bpc=; b=g18in9NYF2CXyJrSKB+emRR0+3rqxYNLP6KhjfoakdUvzj5xG5utWWXGhanZf3NE25aeHd 4UipgEoLi9F6JUAQ== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1761724324; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vu+F0d+EF+KmPmt6EnZZvWO28Q6HugHteealXWB3bpc=; b=VlmSMFxllvxjFJ2kuDNbi/W3QfFvcZXWp9HhCQo+5UnMl4dSEhuXS404+nEkaZQofaNuPa L8H6Zh0m4/BqNv19bLnGMvzWaS9DSHs9rXW1Bg0al1iwfT1HbGeHhwUsw3C38eEiEhzp6s qvhfemF9BkDxy3VPtGWzbctll75fadQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1761724324; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=vu+F0d+EF+KmPmt6EnZZvWO28Q6HugHteealXWB3bpc=; b=g18in9NYF2CXyJrSKB+emRR0+3rqxYNLP6KhjfoakdUvzj5xG5utWWXGhanZf3NE25aeHd 4UipgEoLi9F6JUAQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2FBB61396A; Wed, 29 Oct 2025 07:52:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id DsCrCKTHAWkjIAAAD6G6ig (envelope-from ); Wed, 29 Oct 2025 07:52:04 +0000 Message-ID: Date: Wed, 29 Oct 2025 08:51:58 +0100 Precedence: bulk X-Mailing-List: bpf@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2 bpf v2] xsk: avoid data corruption on cq descriptor number To: Jakub Kicinski Cc: bpf@vger.kernel.org, netdev@vger.kernel.org, magnus.karlsson@intel.com, maciej.fijalkowski@intel.com, sdf@fomichev.me, kerneljasonxing@gmail.com, fw@strlen.de References: <20251028183032.5350-1-fmancera@suse.de> <20251028183032.5350-2-fmancera@suse.de> <20251028160107.5c161a4f@kernel.org> Content-Language: en-US From: Fernando Fernandez Mancera In-Reply-To: <20251028160107.5c161a4f@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spamd-Result: default: False [-4.30 / 50.00]; BAYES_HAM(-3.00)[99.99%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; RCPT_COUNT_SEVEN(0.00)[8]; FUZZY_RATELIMITED(0.00)[rspamd.com]; MID_RHS_MATCH_FROM(0.00)[]; FREEMAIL_ENVRCPT(0.00)[gmail.com]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_HAS_DN(0.00)[]; FREEMAIL_CC(0.00)[vger.kernel.org,intel.com,fomichev.me,gmail.com,strlen.de]; TO_DN_SOME(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:mid,imap1.dmz-prg2.suse.org:helo] X-Spam-Flag: NO X-Spam-Score: -4.30 X-Spam-Level: On 10/29/25 12:01 AM, Jakub Kicinski wrote: > On Tue, 28 Oct 2025 19:30:32 +0100 Fernando Fernandez Mancera wrote: >> Since commit 30f241fcf52a ("xsk: Fix immature cq descriptor >> production"), the descriptor number is stored in skb control block and >> xsk_cq_submit_addr_locked() relies on it to put the umem addrs onto >> pool's completion queue. > > Looking at the past discussion it sounds like you want to optimize > the single descriptor case? Can you not use a magic pointer for that? > > #define XSK_DESTRUCT_SINGLE_BUF (void *)1 > destructor_arg = XSK_DESTRUCT_SINGLE_BUF > > Let's target this fix at net, please, I think the complexity here is > all in skbs paths. I might be missing something here but if the destructor_arg pointer is used to do this, where should we store the umem address associated with it? In the proposed approach the skb extension should not be increased for non-fragmented traffic as there is only a single descriptor and therefore we can store the umem address in destructor_arg directly. The size of the skb extension will only increase for fragmented traffic (multiple descriptors).. but sure, if there is a fallback to the slowpath, it will burden a bit the performance. Although, for that to happen the must have tried to use AF_XDP family initially.. AFAICS, the size of skb extension is only increased when skb_ext_add() is called. Thanks, Fernando.