Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2564894rdb; Wed, 4 Oct 2023 05:21:49 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyHxs3mnOPgc6qkzCfH1SqMK+/7EG9CAx1p0JUKg4SuTVjSgp3vlnA6naJ9GmeCbcibmLi X-Received: by 2002:a17:902:dac9:b0:1c7:5f18:d125 with SMTP id q9-20020a170902dac900b001c75f18d125mr2474552plx.27.1696422109677; Wed, 04 Oct 2023 05:21:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696422109; cv=none; d=google.com; s=arc-20160816; b=i1elTtuPWBaCTnakuSq74pkr5obYaY1vd+GiNF+IHxJD9xu67Armt0kD87pjefoRsd qpZe/VQ9SIEPH5kEP+Md25Uz7G2M5+DBvNFvDiWKYOVbAkUCmX8BX0w2TKAiiQUIx2e/ EOH1sDsV/AC82xXtzdQABLiR8RWrg5h7YgG6T+pdg5sXUABTTy5bal8Q+ePRD4iLgr0Q Hx7rtrLeaxwqRtUNF812DBllFQhh6+X1ez7Z5WztV62LH2Ab6cDAS+yjaCx3A9BXvKNa Pf0FQjLU2w+VQ1oqKm3E6AiXnJQqjjQPZpkVnLCMdm/m7lQkHgv5ttx0igkqjW395WDG WiTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=fXZlNG4rpJqzY7gwK5dCCWhC2wqDTdoqq+9sv9VnrHg=; fh=lQmlxQesYx27L+Ts6LV368ZO09XA9ThroYyk67zO4TA=; b=YBr6JOSQNAUKleG5WgRELehT+0BjM9w/GZff05rYP97saSaqdVwaF0nYxjaPKh1K+q NwHFyjkqFNzNsTK8ZVjGEOP0DENETFOxNgefOq1/lQHDLrnSxbOwjno3ROincCYhju+A jXs6yHDCyTv/YHkdPkRg8qmj+lreosGOC1qBy34w/AfBfkhm1Uwbnt4sURo58qC8vrHz /FbjAui60KtPTex48cEBuQqgCSU4H1wMZfEIXa+GveVYLhYbYGnAZaJ9C2GywT8tIgkR 5YzjYGRyGHgxYLYKxH23wZR8gCqmVufjubqy5Q/UdjR1fYGrUC+X0fdEk6VZJkQIv5tl 2ZQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XxoZ4m3m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id kx14-20020a170902f94e00b001c43cd8b2d5si3454415plb.592.2023.10.04.05.21.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 05:21:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XxoZ4m3m; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 272558066979; Wed, 4 Oct 2023 05:21:47 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242342AbjJDMVe (ORCPT + 99 others); Wed, 4 Oct 2023 08:21:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242325AbjJDMVa (ORCPT ); Wed, 4 Oct 2023 08:21:30 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58D06A1; Wed, 4 Oct 2023 05:21:27 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7771CC433C8; Wed, 4 Oct 2023 12:21:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1696422087; bh=11CQYpSKM2pcMi8aU4IMUllyrD6lDC+S1Hae75gjfpI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=XxoZ4m3mh2BmBsFJKRt+wvKo4rBlcxmwegmfsWWNd47SfMKaPV8WW1quCEcf5+xxF Xa03pTzsHTPleppIb/ES0v2Bv6wU/Z0ywLB3KcyIaM1UkDOsVRHGFqipguwvL/L4kw N5dZ1Ne3tf4uBtIWRETe89yL3tbcS3s6Bg6OamD4= Date: Wed, 4 Oct 2023 14:21:24 +0200 From: Greg Kroah-Hartman To: Lee Jones Cc: "Starke, Daniel" , "linux-kernel@vger.kernel.org" , Fedor Pchelkin , Jiri Slaby , "linux-serial@vger.kernel.org" , "syzbot+5f47a8cea6a12b77a876@syzkaller.appspotmail.com" Subject: Re: [PATCH 1/1] tty: n_gsm: Avoid sleeping during .write() whilst atomic Message-ID: <2023100448-cotton-safehouse-aca2@gregkh> References: <20231003170020.830242-1-lee@kernel.org> <2023100320-immorally-outboard-573a@gregkh> <2023100421-negotiate-stammer-1b35@gregkh> <20231004085720.GA9374@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231004085720.GA9374@google.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Wed, 04 Oct 2023 05:21:47 -0700 (PDT) On Wed, Oct 04, 2023 at 09:57:20AM +0100, Lee Jones wrote: > On Wed, 04 Oct 2023, Greg Kroah-Hartman wrote: > > > On Wed, Oct 04, 2023 at 05:59:09AM +0000, Starke, Daniel wrote: > > > > Daniel, any thoughts? > > > > > > Our application of this protocol is only with specific modems to enable > > > circuit switched operation (handling calls, selecting/querying networks, > > > etc.) while doing packet switched communication (i.e. IP traffic over PPP). > > > The protocol was developed for such use cases. > > > > > > Regarding the issue itself: > > > There was already an attempt to fix all this by switching from spinlocks to > > > mutexes resulting in ~20% performance loss. However, the patch was reverted > > > as it did not handle the T1 timer leading into sleep during atomic within > > > gsm_dlci_t1() on every mutex lock there. > > That's correct. When I initially saw this report, my initial thought > was to replace the spinlocks with mutexts, but having read the previous > accepted attempt and it's subsequent reversion I started to think of > other ways to solve this issue. This solution, unlike the last, does > not involve adding sleep inducing locks into atomic contexts, nor > should it negatively affect performance. > > > > There was also a suggestion to fix this in do_con_write() as > > > tty_operations::write() appears to be documented as "not allowed to sleep". > > > The patch for this was rejected. It did not fix the issue within n_gsm. > > > > > > Link: https://lore.kernel.org/all/20221203215518.8150-1-pchelkin@ispras.ru/ > > > Link: https://lore.kernel.org/all/20221212023530.2498025-1-zengheng4@huawei.com/ > > > Link: https://lore.kernel.org/all/5a994a13-d1f2-87a8-09e4-a877e65ed166@kernel.org/ > > > > Ok, I thought I remembered this, I'll just drop this patch from my > > review queue and wait for a better solution if it ever comes up as this > > isn't a real issue that people are seeing on actual systems, but just a > > syzbot report. > > What does the "better solution" look like? One that actually fixes the root problem here (i.e. does not break the recursion loop, or cause a performance decrease for normal users, or prevent this from being bound to the console). thanks, greg k-h