From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com [209.85.210.42]) (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 AE42E328274 for ; Fri, 5 Dec 2025 13:06:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764939970; cv=none; b=SQXl9SHwEoi+0AKpUsR0aC5WHEz01K8Pu3+PR0x+pyReDvw1xEhVjOemlSMTFhmqO5oSqqgwaBbQ8LN8YuO16792vLnqPjlAcPUCiXCydO9gL6fG2RZGJ3GLZKS4FaKlN69ypbXlHLIc+Oi9fwQqGVkyDLphTiNIfny7ovwbqDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764939970; c=relaxed/simple; bh=YgXxzLapXsS5eaMcsIpcx785UqqObFyCeA4Y0Dg4SAE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ibcy77R7IbrgOAlpoQp8zsIsLHvYI/wnyNqEhzTTZVAmWp2NsZg9+cQB9Q0gP5qlsdkWuDBytORAv5l0VQ5IJdazTGYUbt3CEKK+HcDvSMZUCFQUTxvzbKcDAEsVq51AGp8YPOzCijwK8GVGam1cfrRisiJcmKO33AnY0N4jBLU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=minyard.net; spf=pass smtp.mailfrom=minyard.net; dkim=pass (2048-bit key) header.d=minyard.net header.i=@minyard.net header.b=d0n3pBad; arc=none smtp.client-ip=209.85.210.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=minyard.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=minyard.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=minyard.net header.i=@minyard.net header.b="d0n3pBad" Received: by mail-ot1-f42.google.com with SMTP id 46e09a7af769-7c75178c05fso793021a34.0 for ; Fri, 05 Dec 2025 05:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=minyard.net; s=google; t=1764939963; x=1765544763; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :from:to:cc:subject:date:message-id:reply-to; bh=S9q1yZtwfm+ZOhcj2eq0aKq0UR8C6kAmN4VfmHVSZnQ=; b=d0n3pBaddkHXcYPqUyFxnGDdteRdIXO4PsB34miabodrqt6lQBVLgiDgco21BRke0d UQ3GRwkudBCJG5lDdgcQOIOoA6Yx+xMixNa1ujaY8bIjKtQV1NWrEJNvCbCWyd1TGmiJ B9H24dY06s802r1Cyswo42Nj+r+9DgZCiWL93ruwyQnCQ/GPL7YV3htVM4sDIhGlB26B kSnec/JhshRndy8gGP8xCcNjBBGFTb9MdCrpSIldL8wIHVuaoG9LHxXyGYFmFqJ03RFC YTN06QiNs9pu6CRqLv+Qav7Bs+2YNRWSWdOAK5xPZ3weIA9A5qbFuElAJZD8Dn+hwtzn UqOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764939963; x=1765544763; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:reply-to:message-id:subject:cc:to:from:date :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=S9q1yZtwfm+ZOhcj2eq0aKq0UR8C6kAmN4VfmHVSZnQ=; b=KT0kieLg3Tcu2pPUg37jZAegykagdDSA50tHW80TCxoBdqyiztU8euNqK8aT0Nhjza N9X/x9rS74P6l+rlagf1Z0I2Sh5kcZy5V35pn2hsEW240bpelr42/dB07nUHYvCml7Ff irtwGQwWzuUDvwdmduRD/GMHv+kVwMd+fkCBVesbS/wrOZpUtbuDyEZxSrP/LJ/VX9Yi zyHKSOpPK5BuiNiBVnyumfQVfaGC5YJXIRM9vM1Tzes5h876XeEcvlW2t9z3jh63212q OYetJZ3ypkmED0blYPbMM8ji6JKvPZIGvuGm39GXqc7WimRDaNIMZcYcn4rGMLF7srSJ gF0A== X-Gm-Message-State: AOJu0Yywe2oy6WHGYVI2JME/gk2Dy4mAgq/WGZInZPJEDEvCVeEItyVi qQ8dl5VpBGLbM0Dq/lMuBoK2MGeTq6aD8Eo/5flPihKspGZB8BqKr07c8q6b/rvaVLc= X-Gm-Gg: ASbGnctHKabk8rVRb0KdFpoPO68YpkFMgyFwVztiBMHivGq7ieRm1BqPAgt1NB0jtBG C8odOsgkYJhIUDPX/SHLMB8FCjPnJEeyO2lJ9Z5hlqnQz0lAGVat5dZdvGs/C6KR82nhCEg8Yvb OrOqQJG6Kv62zfJK8xy5JIVFhFeb8zRTVFth9rbLi7KvBNYCtjhdNm53oaWqB5oMUC2p8wHYpTm NcYCPafYlmfxyo7u7GRVnskbSBFyGaDSftxb47FT+y4nIvLnGbFTUCgSNVVqiNBWnGuSlMhmc19 v5vY/wvZFQkRZ0x7GyEjKximUMdoucUabSp+Nz+gYP3MN/uysM3SDHM85F71oRj4qp2ri2K02I7 tHHdx1QzU6ICCA+B6eYWUkDe9cV44+ybpRFckoEfLfL3tTmbgjWCPgBb/ayuxTwMaC/JoQja+d7 K6mKs0Hul6teUvSw== X-Google-Smtp-Source: AGHT+IGrbICiVh6IVwh0bDlEo5fxbdCJTapkpOGEDfVvzF1xCya7uzy0YGarYIvOIhdAy6ypysSdLg== X-Received: by 2002:a05:6830:2b0f:b0:7c7:6479:38cf with SMTP id 46e09a7af769-7c94db5741emr5517513a34.26.1764939963135; Fri, 05 Dec 2025 05:06:03 -0800 (PST) Received: from mail.minyard.net ([2001:470:b8f6:1b:28e7:17ef:849f:8533]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-7c95acd567dsm3807022a34.25.2025.12.05.05.06.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Dec 2025 05:06:02 -0800 (PST) Date: Fri, 5 Dec 2025 07:05:56 -0600 From: Corey Minyard To: Jinhui Guo Cc: linux-kernel@vger.kernel.org, openipmi-developer@lists.sourceforge.net Subject: Re: [PATCH v2 0/3] ipmi: Close the race between __scan_channels() and deliver_response() Message-ID: Reply-To: corey@minyard.net References: <20251205080102.1039-1-guojinhui.liam@bytedance.com> 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: <20251205080102.1039-1-guojinhui.liam@bytedance.com> On Fri, Dec 05, 2025 at 04:01:02PM +0800, Jinhui Guo wrote: > On Fri, Oct 3, 2025 at 10:43:16AM -0500, Corey Minyard wrote: > > On Tue, Sep 30, 2025 at 03:42:36PM +0800, Jinhui Guo wrote: > > > The command "ipmi -b -t" would occasionally fail: > > > #ipmitool -b 6 -t 0x2c raw 0x6 0x01 > > > Unable to send command: Invalid argument > > > Unable to send RAW command (channel=0x6 netfn=0x6 lun=0x0 cmd=0x1) > > > > > > The race window between __scan_channels() and deliver_response() causes > > > the parameters of some channels to be set to 0. > > > > > > Fix the race between __scan_channels() and deliver_response() with the > > > following changes. > > > > > > 1. Only assign intf->channel_list = intf->wchannels and set > > > intf->channels_ready = true in channel_handler() after all channels_ready > > > have been successfully scanned or after failing to send the IPMI > > > request. > > > 2. channel_handler() sets intf->channels_ready to true but no one clears > > > it, preventing __scan_channels() from rescanning channels. When the BMC > > > firmware changes a rescan is required. Allow it by clearing the flag > > > before starting a new scan. > > > 3. Channels remain static unless the BMC firmware changes. Skip channel > > > rescan when no BMC firmware update has occurred. > > > > > > > > > v1: https://lore.kernel.org/all/20250929081602.1901-1-guojinhui.liam@bytedance.com/ > > > > > > Changelog in v1 -> v2 (suggested by corey): > > > - Split the fix into three independent patches, each addressing a > > > separate issue. > > > - Clear intf->channels_ready only when the BMC firmware changes. > > > > > > Jinhui Guo (3): > > > ipmi: Fix the race between __scan_channels() and deliver_response() > > > ipmi: Fix __scan_channels() failing to rescan channels > > > ipmi: Skip channel scan if channels are already marked ready > > > I have these queued for 6.18. I need to re-review them; that will > > probably happen later in the cycle; I can't put them in until 6.17-rc1 > > releases. > > > Thanks, > > > -corey > > Hi, corey > > Friendly ping — please let me know if you need anything else (rebase, more review, > test results) and I’ll be happy to take care of it. > > Thanks for your time, and sorry for the noise. No, it was a good reminder for me, I needed to handle this. It's been sent to Linus. Thanks, -corey > > Best regards, > Jinhui > > > > > > > drivers/char/ipmi/ipmi_msghandler.c | 24 +++++++++++++++++------- > > > 1 file changed, 17 insertions(+), 7 deletions(-) > > > > > > -- > > > 2.20.1 > > >