Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6080927ybv; Tue, 18 Feb 2020 09:29:28 -0800 (PST) X-Google-Smtp-Source: APXvYqzMIjp5LA2QlN98KstNzBb8Z/FzSqsPBYH6y4418eb8FmyaW4IEtKmYwzyvR23b7LCa9fBO X-Received: by 2002:a9d:6748:: with SMTP id w8mr2502556otm.335.1582046968071; Tue, 18 Feb 2020 09:29:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582046968; cv=none; d=google.com; s=arc-20160816; b=H4Gl0IJcEo2KwJB4EyzF7o5ptytukutwmIkj5gOfhfD0k/+tmSNOHFeUaVjGo2kfZR HE27xgqRW7BihjN2ZZiw07764Z78+njuHCygUG0SCZNvyfArVEk0jzU81r1xcmHDWH4M dzCv6XMBsReN2CRbRHao41U46mbqgAD4PNLB5NtsXwlKCYDLikxrbnoyHoGKMl7ev2Vi etaqi4xereJb+hMzDXSoTcaleYTLs48hqpdR0POWiLMEv62Ir7OBoASTC+Gf5d9OhULR JeQGyPUnbBsv+zUqJppbT9Si2kwfSzobsnvbFShik7yhci7d7VaEVkarfbZFVx/FDfoJ NHxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=T76RkJiRxtB8J0MZ0A7by0Y0OSqk7JfRiOEs2VEXez4=; b=GzCuRKIYQ8wl3g+QTe9YrEEN/tVzHUbvIcp4Twl3jSh+RZh3GYq+7hZFFmDMRGd909 e9MW4Rx1LFYY0CBlfQYXcRFfmF5tLGejjeuOhbbGUNsbahHqsxpSbvzi10V59Z0OBjNC oHUNw5zdQrS8H9JLTaJOOl7qncUGhgsHJNDH6uCQI7XiFD9shnASc7qttIATWv1qReqq upF4mpvZ/2pWwIXsBL30P1ecBP705aFCzgGfEdQd4QCUpbufpumWl0aVmREYcFi+gACL +NF0R4aWOM55ozxTybJcPY9SfnwQ6uBlZ73TLh5WaoKYk1d37BApxrVlCzIUMrFPjEV+ RTtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e15si2218011otq.237.2020.02.18.09.29.16; Tue, 18 Feb 2020 09:29:28 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727132AbgBRR2s (ORCPT + 99 others); Tue, 18 Feb 2020 12:28:48 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:31298 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726411AbgBRR2r (ORCPT ); Tue, 18 Feb 2020 12:28:47 -0500 Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 01IHRWQu123691; Tue, 18 Feb 2020 12:28:40 -0500 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0a-001b2d01.pphosted.com with ESMTP id 2y6bunre2s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Feb 2020 12:28:39 -0500 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id 01IHSCR2021160; Tue, 18 Feb 2020 17:28:38 GMT Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by ppma03dal.us.ibm.com with ESMTP id 2y6896twjh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 18 Feb 2020 17:28:38 +0000 Received: from b03ledav004.gho.boulder.ibm.com (b03ledav004.gho.boulder.ibm.com [9.17.130.235]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 01IHSbYs53018988 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 18 Feb 2020 17:28:37 GMT Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id A1F1878063; Tue, 18 Feb 2020 17:28:37 +0000 (GMT) Received: from b03ledav004.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 78BCA7805C; Tue, 18 Feb 2020 17:28:35 +0000 (GMT) Received: from jarvis.ext.hansenpartnership.com (unknown [9.80.237.10]) by b03ledav004.gho.boulder.ibm.com (Postfix) with ESMTP; Tue, 18 Feb 2020 17:28:35 +0000 (GMT) Message-ID: <1582046914.16681.11.camel@linux.ibm.com> Subject: Re: [PATCH v2] scsi: sr: get rid of sr global mutex From: James Bottomley To: Christoph Hellwig Cc: Merlijn Wajer , merlijn@wizzup.org, linux-scsi@vger.kernel.org, Jens Axboe , "Martin K. Petersen" , Arnd Bergmann , linux-kernel@vger.kernel.org Date: Tue, 18 Feb 2020 09:28:34 -0800 In-Reply-To: <20200218172347.GA3020@infradead.org> References: <20200218143918.30267-1-merlijn@archive.org> <20200218171259.GA6724@infradead.org> <1582046428.16681.7.camel@linux.ibm.com> <20200218172347.GA3020@infradead.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.26.6 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.138,18.0.572 definitions=2020-02-18_05:2020-02-18,2020-02-18 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 spamscore=0 adultscore=0 suspectscore=0 mlxlogscore=718 lowpriorityscore=0 priorityscore=1501 clxscore=1015 phishscore=0 mlxscore=0 bulkscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2001150001 definitions=main-2002180123 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2020-02-18 at 09:23 -0800, Christoph Hellwig wrote: > On Tue, Feb 18, 2020 at 09:20:28AM -0800, James Bottomley wrote: > > > > Replace the global mutex with per-sr-device mutex. > > > > > > Do we actually need the lock at all? What is protected by it? > > > > We do at least for cdrom_open. It modifies the cdi structure with > > no other protection and concurrent modification would at least > > screw up the use counter which is not atomic. Same reasoning for > > cdrom_release. > > Wouldn't the right fix to add locking to cdrom_open/release instead > of having an undocumented requirement for the callers? Yes ... but that's somewhat of a bigger patch because you now have to reason about the callbacks within cdrom. There's also the question of whether you can assume ops->generic_packet() has its own concurrency protections ... it's certainly true for SCSI, but is it for anything else? Although I suppose you can just not care and run the internal lock over it anyway. James