Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3354214ioa; Tue, 26 Apr 2022 01:49:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwuJDjCdVJHgTNuTWbLovXVGIXSCwg6kxmZhlaJqAlZD6x/ATj7nrXCp/ae0s6/eM/hd/tb X-Received: by 2002:a05:6402:2985:b0:425:d51f:ae4 with SMTP id eq5-20020a056402298500b00425d51f0ae4mr15426243edb.379.1650962980134; Tue, 26 Apr 2022 01:49:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650962980; cv=none; d=google.com; s=arc-20160816; b=04sFmppIV8xs1TeFYFvO3wctPrzHqEcE/Rk85elJBvMePPeoXJsRiI0wLrR8tuxur5 rdtYDYC+zwZIkDSpceAliPZ808BwjNwI2GPpUevaBpL0FPCLk1+z1jmv6Cm+xIUXkbjN jxn6vYstu6tw/VqMcXYjW+HfBMQHB7t2s3WWljokJMojwbTLC/F7Go4ibkSU3MYMZZft NWPRwfGqqq/y3IoAtMIdt1VcF/rX+BfBug8mO7atB3wlQnEflJ6yaCdzZGCXRTH8ZvmE /2OYNorpUBprykyI9ArD2TANKXFIA745OudfXK/+3mDouEum73S31l7Ok1zuka9K7exh +Tbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:reply-to:user-agent :mime-version:date:message-id; bh=lMcGckjLgk4vEm5G45H50VZL8C43DSvb0T60zR7D8hg=; b=f/4KYqScjeneqscUAh3WyCy4/C/vrGBWW8sDPkZBHLSU/oIoMZU9hipr2HGIrpx3cq 2CK3qaUQGm24hRiOxb6f0ym+FUQTjEZlw0uPCksN+VOfMlxNMiHRWJDXL5LylxVu3l8G 1QVimpeC1PjYK/QlglYoIVvvLOCUH9SHSU+IXSuuJfng6hTubsfpVxPEDNuD18GFM4rs asT5M1cuWNrBAxcOidrTBeHJv7Ih4zHv7FGqEv334QrTB5s8jTNVsToeRHJGiHMqqI90 OSAPi3ouNYpSXzvJ8tUBS+fYf49ttcM3uYW25vmFTnJkLKPR5+G7MxGc64VBhZ+u00kL Gxlg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a056402354b00b00423e3b84928si16727627edd.568.2022.04.26.01.49.15; Tue, 26 Apr 2022 01:49:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233060AbiDZCF7 (ORCPT + 99 others); Mon, 25 Apr 2022 22:05:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33380 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231364AbiDZCF5 (ORCPT ); Mon, 25 Apr 2022 22:05:57 -0400 X-Greylist: delayed 496 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Mon, 25 Apr 2022 19:02:51 PDT Received: from mp-relay-01.fibernetics.ca (mp-relay-01.fibernetics.ca [208.85.217.136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46DB38CDB6 for ; Mon, 25 Apr 2022 19:02:50 -0700 (PDT) Received: from mailpool-fe-02.fibernetics.ca (mailpool-fe-02.fibernetics.ca [208.85.217.145]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mp-relay-01.fibernetics.ca (Postfix) with ESMTPS id 1FC94E0DD9; Tue, 26 Apr 2022 01:54:34 +0000 (UTC) Received: from localhost (mailpool-mx-01.fibernetics.ca [208.85.217.140]) by mailpool-fe-02.fibernetics.ca (Postfix) with ESMTP id E8F2961542; Tue, 26 Apr 2022 01:54:33 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at X-Spam-Score: -0.2 X-Spam-Level: X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from mailpool-fe-02.fibernetics.ca ([208.85.217.145]) by localhost (mail-mx-01.fibernetics.ca [208.85.217.140]) (amavisd-new, port 10024) with ESMTP id kfGYxcQ-hi_E; Tue, 26 Apr 2022 01:54:33 +0000 (UTC) Received: from [192.168.48.23] (host-45-78-195-155.dyn.295.ca [45.78.195.155]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dgilbert@interlog.com) by mail.ca.inter.net (Postfix) with ESMTPSA id EE3E46046A; Tue, 26 Apr 2022 01:54:31 +0000 (UTC) Message-ID: <5485f529-e99a-0bdd-07bd-b5b559da91e6@interlog.com> Date: Mon, 25 Apr 2022 21:54:31 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Reply-To: dgilbert@interlog.com Subject: Re: [PATCH 1/4] scsi: core: constify pointer to scsi_host_template Content-Language: en-CA To: Bart Van Assche , John Garry , Krzysztof Kozlowski , Christoph Hellwig Cc: "Ewan D. Milne" , "James E.J. Bottomley" , "Martin K. Petersen" , Alim Akhtar , Avri Altman , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org, james.smart@broadcom.com References: <20220408103027.311624-1-krzysztof.kozlowski@linaro.org> <2a88a992-641a-b3ff-fe39-7a61fff87cb6@huawei.com> <4c3be5b6-50ef-9e9a-6cee-9642df943342@linaro.org> <7b3885e3-dbae-ff0b-21dc-c28d635d950b@huawei.com> <24bfb681-faec-3567-3089-9cd5ee182710@linaro.org> <1bb53912-c5c3-7690-e82f-cf356ca87404@huawei.com> From: Douglas Gilbert In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2022-04-25 21:16, Bart Van Assche wrote: > On 4/25/22 06:04, John Garry wrote: >> On 25/04/2022 10:22, Krzysztof Kozlowski wrote: >>> For example scsi_proc_hostdir_rm(): 'present' and 'proc_dir' members. >>> Where should they be stored? Should they be moved to the Scsi_Host? >>> >> >> I don't think scsi_Host is appropriate as this is per-scsi host template, >> unless you see a way to do it that way. Alternatively we could keep a separate >> list of registered sht, like this: >> >> struct sht_proc_dir { >>      int cnt; >>      struct list_head list; >>      struct proc_dir_entry *proc_dir; >>      struct scsi_host_template *sht; >> }; >> static LIST_HEAD(sht_proc_dir_list); >> >> void scsi_proc_hostdir_add(struct scsi_host_template *sht) >> { >>      struct sht_proc_dir *dir; >> >>      if (!sht->show_info) >>          return; >> >>      mutex_lock(&global_host_template_mutex); >>      list_for_each_entry(dir, &sht_proc_dir_list, list) { >>          if (dir->sht == sht) { >>              dir->cnt++; >>              goto out; >>          } >>      } >>      dir = kzalloc(sizeof(*dir), GFP_KERNEL); >>      if (!dir) >>          goto out; >> >>      dir->proc_dir = proc_mkdir(sht->proc_name, proc_scsi); >>      if (!dir->proc_dir) { >>          printk(KERN_ERR "%s: proc_mkdir failed for %s\n", >>                     __func__, sht->proc_name); >>          kfree(dir); >>          goto out; >>      } >> >>      dir->cnt++; >>      list_add_tail(&dir->list, &sht_proc_dir_list); >> out: >>      mutex_unlock(&global_host_template_mutex); >> } > > How about removing scsi_proc_hostdir_add(), scsi_proc_hostdir_rm() and all other > code that creates files or directories under /proc/scsi? There should be > corresponding entries in sysfs for all /proc/scsi entries. Some tools in > sg3_utils use that directory so sg3_utils will have to be updated. ... breaking this: ~$ cat /proc/scsi/scsi Attached devices: Host: scsi3 Channel: 00 Id: 00 Lun: 00 Vendor: IBM-207x Model: HUSMM8020ASS20 Rev: J4B6 Type: Direct-Access ANSI SCSI revision: 06 Host: scsi3 Channel: 00 Id: 01 Lun: 00 Vendor: IBM-207x Model: HUSMM8020ASS20 Rev: J4B6 Type: Direct-Access ANSI SCSI revision: 06 Host: scsi3 Channel: 00 Id: 02 Lun: 00 Vendor: SEAGATE Model: ST200FM0073 Rev: 0007 Type: Direct-Access ANSI SCSI revision: 06 ... A deprecation notice would be helpful, then removal after a few kernel cycles. Yes, lsscsi can give that output: $ lsscsi -c Attached devices: Host: scsi2 Channel: 00 Target: 00 Lun: 00 Vendor: SEAGATE Model: ST200FM0073 Rev: 0007 Type: Direct-Access ANSI SCSI revision: 06 Host: scsi2 Channel: 00 Target: 01 Lun: 00 Vendor: WDC Model: WSH722020AL5204 Rev: C421 Type: Zoned Block ANSI SCSI revision: 07 Host: scsi2 Channel: 00 Target: 02 Lun: 00 Vendor: Areca Te Model: ARC-802801.37.69 Rev: 0137 Type: Enclosure ANSI SCSI revision: 05 ... [Hmmm, in a different order.] However no distribution that I'm aware of includes lsscsi in its installation. [Most recent example: Ubuntu 22.04] Linux is not alone ... in FreeBSD how do you list SCSI devices in your system? Answer: as root you invoke 'camcontrol devlist', it's so obvious. Perhaps the Linux kernel could have a deprecation process which uses inotify or similar to notice accesses to /proc/scsi/scsi (say) and print out a helpful response along the lines" "this is no longer supported, try using the lsscsi utility". Doug Gilbert