Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3449310rdb; Wed, 13 Sep 2023 12:19:46 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG4mMVJe3I6leArE2tgCcJdK8qx5of0UZlLU9l97C8kDh7kgd8J2STAL/eGsopVHBT01njV X-Received: by 2002:a05:6a00:230b:b0:68e:29c9:2cd4 with SMTP id h11-20020a056a00230b00b0068e29c92cd4mr4221763pfh.21.1694632786546; Wed, 13 Sep 2023 12:19:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694632786; cv=none; d=google.com; s=arc-20160816; b=SsxbY2sXMPs76rp4t/oXaUvwsGYJ/CdfeZOrLwgvoc6aAieUTpYw0YZOkjt8v7Ix/E puBjs4DcKw04g4x+CZoaYTte4EBsknoTWaub7kKL3BGB5BsVgv0lTIS+mb3Xgxs0QNZ/ FWjxsXzjE/UiiWBYGDLy0nwqLtQUnooKWbVTA7rXLoBEhE9CS/yQOYfM7JHEf40XKEdx R0cWuQJHQE+J7255+NgQsU43GHLyCUzmUlm+ZXXT6D23vBdzTe56TDSdTnI8xulFVHpS D06qUmoKyXoONer8h4tZ98kyFQU2JeM6kXr3lkFks/74VxHp+bsIiTNw+05CQmxyEJ/Z XKTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=IL+p0DO0IUZqRFcgqHBd4klJrZRjlDQpNVieZFDn44o=; fh=ZY8WpMNHGf2IN+wiZjVSlLJ83CQ/DU5s3FqxR8hT0XI=; b=BmAekXaBwHSeCuV/twaVPFvkNoCq8z0wDZkb99lyIu3MO6W+4X6zfIEoTGzj6a7zVM eSp2tEo7x7FU2QTCmzYsyBkwomkcSEpCnMJId0rSJTvuC7KKqV+HVCWOgJSK19tbYNAE wl1BQy5OE2ZtB6qNK9eelp+mi4j7tywg5QBioMLyflJpNMGA1+F/J+0lye1mYy/Z+huT AHHOYWzGoe3NG/myRmllrx8jmNFLwGNHBy1SufKcktkUGgYFks4LHkrVoMYcT8hCU3SD rJyNDNeU18Zax+I4eWFpJW519vLN31Py6jylUiBTdzEHxf6dN25E0YagL2xt3BTyJ6XJ T76Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RJMnfZ4M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id v9-20020a056a00148900b0068ff333d768si3346720pfu.384.2023.09.13.12.19.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 12:19:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=RJMnfZ4M; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1A3AE81C5266; Wed, 13 Sep 2023 10:51:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231547AbjIMRvZ (ORCPT + 99 others); Wed, 13 Sep 2023 13:51:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231470AbjIMRvX (ORCPT ); Wed, 13 Sep 2023 13:51:23 -0400 Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0519C19AF for ; Wed, 13 Sep 2023 10:51:19 -0700 (PDT) Received: by mail-wm1-x329.google.com with SMTP id 5b1f17b1804b1-403004a96eeso582075e9.3 for ; Wed, 13 Sep 2023 10:51:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1694627477; x=1695232277; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=IL+p0DO0IUZqRFcgqHBd4klJrZRjlDQpNVieZFDn44o=; b=RJMnfZ4MHlhiUVwORpKd89HtWnDSV9uWO8TN/eA2KQ+rrtduw/3OOAbcPzrLPUT/sa DRnhUZxRGv5Lj5mw262AH4UpMjyjz9y8WZTf7KvdBlD5HtW7bZyx2n9YtSA59djxfkZ8 B8PqkHpJzgUvQoU3BPJowYKBAytvXuBf75W8MSy432ifEcg+fpO+LT+rApyiIYXozxeW V2qeFW0btFxdtsVsz/uYp+SWNzJCp4YFKK9YJs8WTGB/ViWu65yQKhVceTLDceP4fI4/ LyMj9xk/bhD5tiZt3hWoTbz1ZFx0SngwGRSo0GV9/nF9abH1mxXr9UR7UpWQHpkk/EAv qgYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694627477; x=1695232277; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IL+p0DO0IUZqRFcgqHBd4klJrZRjlDQpNVieZFDn44o=; b=vOWVQF68DpR0YAMc82dAS2Kn7kv2Kg+GdyjIufYNyjW5zGSw0qsyzgtzsLI03v8kvG ClSoLI+65kQ/UFFPsNRm+zrOhIh1N0UozfbXuubKbKn2EJPW5jXdUEoBAQCnz/NBI5xo /ChM1pPKdK1XdMcBB4AJb4108KDTE/HDXWJUjAieS2l+6D6ynG5jRGm/9b/GvXYiW4Sm UyjYcVPYnkGSCq7TDSRDRYFUjrQxRO9f8i5E6Q5xniPoMkdYWArLS/PYF7ArLOU5yMDo q9CukigVsE8+XwQ2ZJ9qKzi2gz1HP+rA85lcW0XhaAKECMXWKdQTkXCNc6JAixvZOTE0 kj7A== X-Gm-Message-State: AOJu0YzOkCdt7hmCapc8yqZCrXhYnVg0nKiIk7gyVtFocVeK6zn8BqQh fwbEyclSW1n+PVjOKn850uEFaA== X-Received: by 2002:a05:600c:2294:b0:403:149:150b with SMTP id 20-20020a05600c229400b004030149150bmr2514123wmf.16.1694627477264; Wed, 13 Sep 2023 10:51:17 -0700 (PDT) Received: from localhost ([102.36.222.112]) by smtp.gmail.com with ESMTPSA id 24-20020a05600c021800b003fee53feab5sm2667837wmi.10.2023.09.13.10.51.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 10:51:16 -0700 (PDT) Date: Wed, 13 Sep 2023 20:51:14 +0300 From: Dan Carpenter To: Brett Creeley Cc: jgg@ziepe.ca, yishaih@nvidia.com, shameerali.kolothum.thodi@huawei.com, kevin.tian@intel.com, alex.williamson@redhat.com, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, shannon.nelson@amd.com Subject: Re: [PATCH vfio] pds/vfio: Fix possible sleep while in atomic context Message-ID: <8fdf4fe3-dd68-4b60-87f3-2607aaa2279c@kadam.mountain> References: <20230913174238.72205-1-brett.creeley@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230913174238.72205-1-brett.creeley@amd.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 13 Sep 2023 10:51:29 -0700 (PDT) X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email On Wed, Sep 13, 2023 at 10:42:38AM -0700, Brett Creeley wrote: > The driver could possibly sleep while in atomic context resulting > in the following call trace while CONFIG_DEBUG_ATOMIC_SLEEP=y is > set: > > [ 675.116953] BUG: spinlock bad magic on CPU#2, bash/2481 > [ 675.116966] lock: 0xffff8d6052a88f50, .magic: 00000000, .owner: /-1, .owner_cpu: 0 > [ 675.116978] CPU: 2 PID: 2481 Comm: bash Tainted: G S 6.6.0-rc1-next-20230911 #1 > [ 675.116986] Hardware name: HPE ProLiant DL360 Gen10/ProLiant DL360 Gen10, BIOS U32 01/23/2021 > [ 675.116991] Call Trace: > [ 675.116997] > [ 675.117002] dump_stack_lvl+0x36/0x50 > [ 675.117014] do_raw_spin_lock+0x79/0xc0 > [ 675.117032] pds_vfio_reset+0x1d/0x60 [pds_vfio_pci] > [ 675.117049] pci_reset_function+0x4b/0x70 > [ 675.117061] reset_store+0x5b/0xa0 > [ 675.117074] kernfs_fop_write_iter+0x137/0x1d0 > [ 675.117087] vfs_write+0x2de/0x410 > [ 675.117101] ksys_write+0x5d/0xd0 > [ 675.117111] do_syscall_64+0x3b/0x90 > [ 675.117122] entry_SYSCALL_64_after_hwframe+0x6e/0xd8 > [ 675.117135] RIP: 0033:0x7f9ebbd1fa28 > [ 675.117141] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 15 4d 2a 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55 > [ 675.117148] RSP: 002b:00007ffdff410728 EFLAGS: 00000246 ORIG_RAX: 0000000000000001 > [ 675.117156] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f9ebbd1fa28 > [ 675.117161] RDX: 0000000000000002 RSI: 000055ffc5fdf7c0 RDI: 0000000000000001 > [ 675.117166] RBP: 000055ffc5fdf7c0 R08: 000000000000000a R09: 00007f9ebbd7fae0 > [ 675.117170] R10: 000000000000000a R11: 0000000000000246 R12: 00007f9ebbfc06e0 > [ 675.117174] R13: 0000000000000002 R14: 00007f9ebbfbb860 R15: 0000000000000002 > [ 675.117180] This splat doesn't match the sleeping in atomic bug at all. That warning should have said, "BUG: sleeping function called from invalid context" and the stack trace would have looked totally different. I don't have a problem with the patch itself, that seems reasonable. I really like that you tested it but you're running into a different bug here. Hopefully, you just pasted the wrong splat but otherwise we need to investigate this other "bad magic" bug. regards, dan carpenter