Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp1256290lqp; Sun, 14 Apr 2024 23:58:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX+wfpTu75ndBRbq6aMzp72TSBr+uadCL44qKMjKt9KKniyt3as6RIx/yF1eaHJklCYpC3GLmE/rJ1inh6H4qdQfhTZQ9hVjOfP8bw6dA== X-Google-Smtp-Source: AGHT+IGSVJnga+Qobnm0np/EPpw9D5QGbPspmHZ4gOKR+vkjShRS6+HZRQffzbWEepva2e0YFIlv X-Received: by 2002:a05:6870:a449:b0:22e:9a3a:14c3 with SMTP id n9-20020a056870a44900b0022e9a3a14c3mr11478327oal.17.1713164303415; Sun, 14 Apr 2024 23:58:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713164303; cv=pass; d=google.com; s=arc-20160816; b=Kan2+XTJqe5MaJ7L7A/vmMTpEXIeImY9Kg8/+vlNzzxsBwxn0/1m+6MrWLt75/q96B ysZ7nubPtnJJALvRsTT7lglXFEuxMgBJuRXIAtAHApdpH4xMS4v6eXoFN1yb1zNTcJ2V PWoppxyK56BmgsBiRgENwtAwcADxo0fAjn6fJCI0zhgLUxxc3U1WcAsuBGvtxFFSj9a1 qXQYzLCQD/QfzUk0N+jp6deVuE8R+I5zQHy/yhxAxlQuI1UQ1IQX3gXs/4FFfMO39K0x OhfWzVo3H3JtZY6/GuewxCL45hV8O9tpUIswX1mCxSC5bPEzk5lfgv8Dk6kv8sLgW0NZ d+Tg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:user-agent:message-id:in-reply-to :date:references:organization:subject:cc:to:from:dkim-signature; bh=ptLbaXHFz1SjMcJUxVZ1MKPDLiUChee6AAW1Ax7maBk=; fh=F8f6GGkrwGBjIH7s/uccbAsiyRZXzkSqnYf0RTWvfa4=; b=iL6CXody6cmJxohr2ATcg2H+4nr2XxOGdMilzW35QhcUmTgxMFOuIXYbLtpn3WCVe+ 48K4hXou9FiZLCc0utgm6OLxd3UjSE2UWhzNeqlE9U9+f/K6bJpd5JBO7ktNCjL/uCDO e93AbZ5G9zZLBUah0yGGZqdVLCnRU6nmt8L2SjAMrdMHodLObmO+EqRRYGTO1Mr5x/t0 JLldlo12WhOab+fR55GhPjhuguIqlQAHSs0lHHlnt+ymuI+qoc9GLGq70fFoDmunSEid T09PlrunqcvAJkk7FNv47LDwIYxm+O0ouR977fpg4AGK8gWJiVqLgGwWAecLth5UGfSB K75w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@mork.no header.s=b header.b=JQknEPZT; arc=pass (i=1 spf=pass spfdomain=miraculix.mork.no dkim=pass dkdomain=mork.no dmarc=pass fromdomain=mork.no); spf=pass (google.com: domain of linux-kernel+bounces-144626-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144626-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mork.no Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id j22-20020a63fc16000000b005d4fdff9a2csi7152473pgi.328.2024.04.14.23.58.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 23:58:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144626-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@mork.no header.s=b header.b=JQknEPZT; arc=pass (i=1 spf=pass spfdomain=miraculix.mork.no dkim=pass dkdomain=mork.no dmarc=pass fromdomain=mork.no); spf=pass (google.com: domain of linux-kernel+bounces-144626-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144626-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mork.no Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 15A7C283D78 for ; Mon, 15 Apr 2024 06:58:23 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A7909208A4; Mon, 15 Apr 2024 06:58:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=mork.no header.i=@mork.no header.b="JQknEPZT" Received: from dilbert.mork.no (dilbert.mork.no [65.108.154.246]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 45D8E1EB5E; Mon, 15 Apr 2024 06:58:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=65.108.154.246 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713164293; cv=none; b=K3dCU8LaIDgWHf6M9sIHWYi4EHMmFK/smduol/wDDyncY/G2KGWYTU3ebD3DxtDb/+Lp5TBODqDY4197t79djYxOgpmb9ce0Qg3rwE/F7zbeLXGoLVEFsyBSVLIcA1o8/cUNjb5ArWnsU7vJciPhT1P1M/toGzdsU4/TX4ZinyM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713164293; c=relaxed/simple; bh=5dQYE555WyWLOIGjnlUIwdBPsURAhH1u3CUIqS7Bd6I=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=rOneibs6YXWWZ4y354xHIn3It2FW49vtmnDk8wB/RnX2zgg0w4AWSaVpW6VHEKyxeLFx3S4niRnQ2eXX0/teYXFoEW1k64MCxbgQlzQ1vgP9VOMBqsVSoy8fKXfX5l8TLEsPbJKwTRpdh7OaOoAHGq8we2yNyWDyoLt03NRpqPQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mork.no; spf=pass smtp.mailfrom=miraculix.mork.no; dkim=pass (1024-bit key) header.d=mork.no header.i=@mork.no header.b=JQknEPZT; arc=none smtp.client-ip=65.108.154.246 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mork.no Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=miraculix.mork.no Received: from canardo.dyn.mork.no ([IPv6:2a01:799:10da:6900:0:0:0:1]) (authenticated bits=0) by dilbert.mork.no (8.17.1.9/8.17.1.9) with ESMTPSA id 43F6lJGr265481 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Mon, 15 Apr 2024 07:47:21 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mork.no; s=b; t=1713163639; bh=ptLbaXHFz1SjMcJUxVZ1MKPDLiUChee6AAW1Ax7maBk=; h=From:To:Cc:Subject:References:Date:Message-ID:From; b=JQknEPZTeGKCD2KEeFUG9yDA2PEETWkDp9Ntu7+q6E1u0TzswuRdN3XgTIhipVnA6 QW2Ld+vLwa/dFtImLTm4CN4QB8mucwg/Yt6d4Yc9vf5HVbwpxqHAEiNWrlLNVIdt6e a9quzffcyP60fDXlYkxUBpD/36Hfg0+7jTsjU6LA= Received: from miraculix.mork.no ([IPv6:2a01:799:10da:690a:d43d:737:5289:b66f]) (authenticated bits=0) by canardo.dyn.mork.no (8.17.1.9/8.17.1.9) with ESMTPSA id 43F6lJwZ367339 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=OK); Mon, 15 Apr 2024 08:47:19 +0200 Received: (nullmailer pid 17569 invoked by uid 1000); Mon, 15 Apr 2024 06:47:19 -0000 From: =?utf-8?Q?Bj=C3=B8rn_Mork?= To: Aleksander Morgado Cc: oneukum@suse.com, linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, linux@roeck-us.net, linux-kernel@vger.kernel.org, ejcaruso@chromium.org Subject: Re: [PATCH] usb: cdc-wdm: close race between read and workqueue Organization: m References: <385a3519-b45d-48c5-a6fd-a3fdb6bec92f@chromium.org> Date: Mon, 15 Apr 2024 08:47:19 +0200 In-Reply-To: <385a3519-b45d-48c5-a6fd-a3fdb6bec92f@chromium.org> (Aleksander Morgado's message of "Mon, 15 Apr 2024 05:42:06 +0000") Message-ID: <87mspvi0lk.fsf@miraculix.mork.no> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) 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-Transfer-Encoding: quoted-printable X-Virus-Scanned: clamav-milter 1.0.3 at canardo X-Virus-Status: Clean Aleksander Morgado writes: > On 3/14/24 11:50, Oliver Neukum wrote: >> wdm_read() cannot race with itself. However, in >> service_outstanding_interrupt() it can race with the >> workqueue, which can be triggered by error handling. >> Hence we need to make sure that the WDM_RESPONDING >> flag is not just only set but tested. >> Fixes: afba937e540c9 ("USB: CDC WDM driver") >> Signed-off-by: Oliver Neukum > > We are not aware of all the details involved in this patch, but we had > to revert it in all the different ChromeOS kernel versions where we > had it cherry-picked, because it broke the MBIM communication with the > Intel XMM based Fibocomm L850 modem. Other modems shipped in > Chromebooks like the QC based Fibocomm FM101 don't seem to be > affected. > > Attached is an example output of mbimcli talking directly to the > cdc-wdm port (i.e. without ModemManager or the mbim-proxy). In the > example, we are receiving a bunch of different messages from previous > mbimcli runs. Looking at the timestamps, it looks as if we only > receive a message right after we have sent one, e.g. after each "open > request" we end up receiving responses for requests sent in earlier > runs; or something along those lines. > > Is this bad behavior of this specific modem chipset, and if so, how > can we workaround it? If you need any additional information or help > to test new patches, let us know. I'm not sure I understand what problem that patch is supposed to fix. Which means that everything I write could be completely wrong... But to me it looks like the described issue is exactly what you should expect if that change ever triggers. I believe we must resubmit the urb from service_outstanding_interrupt(). That's why it was added. See the explanation Robert wrote when introducing it: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/d= rivers/usb/class/cdc-wdm.c?id=3Dc1da59dad0ebd3f9bd238f3fff82b1f7ffda7829 As for the XMM behaviour: it's been a long time since I tried any of those, but AFAIR one the major differences compared to Qualcomm was the strict queue handling in the firmware. This caused a number of problems where the cdc-wdm driver wanted to skip a message for some reason. So I'm not surprised that a bug like this is triggered by one of those modems. That's probably the only thing they are good for :-) Bj=C3=B8rn