From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) (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 A353F3CA490 for ; Wed, 27 May 2026 09:03:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779872595; cv=none; b=GcHn9q6ktkeeCl/qpFZHZ31WK24E0siIDY3ZNWUaSuyZxN18Fw8giZiYeMseoU+D32X1GXHGv5SMPLbrhgrYmt3g57gWfeZuE0o645U7KAeXEJNIcZKyp01xP5MC0hVSRHH6ZY/cqow/ROtS98silA4SLAUQOe0sllx/z+iqHZc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779872595; c=relaxed/simple; bh=bw2PKfkeEdwE1nOrdCRw94f+4a2bIqm/xew1+TLymQ4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=b8B+fWue3GguBrQhWbgPVEDtv/tiGsjIZ8HPwEuilaldCMIkSI7oxE/o9E75TFrPjguEmgiCB7ADIpDvJrYyvXtsIB2ohhVWTSdVH6Kpa4Bua99JCHYDsOMNHDe2Fcek9c/DT3fHOx75KiAqwf8mO4Z1W8vczNS2MEX59cVX0IQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.128.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=debian.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4891e86fabeso19044085e9.1 for ; Wed, 27 May 2026 02:03:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779872592; x=1780477392; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=a/mfvQTmje2KaryVvAvAb2JGEAPI/tuuIDCzzcfUK5M=; b=FY7+v+zuBAqIDas1O7nV4hVmusms7m5rh+Xd5tkcdGPguzxkRkw8gSlf/Gu05js7wm PTQ6+mSjNQ159zbW0u58bgqDNUXJLWlUNdFaqXlPiGAk5tU/drFrj3a/ENTiHYJzAKQb exWaNIS06jcHbb2yXm5gcbOFl/eHh/UxKXnjitIJUQrXcU04YpZrTM5x1zU5xI+m+0SP qTORcfR3Nl4atwTqlmkCZMR1miDg6ZKOziJ5sK2KNHaz52c4yYdNBtNutl6/X3vsHJmk 9yPddygjs/WNlFI5/mhWVndE1Y8I0s1V41XpbCXmZNO2MaraxPMtJKjrP/SmQrVdrauy awnQ== X-Forwarded-Encrypted: i=1; AFNElJ+49t7GkkkgoIXB1Bh6hh/Jtdzk3uk1+Fwrl/HwysW8dC0Md9x+nMjK3702I/NL7MmoZCVeEV5qQcNDh1k=@vger.kernel.org X-Gm-Message-State: AOJu0Ywpc9qJ/Ihv4xukI9IMTTafGqI3kxsIUHZDqXkK0pyW2vcyvq/U reBX7Sh1x+07J9o9Ko50+EV75yxjdZGmztXcK+PmA37TDreLKOfntdvK X-Gm-Gg: Acq92OFDajyV7to23C3rf1+vvgR7aIJzpvlm7wZlDldKt5eUKtYobgEFdMf0iReOdRO beF31iKmvPFHxHeQg0soACMH9GDd3SPzxvV9phx9w2lrsJP0EGqXaPJMEXbvVZK9vPRtD2hm3kt lJ7zV2XZ2OOwR4Rm5EgomMvdMvkHdKwNiigeK0Nfb/MKvoJLXCZqvJ0WKnJVkxluRl+d7/GnPcF wNueFvr4oxbiML0eAJH3bj5T7mu0qEAuDflnFT2COYAIn5MOCAYyR+RlX830DgDA88su0sVItjI FC5yISF+dGdIJMtZH9y6Vi3UycLzDxW/ydfU5R9UJQq1mPKIrh3lxula65Oaq9YT0gWaQIPrerM 20MTDbr4mP8t5QwpoHHKaQp8H22vAtsQMxeVKgX1U8KYgJLZ3V/nJEimUxZRBw6OUXnyxmi22gC /crruNBV+Yj09yPnozEF/N2KCBIIVj0EiGdmfC X-Received: by 2002:a05:600c:8b23:b0:48f:d5b2:7c1a with SMTP id 5b1f17b1804b1-490425aa7a4mr388212385e9.13.1779872591739; Wed, 27 May 2026 02:03:11 -0700 (PDT) Received: from gmail.com ([62.197.47.167]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4907eae9898sm18436755e9.4.2026.05.27.02.03.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 May 2026 02:03:11 -0700 (PDT) Date: Wed, 27 May 2026 10:03:09 +0100 From: Breno Leitao To: Namhyung Kim Cc: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: Re: [PATCH v2] perf bench: add --write-size option to sched pipe Message-ID: References: <20260521-perf_bench_pipe-v2-1-720b6ff7f0fa@debian.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Tue, May 26, 2026 at 10:22:58PM +0000, Namhyung Kim wrote: > On Tue, May 26, 2026 at 06:55:33PM +0100, Breno Leitao wrote: > > hello Namhyung, > > > > On Mon, May 25, 2026 at 09:17:45PM +0000, Namhyung Kim wrote: > > > On Thu, May 21, 2026 at 09:15:37AM -0700, Breno Leitao wrote: > > > > + ret = write(td->pipe_write, td->buf, write_size); > > > > + BUG_ON(ret < 0 || (unsigned int)ret != write_size); > > > > ret = read_pipe(td); > > > > - BUG_ON(ret != sizeof(int)); > > > > + BUG_ON(ret < 0 || (unsigned int)ret != write_size); > > > > > > Is it possible to return smaller values than required due to signal or > > > something? > > > > I tested this on a VM with the patch applied, running the ping-pong with > > write_size from 4 B up to 1 MiB, including multi-process and single-CPU > > contention runs (millions of iterations). I observed zero short reads or short > > writes. > > > > Looking at fs/pipe.c, this matches the kernel behavior for this access pattern: > > the bench has a single writer per pipe and the pipe capacity is set to > > write_size, so the writer never has to sleep mid-write, and the kernel does a > > sync wake of the reader only after the full payload is queued. > > > > EINTR is also not reachable today because the bench installs no signal > > handlers and nothing in the call chain delivers signals to the workers > > > > At the same time, I understand the concern and If you'd still prefer defensive > > handling (short-return loop + EINTR retry) I can add it in v3 — happy to either > > way. > > Thanks for looking into it. I think it's better to go defensive for any > unexpected behavior or changes. Ack, I will respin it, then. Thanks for the suggestion, --breno