From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f179.google.com (mail-pl1-f179.google.com [209.85.214.179]) (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 05238286881 for ; Wed, 25 Mar 2026 22:05:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.179 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774476361; cv=none; b=YcSlsxiFw3DZ/9lZ2ozrltOsrfmzdd4A4vr2ZGF3P/25FsCh0Adzf8uxdNKQhX+Ms72Id+icBMUQ+/5tytmjogjVRiiUdB95rEq+OmBKgloXVmIZPjlkdEYC9zRMSSua8xEKEr5wZ8Suvesc5lgpJBKOdhsYl+w4Rch3YxqvbTY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774476361; c=relaxed/simple; bh=k2MgrILfP0435tZlmtLGcpjK9ms6FiT2X241dHroOYI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gg28arrHr5R8dw5E/CKw4O8WN53rht/k13XQQc0OnrP2YfVhrggYhlgCuF2BBKN7UOXM6jnmsQAZ7Hn4nLyLWaJY4fGvuCByoG1um02eVR568vuOjkpuFLQE62ET9O9IrfVxnQpULYXIQOcffHKBgxds/f03W9O532b1kkG+dvg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zabbo.net; spf=pass smtp.mailfrom=zabbo.net; dkim=pass (1024-bit key) header.d=zabbo.net header.i=@zabbo.net header.b=gQ1VJ3zi; arc=none smtp.client-ip=209.85.214.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=zabbo.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=zabbo.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=zabbo.net header.i=@zabbo.net header.b="gQ1VJ3zi" Received: by mail-pl1-f179.google.com with SMTP id d9443c01a7336-2aaf43014d0so2086455ad.2 for ; Wed, 25 Mar 2026 15:05:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zabbo.net; s=google; t=1774476359; x=1775081159; darn=lists.linux.dev; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=JYCj9CU0Q50dwl4JKd9FVJ6cKnK1pailuOK2+ihAxEg=; b=gQ1VJ3zioFCskH9iMstWSiP8bG1aNKIXqqThKTBt+9l8AjONwByN2e8P9ttgILkp6h L64Vn1tA8Y6arV4I6V9QoaSH9kcg/HtMHDMjWIwlLCKq0P5sdMcGrcllFz2G021xWMCG 84G/hTdP5lPYg1twijLKgDy+azhY1HDpv+7Ro= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774476359; x=1775081159; h=in-reply-to: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=JYCj9CU0Q50dwl4JKd9FVJ6cKnK1pailuOK2+ihAxEg=; b=lNhJ6wjdavDt6ga8wavpzLvYMzUPUvU4M5Ppa7sDXb3XFmhjlRUrI3ZiqjWc0NOPDa B9FlDX+OsO1y69cstSpOAiibtX7QAQNxhQLu7qzmYWPbdBbzQoFJju27Mj+ZiI80UdyY 1refVp09Dp6GmVWs87eyRFDCfCSVWHffLVY0Ymya1ZduYH4BT1+l8qzdUjcVgVUsxO/K MJOFl2+1kIuqvzog3OqeIAuhPCBMHawoQx+XfhQvku42AyixXhLKEn2QxrxPQRHwGX0W Qcu5q9DKNPUuDwfrCrMRqD7UGBVXQC3PXMEXLwmDLdIIg+EW6QH2QtRmErZaTpd0AtJ6 d+oQ== X-Gm-Message-State: AOJu0YzEXpgjGS5l3yfSm6JAgoOoDaTu5Qw39ObTsAZmEUsIU9450z5Z eL7mdtQSlKtXyLqhZjLlElGPXuuM9Y0p95OkZOAjCMVzQ+yKeyz1fUEvOI3XXQlLgJRPLCrvQ+q ZxS2E X-Gm-Gg: ATEYQzx1w0PpBepZe+D9Kh4T8aaCcJNpK6iYoP9QYmxMj8YQVaucRXRDkJbFolfjjJD Y5EofQo8jiUTkSgiRzYfc6oG+A7e31ffw/qkB8/0aC+3xr7K3oRvfteUSKQ+3qXYV5p+/ysJoXq lMZ5cyXDNp1HB+h/l3H4/PJxLNjzIaPrzGlw8Z/c1AgN4TfabLarwe1/8soD15K0qWT1htJ61iE scqC4jEysxy3tSFiXwdR1feX79wAiFtXNl3w5pItuM0957ilWV+OcoDeEJlBrWtx30jU421CiZK 7T3q1udmpr03ThPLmp2oLMb3T3mHsLecsfd4SgCerAZ3salOSwyDjw6/o5viP+8V/RNSi2EuSlK ZQ3tUOS8iwapG4zqrbFezAEg0+stw9q36CKBgjjTmqmvMzQ/9chu6oAJcgBDAdzUjPfydlsUcts i+xmz2k3C4cQ== X-Received: by 2002:a17:903:fa5:b0:2b0:6a22:5165 with SMTP id d9443c01a7336-2b0b09c1b1bmr53037415ad.7.1774476359225; Wed, 25 Mar 2026 15:05:59 -0700 (PDT) Received: from localhost ([50.39.133.72]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2b0bc90d2cdsm9735005ad.75.2026.03.25.15.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Mar 2026 15:05:58 -0700 (PDT) Date: Wed, 25 Mar 2026 15:05:58 -0700 From: Zach Brown To: Valerie Aurora Cc: rpdfs-devel@lists.linux.dev Subject: Re: [PATCH 1/3] rpdfs: Use write_seqlock_bh() for balloc info Message-ID: <20260325220558.GD990991@localhost.localdomain> References: <20260319093727.15343-1-val@versity.com> <20260319093727.15343-2-val@versity.com> Precedence: bulk X-Mailing-List: rpdfs-devel@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20260319093727.15343-2-val@versity.com> On Thu, Mar 19, 2026 at 10:37:25AM +0100, Valerie Aurora wrote: > The balloc info seqlock is taken from bh context due to > rpdfs_balloc_publish_region() being called from an RCU callback, so it > needs to use write_seqlock_bh() instead of write_seqlock(). Found via > lockdep. I'll admit, I was being a bit lazy and not running with debug kernels as consistently as I should :). I'll work on that. > @@ -192,12 +192,12 @@ struct rpdfs_balloc_region *rpdfs_balloc_take_region(struct rpdfs_fs_info *rfi) > while_read_seqretry(&balinf->seqlock) > empty = list_empty(&balinf->region_list); > if (!empty) { > - write_seqlock(&balinf->seqlock); > + write_seqlock_bh(&balinf->seqlock); But let's do this another way. Let's not punish all the users of the region for the single weirdly implemented publish. While the builder is protected by RCU, the region isn't. It was just bad reasoning to think that we needed to publish from call_rcu. We only need to free the builder there. For publishing, first we can move the use of the region up above the decrements of in_flight. Then we save the result of the last in_flight decrement for each case (initial trying to send, other responses arriving). Whoever won and got in_flight down to 0 can take exclusive ownership of the region and publish it. (The spin_unlock _release semantics ensures that everyone's done with the region by the time they start meessing with in_flight). I'll that assume you want to take a swing at this but let me know if you'd rather I clean up the mess I made. - z