Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp3869722rwl; Sun, 2 Apr 2023 17:38:07 -0700 (PDT) X-Google-Smtp-Source: AK7set/sHbITo27kbMwO0070sy8xFSJkJN3+0rwJfPeeOZMvgYGe461sFAO4q9pvKSeSiCj/UjXT X-Received: by 2002:a05:6a20:4c93:b0:da:144:92bf with SMTP id fq19-20020a056a204c9300b000da014492bfmr29920267pzb.14.1680482286800; Sun, 02 Apr 2023 17:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680482286; cv=none; d=google.com; s=arc-20160816; b=mlI2l01Y6kj/dT42FQKQ6fiV2anBMWdmx8k/OyfC6rQ4BcQdYdTIM0k+gZsKvCIhQf IvNlD6mycocvwQY6uEdBEfpzWyLmCO+BnvayAtCyVdnGlSywoPBLTC8x3v0D9zOaHSOK NxqfOWZBLBTXCZiznKpYC+mzHi51c5rLMrDdNELlpD0SHQ0Kw2lTvVo/D4KuQt+23+p6 SGCrnmS2e93FM+B//btL3fVkj5//bBJMRGhaVmzBCK1r3z+rKl7uwZg7c9bd0dqn2L5Y e0jbrgqflyhDtMmZaqHkFnsJnGlg+Z0vLDF0hJ6gu4+WWsrIjVmMqqvlSJXA6XhXuJqF gucA== 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=UiNHIMYxn7gVlToQ5Hc4FMcKc93SK0qTPnI7d5QnWrg=; b=LIjjQ4BzinRHW5afhX271MRrKs46Hh4oV+NYSZu82gF2+17svFD2aQshRZyY97uepI fOIfwrx4ZMrfm+ubzFi03++/uWnZiYik2O/UezwBgL5fequTzeRlTes+rSqHfC4RDbZr FtOdtYKIWJz3FQMy6Hnnx1YaawYSckCxKu7Rt820uTDRi0vo1ntlJvbdW2fqk7R2zgFh Pai1UNLNyJpx8pGgcVsvc2c4UFbeiRioBXbMaT+S82kTjtHY+DLQEt2c1//Bl3PYLNui c7VorDwIBZlN/y+fW6RCSSWd5fF9hOrVQtwFdfgigMsStm4yV+UafC+UazxtxSO9gqQT ZcGQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=l+vTChPU; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h9-20020a654809000000b0050126b5d089si7011846pgs.386.2023.04.02.17.37.53; Sun, 02 Apr 2023 17:38:06 -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=@kernel.org header.s=k20201202 header.b=l+vTChPU; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230293AbjDBXxc (ORCPT + 99 others); Sun, 2 Apr 2023 19:53:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230299AbjDBXxa (ORCPT ); Sun, 2 Apr 2023 19:53:30 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EC03A26A for ; Sun, 2 Apr 2023 16:53:29 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 8C6C5612AF for ; Sun, 2 Apr 2023 23:53:28 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6882CC433EF; Sun, 2 Apr 2023 23:53:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1680479608; bh=zxrbVz61l15V8rpjrWR/yAZucRlfOGPOwL7NhSw3bMI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=l+vTChPUE33q/wdeQ27LvPylZnBcv4j4qjHtMUoA8vOVQSWqcrFpsWWizkj38nRhZ FiCbkjKQzcnWIQTxox79TlU/LVCjJ3trsADj4gXwjOG/xiRTDo8yxr9xuasl2rTwu7 qZwGFb/9eCx0Segx/ZXFZ8H1XDqvJYjk0WPIj7W/vy28/nC6V51vUD2jabB/AcaGiu 1467S+ooSe+hgkrgNHfmi2vyStwUODvWJEGMLvRq1YeiVRJmEfPEWwlCRLZibWSO27 BDaxYXCvty1eLYaF8ZVUZ+frGqrgaN8HiR8Jb0iFaOUc3GnAux5B/Co/fd+OMs2WDP ousNcvG5mw8WQ== Date: Sun, 2 Apr 2023 16:53:25 -0700 From: Nathan Chancellor To: Rob Clark Cc: dri-devel@lists.freedesktop.org, Rob Clark , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , open list Subject: Re: [PATCH] drm/vblank: Fix for drivers that do not drm_vblank_init() Message-ID: <20230402235325.GA1068285@dev-arch.thelio-3990X> References: <20230401153802.1066072-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230401153802.1066072-1-robdclark@gmail.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 01, 2023 at 08:38:02AM -0700, Rob Clark wrote: > From: Rob Clark > > This should fix a crash that was reported on ast (and possibly other > drivers which do not initialize vblank). > > fbcon: Taking over console > Unable to handle kernel NULL pointer dereference at virtual address 0000000000000074 > Mem abort info: > ESR = 0x0000000096000004 > EC = 0x25: DABT (current EL), IL = 32 bits > SET = 0, FnV = 0 > EA = 0, S1PTW = 0 > FSC = 0x04: level 0 translation fault > Data abort info: > ISV = 0, ISS = 0x00000004 > CM = 0, WnR = 0 > user pgtable: 4k pages, 48-bit VAs, pgdp=0000080009d16000 > [0000000000000074] pgd=0000000000000000, p4d=0000000000000000 > Internal error: Oops: 0000000096000004 [#1] SMP > Modules linked in: ip6table_nat tun nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 rfkill ip_set nf_tables nfnetlink qrtr sunrpc binfmt_misc vfat fat xfs snd_usb_audio snd_hwdep snd_usbmidi_lib snd_seq snd_pcm snd_rawmidi snd_timer snd_seq_device snd soundcore joydev mc ipmi_ssif ipmi_devintf ipmi_msghandler arm_spe_pmu arm_cmn arm_dsu_pmu arm_dmc620_pmu cppc_cpufreq loop zram crct10dif_ce polyval_ce nvme polyval_generic ghash_ce sbsa_gwdt igb nvme_core ast nvme_common i2c_algo_bit xgene_hwmon gpio_dwapb scsi_dh_rdac scsi_dh_emc scsi_dh_alua ip6_tables ip_tables dm_multipath fuse > CPU: 12 PID: 469 Comm: kworker/12:1 Not tainted 6.3.0-rc2-00008-gd39e48ca80c0 #1 > Hardware name: ADLINK AVA Developer Platform/AVA Developer Platform, BIOS TianoCore 2.04.100.07 (SYS: 2.06.20220308) 09/08/2022 > Workqueue: events fbcon_register_existing_fbs > pstate: 20400009 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) > pc : drm_crtc_next_vblank_start+0x2c/0x98 > lr : drm_atomic_helper_wait_for_fences+0x90/0x240 > sp : ffff80000d583960 > x29: ffff80000d583960 x28: ffff07ff8fc187b0 x27: 0000000000000000 > x26: ffff07ff99c08c00 x25: 0000000000000038 x24: ffff07ff99c0c000 > x23: 0000000000000001 x22: 0000000000000038 x21: 0000000000000000 > x20: ffff07ff9640a280 x19: 0000000000000000 x18: ffffffffffffffff > x17: 0000000000000000 x16: ffffb24d2eece1c0 x15: 0000003038303178 > x14: 3032393100000048 x13: 0000000000000000 x12: 0000000000000000 > x11: 0000000000000000 x10: 0000000000000000 x9 : ffffb24d2eeeaca0 > x8 : ffff80000d583628 x7 : 0000080077783000 x6 : 0000000000000000 > x5 : ffff80000d584000 x4 : ffff07ff99c0c000 x3 : 0000000000000130 > x2 : 0000000000000000 x1 : ffff80000d5839c0 x0 : ffff07ff99c0cc08 > Call trace: > drm_crtc_next_vblank_start+0x2c/0x98 > drm_atomic_helper_wait_for_fences+0x90/0x240 > drm_atomic_helper_commit+0xb0/0x188 > drm_atomic_commit+0xb0/0xf0 > drm_client_modeset_commit_atomic+0x218/0x280 > drm_client_modeset_commit_locked+0x64/0x1a0 > drm_client_modeset_commit+0x38/0x68 > __drm_fb_helper_restore_fbdev_mode_unlocked+0xb0/0xf8 > drm_fb_helper_set_par+0x44/0x88 > fbcon_init+0x1e0/0x4a8 > visual_init+0xbc/0x118 > do_bind_con_driver.isra.0+0x194/0x3a0 > do_take_over_console+0x50/0x70 > do_fbcon_takeover+0x74/0xf8 > do_fb_registered+0x13c/0x158 > fbcon_register_existing_fbs+0x78/0xc0 > process_one_work+0x1ec/0x478 > worker_thread+0x74/0x418 > kthread+0xec/0x100 > ret_from_fork+0x10/0x20 > Code: f9400004 b9409013 f940a082 9ba30a73 (b9407662) > ---[ end trace 0000000000000000 ]--- > > Reported-by: Nathan Chancellor > Fixes: d39e48ca80c0 ("drm/atomic-helper: Set fence deadline for vblank") > Signed-off-by: Rob Clark Seems to work for me, I no longer see the above crash. Tested-by: Nathan Chancellor > --- > drivers/gpu/drm/drm_vblank.c | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c > index 299fa2a19a90..e98e3cefba3a 100644 > --- a/drivers/gpu/drm/drm_vblank.c > +++ b/drivers/gpu/drm/drm_vblank.c > @@ -996,10 +996,16 @@ EXPORT_SYMBOL(drm_crtc_vblank_count_and_time); > int drm_crtc_next_vblank_start(struct drm_crtc *crtc, ktime_t *vblanktime) > { > unsigned int pipe = drm_crtc_index(crtc); > - struct drm_vblank_crtc *vblank = &crtc->dev->vblank[pipe]; > - struct drm_display_mode *mode = &vblank->hwmode; > + struct drm_vblank_crtc *vblank; > + struct drm_display_mode *mode; > u64 vblank_start; > > + if (!crtc->dev->vblank) > + return -EINVAL; > + > + vblank = &crtc->dev->vblank[pipe]; > + mode = &vblank->hwmode; > + > if (!vblank->framedur_ns || !vblank->linedur_ns) > return -EINVAL; > > -- > 2.39.2 >