Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp2343460ybl; Sat, 14 Dec 2019 10:34:14 -0800 (PST) X-Google-Smtp-Source: APXvYqyBxThYFPKHHx9ThlrWSzvdhbhP8q1Dln2ZePe3F/2aLILOp8TYOJFHFHf6Ta+btKNYMWdT X-Received: by 2002:a9d:798e:: with SMTP id h14mr20968165otm.257.1576348454268; Sat, 14 Dec 2019 10:34:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576348454; cv=none; d=google.com; s=arc-20160816; b=q6+PVLaRK09NSDr75U1MscfPDYA2qwNJjzZ++7ny+lq3vHyG00fiJr3TPAkFGjVg0d AYjVhkNo42m/5SvvY3kLnXiyipipElAxHTbKQxYBc9U/x9MU3kyf711tjq4nUJQ5AsFP aYQRWUINm2Dk6IA1Sr8ic6xq5NXTywSz/CEmCJBa1MHrtBvkfsmZokZ8WqCXK5lor3ag 0QOJRVZDh+tTjGyY3RktXbPozgqe3DSKimB3QxTqENZW4gQGZpbmVHVxAhECxVuWOqEO 6mgGjgWdwGf+hFzaP1mjgmv4bjlk+ZWpd8ijjv8ry6nXH4RCxz7n8iBTqojhkpj4dL9d SMlw== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=UZcSU5PLQVwBUi4dUWpFu/eGboJk4k9Zub31FQhbfA8=; b=j6i2GQDizsgJa/WEH2CjvDXyh/3VTlb3ZZC+PthyvsmFTJUZNWLQAgWjCt837esUD8 gOa/Ibw/Sz7ICorY1cTftPIjq2ZUKQWSgTFuhCWOsewjKx3OZ7g2ov4GX+KLDUsmyMVc 2/sa2Ej2Wo2K7rxDGTqoTG81Pa0Xm+ILGbUVhsQ1g0wHTtPND7QQ9Fe6pX4G/Bl00iPq ArJbbHzI8D+LX5xNHJzu/J0yzsHEfSwOXBGs/MDBU7g6gUreTAZEqKDZnP8hrLvxKZqK Mbr4S2NAmKHpPZXEt6RmZKym4Ac/pKJai+By5YKSfF+krkt5vovre0TjK56KugMbyUSq N9Fg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b2si7061120oib.272.2019.12.14.10.33.51; Sat, 14 Dec 2019 10:34:14 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726541AbfLNSce (ORCPT + 99 others); Sat, 14 Dec 2019 13:32:34 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:34351 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbfLNScd (ORCPT ); Sat, 14 Dec 2019 13:32:33 -0500 Received: by mail-pg1-f195.google.com with SMTP id r11so1230823pgf.1; Sat, 14 Dec 2019 10:32:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=UZcSU5PLQVwBUi4dUWpFu/eGboJk4k9Zub31FQhbfA8=; b=Y7BbXHXQPsDFQRqOBcZx5ijc+QyG1r+lpPL3YgWREMt4vPKU+hKsbrI1Iq0xdu27xr UyykTklxefjbe53VAEsXsCiWMBvrncYBRpyTwDBYER5xvOI1bZEE67FAZLgBWPM1gFVq etDIgUqaJ8JVYnORqHUHqagMCZ9U5U11wxrlXDmuFigC54pHCS5IBmTIoB5XHrK5NpsN 5Ofp+zbCRTV4iFf20tSOgBQK37WV8g8FySLzD5yxq7Z9j3OiEqhUyNvjymNMtCKyG999 yfhJK/qbCuByMuVuV2I34ENlwgp6oPY0bTIlQPqsa8RHph5GIsqjU5HIAFugnqyis+Vs ezHg== X-Gm-Message-State: APjAAAXswRCC3W4y5aro2+AiV/M+G5ucUSNX0jNAUGt+BXw0WOmOXteQ JNZAgIFFx66drDQg5/F53REgeKoah7E= X-Received: by 2002:a65:6815:: with SMTP id l21mr6696564pgt.283.1576348352324; Sat, 14 Dec 2019 10:32:32 -0800 (PST) Received: from [10.234.191.77] ([73.93.155.125]) by smtp.gmail.com with ESMTPSA id u18sm16198958pgn.9.2019.12.14.10.32.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 14 Dec 2019 10:32:31 -0800 (PST) Subject: Re: [PATCH 1/2] scsi: ufs: Put SCSI host after remove it To: Can Guo , asutoshd@codeaurora.org, nguyenb@codeaurora.org, rnayak@codeaurora.org, linux-scsi@vger.kernel.org, kernel-team@android.com, saravanak@google.com, salyzyn@google.com Cc: Alim Akhtar , Avri Altman , Pedro Sousa , "James E.J. Bottomley" , "Martin K. Petersen" , Stanley Chu , Bean Huo , Venkat Gopalakrishnan , Tomas Winkler , open list References: <1576328616-30404-1-git-send-email-cang@codeaurora.org> <1576328616-30404-2-git-send-email-cang@codeaurora.org> From: Bart Van Assche Message-ID: <85475247-efd5-732e-ae74-6d9a11e1bdf2@acm.org> Date: Sat, 14 Dec 2019 10:32:29 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <1576328616-30404-2-git-send-email-cang@codeaurora.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/14/19 8:03 AM, Can Guo wrote: > In ufshcd_remove(), after SCSI host is removed, put it once so that its > resources can be released. > > Signed-off-by: Can Guo > > diff --git a/drivers/scsi/ufs/ufshcd.c b/drivers/scsi/ufs/ufshcd.c > index b5966fa..a86b0fd 100644 > --- a/drivers/scsi/ufs/ufshcd.c > +++ b/drivers/scsi/ufs/ufshcd.c > @@ -8251,6 +8251,7 @@ void ufshcd_remove(struct ufs_hba *hba) > ufs_bsg_remove(hba); > ufs_sysfs_remove_nodes(hba->dev); > scsi_remove_host(hba->host); > + scsi_host_put(hba->host); > /* disable interrupts */ > ufshcd_disable_intr(hba, hba->intr_mask); > ufshcd_hba_stop(hba, true); Hi Can, The UFS driver may queue work asynchronously and that asynchronous work may refer to the SCSI host, e.g. ufshcd_err_handler(). Is it guaranteed that all that asynchronous work has finished before scsi_host_put() is called? Thanks, Bart.