Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp81058rwb; Fri, 19 Aug 2022 17:24:43 -0700 (PDT) X-Google-Smtp-Source: AA6agR4CZU6YVvnRtNrLmx5+WhCcDK9Dhc4ngJH/nflSMnd23lQspvyTS6mqkIv0yH4CSiRkmHZf X-Received: by 2002:a17:906:84e1:b0:73c:9546:10ec with SMTP id zp1-20020a17090684e100b0073c954610ecmr4407639ejb.336.1660955083378; Fri, 19 Aug 2022 17:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660955083; cv=none; d=google.com; s=arc-20160816; b=bK2gEfbk4e1wFhd8woS6/W781SveE5o+soJny3N0wpzwAtr34Zuj3iXImLBqUlnmlR 3182hYs3CqDkg1L/JADwoIkpDBotaSUK/pkP8Vyi8pr8dM0VYgNNZW8gxijl3lFYH/S/ WTHUMoEkHlE7PHZMhddT1BikCKNH/YeD9LUjf32zQgyKLxO+x9hf+DC5r2s2pJW+EfcY XdrEm0FUGlYdHNS0SxgT6uk6GEqEG2xwJqhYDeYK2sGYyGqSJtOyqwdylsTq9p9oiCqy 0LNQfwC5XyqxT+5kbXG7TxZNNyHFb+V9A9yOdAYBawb63px4YB0s7b9A9NUW92KDLjs3 oN4w== 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 :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=iNc0+qZK4maYA+Nyvb5N9XcmUuPrIeK5kHdMUPdhfyQ=; b=dpApU8NVFrDh2qgzzyOHK33cndmMyaNAEM23eut26rGvc7iafyuDQKvEcJPX8K67+N Ao+2Vb7noN/Lb3tX/2SjxfnXatYnVfrjBIqXOxLaPaEwmAi3LrwLgnctvOUt86uP95ku RdheIdbsrKNhVQa2QggXfEKtK01d1xF+J3ERyQ1y0ugCQtyQ0ZXwfOjwGb7+KGOQ+V/X eJlV8V84L8/tOVlMwf5cKX07E/3Y5UBTtooaXD50z50xpcCS2O39Ovjc9Ka1eZXBNyis ozym/eysgxVaUiXMvG82lr9i4gETxNK+n3RoJTCC5F73rHYJgSS8FQUeJqJ40jKlsgCo KM+Q== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h20-20020a170906855400b0072f3efb9687si3278447ejy.242.2022.08.19.17.24.18; Fri, 19 Aug 2022 17:24:43 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=acm.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240993AbiHTAHd (ORCPT + 99 others); Fri, 19 Aug 2022 20:07:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244772AbiHTAHT (ORCPT ); Fri, 19 Aug 2022 20:07:19 -0400 Received: from mail-pg1-f171.google.com (mail-pg1-f171.google.com [209.85.215.171]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B30F31156F2 for ; Fri, 19 Aug 2022 17:07:12 -0700 (PDT) Received: by mail-pg1-f171.google.com with SMTP id v4so4832572pgi.10 for ; Fri, 19 Aug 2022 17:07:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=iNc0+qZK4maYA+Nyvb5N9XcmUuPrIeK5kHdMUPdhfyQ=; b=VhZPAbeD7ZpWvXppNMo5H2Ei6IQLue+r+UWXc7QPYfENlJoew5V49Y/pf8BIcKeUbT x0jznppvDRUqfI/hsnhQIS3Z0yZZ+LJTf39xGmjczqf+l8oZZkEk1MXhRyiwt2V698CC mR5hMsnup/kG17YsgG+KKaRtYiW7PD8iWTFCCUhseozIYTpKaPZvW2NR7Ckj4aroXI5l KHhIAG2dJkdbFz6o1wBMRmpTVvMVch6HDFUbNxNaG1Gwiu3hjC3tMBdNBkE+sidzSmYH r+6MW5yMsBJ4WTENqF4LYYLBGtqhGJhVJcb3KnAF3szfX9h87ZDcDaeI9beBzkpMti9E +7lQ== X-Gm-Message-State: ACgBeo35NAclOUuHe7xmu+CbsOxwJo2VXGFj/PkBW0efFTy7kRssKEBu 645R+k0FESnUWvSYFE3y2GQ= X-Received: by 2002:aa7:88d1:0:b0:52f:8fb8:5ec6 with SMTP id k17-20020aa788d1000000b0052f8fb85ec6mr10255695pff.34.1660954032019; Fri, 19 Aug 2022 17:07:12 -0700 (PDT) Received: from [192.168.3.217] ([98.51.102.78]) by smtp.gmail.com with ESMTPSA id p18-20020a170902ead200b0016a6caacaefsm3682708pld.103.2022.08.19.17.07.09 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 19 Aug 2022 17:07:11 -0700 (PDT) Message-ID: <12b231ea-dc7d-bb09-3986-32a07a63acd4@acm.org> Date: Fri, 19 Aug 2022 17:07:09 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2 From: Bart Van Assche Subject: Re: [PATCH v2] driver core: Fix bus_type.match() error handling To: Guenter Roeck Cc: Isaac Manjarres , Greg Kroah-Hartman , "Rafael J. Wysocki" , Ulf Hansson , Tomeu Vizoso , Russell King , Marek Szyprowski , Saravana Kannan , stable@kernel.org, kernel-team@android.com, linux-kernel@vger.kernel.org References: <20220816111311.GC1108868@roeck-us.net> <20220817010559.GA1880847@roeck-us.net> <20220818225932.GA3433999@roeck-us.net> <20220819112832.GA3106213@roeck-us.net> <20220819220841.GA3230067@roeck-us.net> Content-Language: en-US In-Reply-To: <20220819220841.GA3230067@roeck-us.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 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 8/19/22 15:08, Guenter Roeck wrote: > On Fri, Aug 19, 2022 at 01:01:29PM -0700, Bart Van Assche wrote: >> Since the issue has been observed in qemu, how about sharing the sysrq-t >> output? I recommend to collect that output as follows: >> * Send the serial console output to a file. This involves adding >> console=ttyS0,115200n8 to the kernel command line and using the proper qemu >> options to save the serial console output into a file. >> * Reproduce the hang and send the sysrq-t key sequence to qemu, e.g. as >> follows: virsh send-key ${vm_name} KEY_LEFTALT KEY_SYSRQ KEY_T >> > Unless I am missing something, this requires a virtio keyboard. > So far I have been unable to get this to work with qemu arm emulations. That's unfortunate. Is there another way to collect call traces after the lockup has happened? Is it sufficient to enable the serial console and to monitor the serial console output? Is CONFIG_SOFTLOCKUP_DETECTOR=y sufficient? If not, how about converting the new wait calls in the SCSI code, e.g. as shown in the (totally untested) patch below? Thanks, Bart. diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 6c63672971f1..edd238384f1d 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include #include @@ -196,7 +197,11 @@ void scsi_remove_host(struct Scsi_Host *shost) * unloaded and/or the host resources can be released. Hence wait until * the dependent SCSI targets and devices are gone before returning. */ - wait_event(shost->targets_wq, atomic_read(&shost->target_count) == 0); + while (wait_event_timeout(shost->targets_wq, + atomic_read(&shost->target_count) == 0, 60 * HZ) <= 0) { + show_state(); + show_all_workqueues(); + } scsi_mq_destroy_tags(shost); } diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 213ebc88f76a..1c17b6c53ab0 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -1536,7 +1537,11 @@ static void __scsi_remove_target(struct scsi_target *starget) * devices associated with @starget have been removed to prevent that * a SCSI error handling callback function triggers a use-after-free. */ - wait_event(starget->sdev_wq, atomic_read(&starget->sdev_count) == 0); + while (wait_event_timeout(starget->sdev_wq, + atomic_read(&starget->sdev_count) == 0, 60 * HZ) <= 0) { + show_state(); + show_all_workqueues(); + } } /**