From patchwork Wed Mar 21 15:38:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaldo Carvalho de Melo X-Patchwork-Id: 10299721 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id EDDDB600F6 for ; Wed, 21 Mar 2018 15:39:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E26F128D82 for ; Wed, 21 Mar 2018 15:39:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D70E229088; Wed, 21 Mar 2018 15:39:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2C490297BC for ; Wed, 21 Mar 2018 15:39:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752901AbeCUPjR (ORCPT ); Wed, 21 Mar 2018 11:39:17 -0400 Received: from mail.kernel.org ([198.145.29.99]:35306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752867AbeCUPi7 (ORCPT ); Wed, 21 Mar 2018 11:38:59 -0400 Received: from jouet.infradead.org (unknown [179.97.41.186]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 01D62217D8; Wed, 21 Mar 2018 15:38:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 01D62217D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=acme@kernel.org Received: by jouet.infradead.org (Postfix, from userid 1000) id A0AAD145571; Wed, 21 Mar 2018 12:38:54 -0300 (-03) Date: Wed, 21 Mar 2018 12:38:54 -0300 From: Arnaldo Carvalho de Melo To: Sebastian Andrzej Siewior , "Nicholas A. Bellinger" Cc: Thomas Gleixner , LKML , linux-rt-users , Steven Rostedt , linux-scsi@vger.kernel.org, Daniel Bristot de Oliveira , Luis Claudio =?iso-8859-1?Q?R=2E_Gon=E7alves?= , Clark Williams , target-devel@vger.kernel.org Subject: [PATCH] target: Use WARNON_NON_RT(!irqs_disabled()) Message-ID: <20180321153854.GB24312@kernel.org> MIME-Version: 1.0 Content-Disposition: inline X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.9.2 (2017-12-15) Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi, We got a report where this WARN_ON got triggered: [ 7552.799997] ------------[ cut here ]------------ [ 7552.800016] WARNING: CPU: 7 PID: 1090 at drivers/target/target_core_transport.c:3009 __transport_check_aborted_status+0x153/0x190 [target_core_mod] [ 7552.800037] Modules linked in: target_core_user uio target_core_pscsi target_core_file target_core_iblock ib_srpt ib_srp scsi_transport_srp scsi_tgt xt_CHECKSUM iptable_mangle ipt_MASQUERADE nf_nat_masquerade_ipv4 iptable_nat nf_nat_ipv4 nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_conntrack nf_conntrack ipt_REJECT nf_reject_ipv4 tun ebtable_filter ebtables ip6table_filter ip6_tables iptable_filter bridge stp llc ib_isert iscsi_target_mod target_core_mod ib_ucm rpcrdma mlx5_ib sunrpc rdma_ucm ib_uverbs ib_iser rdma_cm iw_cm libiscsi ib_umad ib_ipoib scsi_transport_iscsi ib_cm sb_edac intel_powerclamp coretemp intel_rapl iosf_mbi crc32_pclmul ghash_clmulni_intel aesni_intel lrw gf128mul glue_helper ablk_helper cryptd iTCO_wdt iTCO_vendor_support hfi1 ipmi_ssif sg rdmavt ib_core hpilo hpwdt pcspkr ipmi_si [ 7552.800055] ipmi_devintf ipmi_msghandler wmi acpi_power_meter ioatdma dca shpchp pcc_cpufreq lpc_ich ip_tables xfs libcrc32c mgag200 i2c_algo_bit drm_kms_helper syscopyarea sysfillrect sysimgblt fb_sys_fops ttm sd_mod crc_t10dif crct10dif_generic crct10dif_pclmul crct10dif_common crc32c_intel serio_raw ata_generic pata_acpi mlx5_core ata_piix tg3 drm devlink libata i2c_core ptp hpsa scsi_transport_sas pps_core dm_mirror dm_region_hash dm_log dm_mod [last unloaded: ib_srpt] [ 7552.800058] CPU: 7 PID: 1090 Comm: kworker/7:1H Not tainted 3.10.0-768.rt56.699.el7.x86_64 #1 [ 7552.800058] Hardware name: HP ProLiant DL380p Gen8, BIOS P70 11/14/2013 [ 7552.800066] Workqueue: ib-comp-wq ib_cq_poll_work [ib_core] [ 7552.800067] Call Trace: [ 7552.800075] [] dump_stack+0x19/0x1b [ 7552.800078] [] __warn+0xfb/0x120 [ 7552.800080] [] warn_slowpath_null+0x1d/0x20 [ 7552.800085] [] __transport_check_aborted_status+0x153/0x190 [target_core_mod] [ 7552.800091] [] target_execute_cmd+0x34/0x2e0 [target_core_mod] [ 7552.800096] [] transport_generic_new_cmd+0x112/0x240 [target_core_mod] [ 7552.800100] [] transport_handle_cdb_direct+0x42/0x90 [target_core_mod] [ 7552.800105] [] target_submit_cmd_map_sgls+0x14d/0x210 [target_core_mod] [ 7552.800107] [] srpt_handle_new_iu+0x254/0x660 [ib_srpt] [ 7552.800109] [] srpt_recv_done+0x38/0x60 [ib_srpt] [ 7552.800113] [] __ib_process_cq+0x65/0xe0 [ib_core] [ 7552.800118] [] ib_cq_poll_work+0x20/0x60 [ib_core] [ 7552.800120] [] process_one_work+0x176/0x4a0 [ 7552.800121] [] worker_thread+0x16c/0x3f0 [ 7552.800123] [] ? manage_workers.isra.36+0x2b0/0x2b0 [ 7552.800125] [] kthread+0xcf/0xe0 [ 7552.800139] [] ? kthread_worker_fn+0x170/0x170 [ 7552.800151] [] ret_from_fork+0x58/0x90 [ 7552.800153] [] ? kthread_worker_fn+0x170/0x170 [ 7552.800154] ---[ end trace 0000000000000002 ]--- [ 7554.164964] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. [ 7554.231254] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. [ 7554.294860] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. [ 7554.360810] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. [ 7554.421867] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. [ 7554.485931] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. [ 7554.546909] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. [ 7554.607820] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. [ 7554.671883] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. [ 7554.730826] srpt/0xf4521403000e4aa0f4521403000e4ad0: Unsupported SCSI Opcode 0xa3, sending CHECK_CONDITION. static int __transport_check_aborted_status(struct se_cmd *cmd, int send_status) __releases(&cmd->t_state_lock) __acquires(&cmd->t_state_lock) { int ret; assert_spin_locked(&cmd->t_state_lock); WARN_ON_ONCE_NONRT(!irqs_disabled()); And it is called just from these two places: int transport_check_aborted_status(struct se_cmd *cmd, int send_status) { int ret; spin_lock_irq(&cmd->t_state_lock); ret = __transport_check_aborted_status(cmd, send_status); spin_unlock_irq(&cmd->t_state_lock); return ret; } EXPORT_SYMBOL(transport_check_aborted_status); And: void target_execute_cmd(struct se_cmd *cmd) { /* * Determine if frontend context caller is requesting the stopping of * this command for frontend exceptions. * * If the received CDB has aleady been aborted stop processing it here. */ spin_lock_irq(&cmd->t_state_lock); if (__transport_check_aborted_status(cmd, 1)) { spin_unlock_irq(&cmd->t_state_lock); return; } Since cmd->t_state_lock becomes a sleeping spin lock on RT, that thing triggers, turn it into a NONRT WARN_ON, a kernel built with this patch passes the test case that lead to a BZ being filled for the kernel-rt package: https://bugzilla.redhat.com/show_bug.cgi?id=1512875 Signed-off-by: Arnaldo Carvalho de Melo --- -- To unsubscribe from this list: send the line "unsubscribe target-devel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/target/target_core_transport.c b/drivers/target/target_core_transport.c index 4558f2e1fe1b..318453e7adfd 100644 --- a/drivers/target/target_core_transport.c +++ b/drivers/target/target_core_transport.c @@ -3204,7 +3204,7 @@ static int __transport_check_aborted_status(struct se_cmd *cmd, int send_status) int ret; assert_spin_locked(&cmd->t_state_lock); - WARN_ON_ONCE(!irqs_disabled()); + WARN_ON_ONCE_NONRT(!irqs_disabled()); if (!(cmd->transport_state & CMD_T_ABORTED)) return 0;