From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by passt.top (Postfix) with ESMTPS id 128785A027E for ; Thu, 15 Feb 2024 18:46:33 +0100 (CET) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-563dd5bd382so70a12.1 for ; Thu, 15 Feb 2024 09:46:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708019192; x=1708623992; darn=passt.top; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=wrbbgS5IFLC04j4ol7wixx3VoqSRukujNYOqeLy/Tj8=; b=J65FOAzU8CYE9n+m4X2K/FEfxP0KvuiZ6Yu/hXAbWaGLpgrmq5uDtUeRDK8vZteNX7 8vAZXNWnHxFYWtt2oXkvHjW7Di/8+6pgWo3cgxLUcA+Ed7H2qjALI/Jpm64OxhjSq/1P Q41JEb7bJnelg0aYNP6vxIbWGxYExOmu38skTirBI3ZtT1ElfNTJERMsE3v+gq5g4cFz Mc7k/TJGMe62XPHxslCU9gVlU8F6jE5d/mHpWY/Mjcl2IQZl/9ZAx7FDeSTJLjoFr6di 6z2cbYPqMFNv8TLw5tyi2J4ejhjRSFYKTuHPicBZRk+n2x7W/xZw3jTpCoRv+7rPjSEn 8LMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708019192; x=1708623992; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wrbbgS5IFLC04j4ol7wixx3VoqSRukujNYOqeLy/Tj8=; b=XnoPhj/1g1+sfyDNbXQh2ZDL+SorAW4kVD2s3huufzLucFOoWubPdBVXlEetUD0DMa vEF4UTgTz16CFDojSxwiwGNDau78edhtrejN6V6yJcVG0kxw3+MSbki1pxtSY3h0x46e joTsvR5Bas1DQsKb5GYDlGDUgtuSaUElJEDuEqRlbciCC6H/pbORoQddTee4AtgSRB1u Qfg05pjtRat4yjIR5dtfQCG6qmJKBBhhDA3aD9ZqkzDd7LNZZkfsRFZpKO4pAyC1iX0z rhZM0BWGps3CGLKpl/ZWTipaZ+OZW1r8AGJkjRzTxYwgpTIRA133IJ9jlrL826LBKMVS U9uw== X-Forwarded-Encrypted: i=1; AJvYcCUie2vBqpqGbUVeslIL8ImbYsk5MgCsxCPkXMRjk7Afe0mL+fCBzs+0cBkwDKbSAYCwqNOnADOubnB0ZSpXRytUopGG X-Gm-Message-State: AOJu0YxI4G+iFsT39CPev/hac2gtBjqKGL+BRA9/9FODPAIyjztXqBqP TDmY55zgWv/ymCZ1Z2Lz7C13gFegE/Ipf38XHKeQ5DGb+qnghdqFRJrUGPDudPE8mUJ4bNIZhOd 9l98r/LZW9fIsX3Ui83cCiYonwJXVD6R4/JgG X-Google-Smtp-Source: AGHT+IGuia/mk6fNALuebkkgZMkpTELxRjyQnguWv9uSUuMGe5xGsAMLeMypQICyXEfv/RgEOaREduHcq6rWaBmJD0I= X-Received: by 2002:a50:cd8c:0:b0:561:a93:49af with SMTP id p12-20020a50cd8c000000b005610a9349afmr5724edi.7.1708019192439; Thu, 15 Feb 2024 09:46:32 -0800 (PST) MIME-Version: 1.0 References: <20240209221233.3150253-1-jmaloy@redhat.com> <8d77d8a4e6a37e80aa46cd8df98de84714c384a5.camel@redhat.com> <20072ba530b34729589a3d527c420a766b49e205.camel@redhat.com> <725a92b4813242549f2316e6682d3312b5e658d8.camel@redhat.com> <20687849-ec5c-9ce5-0a18-cc80f5b64816@redhat.com> <178b9f2dbb3c56fcfef46a97ea395bdd13ebfb59.camel@redhat.com> In-Reply-To: <178b9f2dbb3c56fcfef46a97ea395bdd13ebfb59.camel@redhat.com> From: Eric Dumazet Date: Thu, 15 Feb 2024 18:46:18 +0100 Message-ID: Subject: Re: [PATCH v3] tcp: add support for SO_PEEK_OFF To: Paolo Abeni Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-MailFrom: edumazet@google.com X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation Message-ID-Hash: WKTMV5WYFTYYUG26IAVEQF4TQTCBZF2N X-Message-ID-Hash: WKTMV5WYFTYYUG26IAVEQF4TQTCBZF2N X-Mailman-Approved-At: Thu, 15 Feb 2024 19:32:10 +0100 CC: Jon Maloy , kuba@kernel.org, passt-dev@passt.top, sbrivio@redhat.com, lvivier@redhat.com, dgibson@redhat.com, netdev@vger.kernel.org, davem@davemloft.net X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Thu, Feb 15, 2024 at 6:41=E2=80=AFPM Paolo Abeni wro= te: > > Note: please send text-only email to netdev. > > On Thu, 2024-02-15 at 10:11 -0500, Jon Maloy wrote: > > I wonder if the following could be acceptable: > > > > if (flags & MSG_PEEK) > > sk_peek_offset_fwd(sk, used); > > else if (peek_offset > 0) > > sk_peek_offset_bwd(sk, used); > > > > peek_offset is already present in the data cache, and if it has the va= lue > > zero it means either that that sk->sk_peek_off is unused (-1) or actua= lly is zero. > > Either way, no rewind is needed in that case. > > I agree the above should avoid touching cold cachelines in the > fastpath, and looks functionally correct to me. > > The last word is up to Eric :) > An actual patch seems needed. In the current form, local variable peek_offset is 0 when !MSG_PEEK. So the "else if (peek_offset > 0)" would always be false.