Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp483115rwe; Wed, 19 Apr 2023 01:27:39 -0700 (PDT) X-Google-Smtp-Source: AKy350Y8ayBJ22Tvau60BOh1+PyV9/cPECX6GfvhQdRQcQYVc4s0xa8eY3XNK9m9G/YnOrzDrBuE X-Received: by 2002:a9d:461a:0:b0:6a4:3b0a:eef6 with SMTP id y26-20020a9d461a000000b006a43b0aeef6mr1158072ote.0.1681892859505; Wed, 19 Apr 2023 01:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681892859; cv=none; d=google.com; s=arc-20160816; b=uJdU8PNw8I8CbGw67ha35z7AjUIIZksjND3FtlrN8LUmTFhuHyt9ZY0kggiSS5eHYT WD42XcWYXBstk/E1IaRJ4ItT0PSmWievWhiKBrHxw1yKVmQbDCOw9IFckqNbTYNWr4AM CnCGxW/2vNVZCX/JfB0HWV25QCD+moIIbTfZPidYV2ES12z3E7CZL80YilqlzvacXLqU peNsFVeMmbXurwu0WwVzJujECLy6gNf9dS/NlHJ2JgVMv1XpUoEr9/ejP1+1UU6Gfvwe eaCxJeIMHT/ue2+xcvAvWp9oGaDn2ohOJSFjZhhOiXrx768pHMVkJi0diK4SaWOfqn7q bQJA== 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 :content-language:references:to:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=yY9AEq3y7VvGgcqqO6MfF2ipqBzjrCfnXO8ukTbyFU8=; b=xKEAhk1SakcPq9XElRqWOn8/COtpzlLohaDrrW/+ibkLTDrZXwyjAsgOfS5rYVH+wI R1nsM7/2rapgH9QnWpOzvLGCKr7co1n0lTICCjIxnSHqw9S7Q5rySoXX2eZDqFmWfx5w gXFVwy0XLIEZv3u0JY0Z3byA8IfG4AasMVWb1wLJsnlLNrG3eM7qumXphmOXifftiFnV /bihfdcPVSZs7B/aKVkagYwSP3UhxwCOgiHRF2Fil5uApjZG6oYovuX4gx6KjcfGUwin X/NFBXX9zf3mwU1ZvkoKCRhvuWjRDIcTArVrpYq5EZK4ktdCDRbxpIRDKXLPoKugrMzW Y2iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=f5AQEK1F; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br14-20020a056830390e00b006a5dd59dbf8si9322182otb.187.2023.04.19.01.27.26; Wed, 19 Apr 2023 01:27:39 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=f5AQEK1F; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232243AbjDSIMb (ORCPT + 99 others); Wed, 19 Apr 2023 04:12:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229978AbjDSIM3 (ORCPT ); Wed, 19 Apr 2023 04:12:29 -0400 Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 99447138 for ; Wed, 19 Apr 2023 01:12:28 -0700 (PDT) Received: by mail-ej1-x633.google.com with SMTP id c9so40606419ejz.1 for ; Wed, 19 Apr 2023 01:12:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681891947; x=1684483947; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id:from :to:cc:subject:date:message-id:reply-to; bh=yY9AEq3y7VvGgcqqO6MfF2ipqBzjrCfnXO8ukTbyFU8=; b=f5AQEK1F0tgB6Hh9ohTjCPoYx2vPeVD4+CsmcdGhKgDOPwJPlBc36U4Y9Q0yfduvxB 8QaLv4NL34J5WDx/Jr1OVlMDeqxHNQEWQeqruBDrmeQVWEm2u4lyz5xjL8NI1m84fzGx x0NhoHMR2Qt4iQcagf+3V3vJpI4K4PcMMi35GCABM1ZiQ2GnmehovzVwgJSV07QibpRr lTJA1zg1idGgVbjvi6SBJER0tO2XTXCMj6rhe5oDpc0oogAsGa10uDZE0nh8FeeMztP6 kqgNTdkTQ+WNAcXTpKXaHoitW3Y/r1WRIXqloRr8vUztAJ1pPpn20jWIOb/o4QgDYBiE pxeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681891947; x=1684483947; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yY9AEq3y7VvGgcqqO6MfF2ipqBzjrCfnXO8ukTbyFU8=; b=K5ks/XPyhN4KRpSqd5q6Wz8F5jjoNbLelAKVYDjLV9uO62jzuQVWP9OKCDktKf8GMA AE6DlgnrOO85EfGkvOr3Wtkk/rJeIVCXLvhpyp82uyNG3zeWNrS1J4r+Pu8B65M+JPh3 yLICifxVGmecyCQk6JcbaTiX7zMzt3b083Aj1sMujmJe06hZFKFZG6HAcEqooAM3Il/L Ipeyn2wdpfCqA84dbt6tRAcVavfLzoWPWNcRPzzEMlUSkTRvfLN5cbxtUqAKWIV0uniR RUsKCsLDChootB3N0ke/Yx3xh9pKRJ+iHyKZBSjRM/Ww7kU92OzJNrG1Hk/N1dbak3Yj oPPQ== X-Gm-Message-State: AAQBX9f+jbviynCQESyqqhfa/mJQgOexF8b7vGa8i0b5IKvdIxQ/TB6u bMzZaDLI8SJxMERijnpYRWU= X-Received: by 2002:a17:906:ce2e:b0:94b:869b:267 with SMTP id sd14-20020a170906ce2e00b0094b869b0267mr14222855ejb.28.1681891946935; Wed, 19 Apr 2023 01:12:26 -0700 (PDT) Received: from ?IPV6:2a02:908:1256:79a0:6273:6c76:9697:9b4c? ([2a02:908:1256:79a0:6273:6c76:9697:9b4c]) by smtp.gmail.com with ESMTPSA id b16-20020a1709063f9000b0094a962da55dsm9017790ejj.195.2023.04.19.01.12.25 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 19 Apr 2023 01:12:26 -0700 (PDT) Message-ID: <10b2570f-a297-d236-fa7b-2e001a4dff12@gmail.com> Date: Wed, 19 Apr 2023 10:12:24 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: BUG: KASAN: null-ptr-deref in drm_sched_job_cleanup+0x96/0x290 [gpu_sched] To: Mikhail Gavrilov , amd-gfx list , dri-devel , Linux List Kernel Mailing , =?UTF-8?Q?Christian_K=c3=b6nig?= , Daniel Vetter References: Content-Language: en-US From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Am 19.04.23 um 09:00 schrieb Mikhail Gavrilov: > Christian? I'm already looking into this, but can't figure out why we run into problems here. What happens is that a CS is aborted without sending the job to the scheduler and in this case the cleanup function doesn't seem to work. Christian. > > ❯ /usr/src/kernels/6.3.0-0.rc7.56.fc39.x86_64/scripts/faddr2line > /lib/debug/lib/modules/6.3.0-0.rc7.56.fc39.x86_64/kernel/drivers/gpu/drm/scheduler/gpu-sched.ko.debug > drm_sched_job_cleanup+0x9a > drm_sched_job_cleanup+0x9a/0x130: > drm_sched_job_cleanup at > /usr/src/debug/kernel-6.3-rc7/linux-6.3.0-0.rc7.56.fc39.x86_64/drivers/gpu/drm/scheduler/sched_main.c:808 > (discriminator 3) > > ❯ cat -s -n /usr/src/debug/kernel-6.3-rc7/linux-6.3.0-0.rc7.56.fc39.x86_64/drivers/gpu/drm/scheduler/sched_main.c > | head -818 | tail -20 > 799 /* drm_sched_job_arm() has been called */ > 800 dma_fence_put(&job->s_fence->finished); > 801 } else { > 802 /* aborted job before committing to run it */ > 803 drm_sched_fence_free(job->s_fence); > 804 } > 805 > 806 job->s_fence = NULL; > 807 > 808 xa_for_each(&job->dependencies, index, fence) { > 809 dma_fence_put(fence); > 810 } > 811 xa_destroy(&job->dependencies); > 812 > 813 } > 814 EXPORT_SYMBOL(drm_sched_job_cleanup); > 815 > 816 /** > 817 * drm_sched_ready - is the scheduler ready > 818 * > >> git blame drivers/gpu/drm/scheduler/sched_main.c -L 800,819 > dbe48d030b285 drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-17 10:49:16 +0200 800) > dma_fence_put(&job->s_fence->finished); > dbe48d030b285 drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-17 10:49:16 +0200 801) } else { > dbe48d030b285 drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-17 10:49:16 +0200 802) /* aborted job > before committing to run it */ > d4c16733e7960 drivers/gpu/drm/scheduler/sched_main.c (Boris > Brezillon 2021-09-03 14:05:54 +0200 803) > drm_sched_fence_free(job->s_fence); > dbe48d030b285 drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-17 10:49:16 +0200 804) } > dbe48d030b285 drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-17 10:49:16 +0200 805) > 26efecf955889 drivers/gpu/drm/scheduler/sched_main.c (Sharat > Masetty 2018-10-29 15:02:28 +0530 806) job->s_fence = NULL; > ebd5f74255b9f drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-05 12:46:49 +0200 807) > ebd5f74255b9f drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-05 12:46:49 +0200 808) > xa_for_each(&job->dependencies, index, fence) { > ebd5f74255b9f drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-05 12:46:49 +0200 809) > dma_fence_put(fence); > ebd5f74255b9f drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-05 12:46:49 +0200 810) } > ebd5f74255b9f drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-05 12:46:49 +0200 811) > xa_destroy(&job->dependencies); > ebd5f74255b9f drivers/gpu/drm/scheduler/sched_main.c (Daniel > Vetter 2021-08-05 12:46:49 +0200 812) > 26efecf955889 drivers/gpu/drm/scheduler/sched_main.c (Sharat > Masetty 2018-10-29 15:02:28 +0530 813) } > 26efecf955889 drivers/gpu/drm/scheduler/sched_main.c (Sharat > Masetty 2018-10-29 15:02:28 +0530 814) > EXPORT_SYMBOL(drm_sched_job_cleanup); > 26efecf955889 drivers/gpu/drm/scheduler/sched_main.c (Sharat > Masetty 2018-10-29 15:02:28 +0530 815) > e688b728228b9 drivers/gpu/drm/amd/scheduler/gpu_scheduler.c (Christian > König 2015-08-20 17:01:01 +0200 816) /** > 2d33948e4e00b drivers/gpu/drm/scheduler/gpu_scheduler.c (Nayan > Deshmukh 2018-05-29 11:23:07 +0530 817) * drm_sched_ready - is the > scheduler ready > 2d33948e4e00b drivers/gpu/drm/scheduler/gpu_scheduler.c (Nayan > Deshmukh 2018-05-29 11:23:07 +0530 818) * > 2d33948e4e00b drivers/gpu/drm/scheduler/gpu_scheduler.c (Nayan > Deshmukh 2018-05-29 11:23:07 +0530 819) * @sched: scheduler instance > > Daniel, because Christian, looks a little busy. Can you help? The git > blame says that you are the author of code which KASAN mentions in its > report. > The issue is reproducible on all available AMD hardware: 6800M, 6900XT, 7900XTX. >