Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp11679132pxu; Thu, 31 Dec 2020 17:40:31 -0800 (PST) X-Google-Smtp-Source: ABdhPJzCkQqEgfzWIEIas6jEUmoeLCq+M4r6r05HzPp5y8nUN8NtVmpcTkZ8PbVTjlODXP3Yq4K/ X-Received: by 2002:a50:e848:: with SMTP id k8mr57220841edn.77.1609465231304; Thu, 31 Dec 2020 17:40:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609465231; cv=none; d=google.com; s=arc-20160816; b=VpCJODRGWGbkzARJwAD3vfS7eVj6O4XFegVOg8M9VXhtOqydUxzP7Sve9KX1LY/zaV +rxiDSsyqahCCZRVNaBFbCvxfrXIniehfMQko2c/v9xyUpWCBUronNhjFSfRcg3zAQOy 7c778j7lNnL5L9qMeElQNR0JXdCu4QCNcClBn6rihAp9D9OvlWaEM9AWUXOQVN0zZSZk YymU34Bu4HMaEy5Fw8AG3oFFf3SKvo33dSLGc79I6ohEI2S34Lqq1zY6tkXgB+PTyYi4 KsCMxUaXaieHIvhyTnVmw8aaFcqDg8HI/3RjJqNVkC9Ym33Jnx0zNdnStsI5gpifcPo9 Lh5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jq908JEA6FJmQvAL4fJ2h5ZQ8LT4JDgfWpaEXTfjrgk=; b=NVTAu7onb+Ua/Qdal3FPKnLxQNO/R8WE/zVADVqWMsSXv5D4Aa4ZLqtwc7uQfBizwT oCO965fYxf9oF3tAy3HZLDYAgfFzf9E1eAyEbVgAqGWuSna6fR4Z8BcxL14wDVaZdDTS o7irLPXCdXw9Kp75sgi4zXW2tXMTc3apjFQRT12Amv6BTPLNgKE1iHP+GDxGG+/ZyDEh WPSMKv5fRDMXze8VistGJskO4IVamBGrnk9dcDoHq6S46jpbZW2nI7kZ//1DHsGG8gVx skCnbBTIio8JCUHIBTca/J2679yUTmYJgwPS3YRIVVCOe9idtyWmQ9/ioauN8DKsxUOD 7XMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ILwlOgDb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d1si25913433edy.296.2020.12.31.17.40.07; Thu, 31 Dec 2020 17:40:31 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ILwlOgDb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726745AbhAABjH (ORCPT + 99 others); Thu, 31 Dec 2020 20:39:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726044AbhAABjH (ORCPT ); Thu, 31 Dec 2020 20:39:07 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE0AAC061575; Thu, 31 Dec 2020 17:38:26 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id lb18so5595575pjb.5; Thu, 31 Dec 2020 17:38:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=jq908JEA6FJmQvAL4fJ2h5ZQ8LT4JDgfWpaEXTfjrgk=; b=ILwlOgDbm1Ty8COhZrZF2/yLoEQSlNnphDtiHd1SKlImeKPzDXWUopeSADfhznPgUQ 8zvbUKtoUGSuZ03T4sKszsUWeNSSk36E2YSNU7XjpJ8S7cRfYadecw4grpXecM4gCloR YQPq/j7KkhbYU+hhLq+S22LAQQM2aMsiNQk4H76QqFEoL991HLb0mrygUKxZUG/LYZeI BXrhPUjd4x5RmZybcONpqJ8/4WUA1BfJli3I2cPkf3foLlAHhxvZmGtwEuWmUih5uLQT IhUjUtE5VEYXDYvHETdhxFfsHo7P80qM/qBnT4ghxQqcKTPYUvkqrmSYVnrr+gDEAwum p4Rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=jq908JEA6FJmQvAL4fJ2h5ZQ8LT4JDgfWpaEXTfjrgk=; b=o9Hin34Wvb+jzJ+ipFnlo16JGti3zh+ySATWJvuZg0G5HWNOoBonbZdhhugolM4Eo0 2YKlzRDQoaJQXIPrsgrmFEwNPCp+qhtB1M/lua9IcI2hSJeqQdut7I1ALlLqkW/9wWPi Y06pjNjVLYboc8a/zk0rlqen5mowqrPeHI7+NYywUdYxihPsB/DgfZtwzY6g0A9e1wh4 o1I5KiXqZQ+VnDlAk8RSTRmCxxHBmcq2mlDb57Zq6X6YA85dBC47tE5mqPemXllKP61C APt+PtAL5IIgFDjiG1C4gg7Kalwe8sVOpgzHJ6647ZWDq27Cu0sIlwAFE01k30+rBdwQ o7MA== X-Gm-Message-State: AOAM531wpd62v5BV/OWTNWwcGqEDKViC4blXmZXNVH+NXwqR0TIwd3Oj fWBQwSkXPbfRmokfms9HN2s= X-Received: by 2002:a17:90a:470b:: with SMTP id h11mr15438318pjg.186.1609465106406; Thu, 31 Dec 2020 17:38:26 -0800 (PST) Received: from shane-XPS-13-9380.hsd1.ca.comcast.net ([2601:646:8800:1c00:d2c3:2203:46f1:3e3e]) by smtp.gmail.com with ESMTPSA id z11sm11836055pjn.5.2020.12.31.17.38.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Dec 2020 17:38:25 -0800 (PST) From: Xie He To: Gao Yan Cc: paulus@samba.org, davem@davemloft.net, kuba@kernel.org, linux-ppp@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] net: remove disc_data_lock in ppp line discipline Date: Thu, 31 Dec 2020 17:37:44 -0800 Message-Id: <20210101013744.72562-1-xie.he.0141@gmail.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20201228071550.15745-1-gao.yanB@h3c.com> References: <20201228071550.15745-1-gao.yanB@h3c.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > In tty layer, it use tty->ldisc_sem to proect tty_ldisc_ops. > So I think tty->ldisc_sem can also protect tty->disc_data; It might help by CC'ing TTY people, so that we could get this reviewed by people who are familiar with TTY code. Greg Kroah-Hartman (supporter:TTY LAYER) Jiri Slaby (supporter:TTY LAYER) Thanks! > For examlpe, > When cpu A is running ppp_synctty_ioctl that hold the tty->ldisc_sem, > at the same time if cpu B calls ppp_synctty_close, it will wait until > cpu A release tty->ldisc_sem. So I think it is unnecessary to have the > disc_data_lock; > > cpu A cpu B > tty_ioctl tty_reopen > ->hold tty->ldisc_sem ->hold tty->ldisc_sem(write), failed > ->ld->ops->ioctl ->wait... > ->release tty->ldisc_sem ->wait...OK,hold tty->ldisc_sem > ->tty_ldisc_reinit > ->tty_ldisc_close > ->ld->ops->close IMHO an example might not be necessary. Examples are useful to show incorrectness. But we cannot show correctness by examples because examples are not exhaustive. BTW, there're some typos: "proect" -> "protect" "examlpe" -> "example" "that hold ..." -> "that holds ..." "cpu A release ..." -> "cpu A releases ..." > * FIXME: this is no longer true. The _close path for the ldisc is > * now guaranteed to be sane. > */ > * > * FIXME: Fixed in tty_io nowadays. > */ Since you are removing "disc_data_lock", please update (or remove) these two comments. Thanks!