Received: by 2002:a05:7412:3784:b0:e2:908c:2ebd with SMTP id jk4csp2584039rdb; Wed, 4 Oct 2023 05:57:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFt+n98d8de5Dm99hlBs3BI+nzscM0tap7XtW/r2/b9jAYypK2wz46vnP/LK4EQ/ApSD/oz X-Received: by 2002:a05:6808:2918:b0:3a7:6d64:aa68 with SMTP id ev24-20020a056808291800b003a76d64aa68mr2060648oib.18.1696424248638; Wed, 04 Oct 2023 05:57:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696424248; cv=none; d=google.com; s=arc-20160816; b=pGR/pB8JXcXssp9FZ3fjvAxV16e9FlQwql2xAElkKtnPwlsaWIWUcoUp7v3ykEpWA/ 8k9TG68WccDgyF07Ci+xtkN/ck4lx5QaRXhvKghdTS2sggIYHAWGZpr4m6b3Bdeccwsq UIufJ0x7Qbv1x40hmN2TD+9FlsgpUd6Gg09NrAAI+GlOys4ZF5Ysx5wtQm/v0q2gpb9W xNcZKpoDSxXK2e+CGuMu5ZsfH2LsBtZc6QvlnI/G8GT9QkuxxwvDG9nzFzFbLyDlg6Y5 t/oJIJL/HAxIt/2SrpCoh5/XXM/jTfaZk6BKz7j9FyV13xvgidgFt1RLVXzJ0FnaAE3D cq9g== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/GteGlf1H9fIDA72ux8PzBgQfx0NtmAW8b8hrO1wSuY=; fh=ATEBROlmvrvvHzOo8FfIW33AQuJxtrwlNS07ZQfwZYk=; b=aLb/VGUpHk5rYZ4h6Cjtr3Q9jwmYf2Rum+wf9+2imKnFbbRr0TIhv4pTqmGyj9S+9c 8eAXpYg/Yq0vGdBQ2MTlKlExy6TOUfV7Xz2uaZVVQCOcsy24t/MX0iC+u/dtjAzfX33e wIx9Kh7Wc24XKpQ8pq1kmNTqWjziBxvJlWj3YY3EvtVzajpb6ceSeK1Tay2jc7P4rW+o V3WcCcLw00/EfUkCXnddMdA1QfOl0L/HmKZ3vjEHo31XyRYLqbLwXkz0rGTzej/ay006 ykDjQYFVygzMan5TUZWBUZsJu9IKCrGtoIED5caTBOA61rO7cZ4JlAMW3H/dRlimwrny PXfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uzbko4RD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id l71-20020a63884a000000b0056c55eb251csi3454132pgd.123.2023.10.04.05.57.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 Oct 2023 05:57:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uzbko4RD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 44DE482663E4; Wed, 4 Oct 2023 05:57:24 -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 S242493AbjJDM5N (ORCPT + 99 others); Wed, 4 Oct 2023 08:57:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233146AbjJDM5N (ORCPT ); Wed, 4 Oct 2023 08:57:13 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB993A6; Wed, 4 Oct 2023 05:57:09 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C002DC433C8; Wed, 4 Oct 2023 12:57:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1696424229; bh=c0B8rcdyLaJqRDe54RZrNhWFmOTGkuIhTF5iHLVhyvU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Uzbko4RDR2v6YIAOqSeaq0KR6qZ+8S52iFfEwWok3OTjWQ6uNBwZxbj5/LvRZXkxy ORPrlcdE0BM2K19AVebvVu0xifaGhdaNChJ7Zi0dhUT+y7vVdUFpDa5jMBmtocYDIO SA3UvjmZO0dvrD2TIlJp1p138HHvsGMaaCsoWHe06BnEW0aOZEGbbNZ5TpV3Ts1omv I9zYQUrS6lvLl2DI0TQz/1kp3NyMolbNq7eFObh+HV0UpTjD09Y4MSQai4JC8WwkNE fdBwsShVLgJMj/SnjxkPd9OR9HqNtxhlTWJqkglfJAfhGjPdWajLu7GkPpRQ4Kr2Mm IMNR3MCYQj2mQ== Date: Wed, 4 Oct 2023 13:57:04 +0100 From: Lee Jones To: Greg Kroah-Hartman 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: <20231004125704.GA83257@google.com> References: <20231003170020.830242-1-lee@kernel.org> <2023100320-immorally-outboard-573a@gregkh> <2023100421-negotiate-stammer-1b35@gregkh> <20231004085720.GA9374@google.com> <2023100448-cotton-safehouse-aca2@gregkh> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <2023100448-cotton-safehouse-aca2@gregkh> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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:57:24 -0700 (PDT) On Wed, 04 Oct 2023, Greg Kroah-Hartman wrote: > 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). Does this solution break the recursion loop or affect performance? The last suggestion was recently made (after mine was posted). -- Lee Jones [李琼斯]