From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.9 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 22E56C433E1 for ; Sun, 26 Jul 2020 10:26:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EF757206D8 for ; Sun, 26 Jul 2020 10:26:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="PHf0VFLD" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727090AbgGZK0U (ORCPT ); Sun, 26 Jul 2020 06:26:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725960AbgGZK0U (ORCPT ); Sun, 26 Jul 2020 06:26:20 -0400 Received: from mail-ot1-x341.google.com (mail-ot1-x341.google.com [IPv6:2607:f8b0:4864:20::341]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 47974C0619D2 for ; Sun, 26 Jul 2020 03:26:20 -0700 (PDT) Received: by mail-ot1-x341.google.com with SMTP id n24so10208979otr.13 for ; Sun, 26 Jul 2020 03:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k2Fq4D+MVaPvOwyYejkASFNE/Fbxf9pO3/22f+1eVLs=; b=PHf0VFLDhl6XKmXhQHgwoYrMD2qxUGTx/e7U1VrDSzvUSNGyFfFVxoNihxoInyIPuw Su6+h1XQunxpBb9kezEWJX+oB5gKajxzh71pifMnMo7PgJ13V276+jHKCiZvJ4nbe3DC WhxaaPD2cSTrMa0YukAZhZl3//fYQPKxx9X+0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k2Fq4D+MVaPvOwyYejkASFNE/Fbxf9pO3/22f+1eVLs=; b=oLOon7cuL4WcmdXH8Nb92xAstOAHeqdgNW59Z9egu6ay4cfd52Y6I2GLiNqnbs2hKZ Lhaw1hKHgNsIonessxtYeKS29F5IhZjWvqHtnkODU3SUjammQNIQOpOIDXDa5m7JI5LV 3ar5oZR/Mvn8GJETlHrja4Qb95qVenmskPBlawmWDCJ02ebje13NyQWAqnqqRH/3LmUA lfYjTXVuwDRV5X2kwgod+frkx9Of2pnKz3C6I9qOUq06gw+aIh2goCSJPT6QjWN0RiCB zBLikR8qtU9jHCe59vu/VxT5NeM7WN9brhO7wYEUamMThYkq2vGEhrWOmGJ08Qe6S0Py mAkA== X-Gm-Message-State: AOAM533L+4brzEcpDRpzp2xd2O4JhaGRZC4S0GqxOlLLkKTCFjzr4xk1 y8CAx/lsXMm8cTSVUUQShC9oR8DOLmYPwdTd1DDQ9Q== X-Google-Smtp-Source: ABdhPJyZhUQ4Fh4nXvfvrvS+6faPmS0iTsYPW5EqoFSiJT1LIF7mkGiZ0BnwJrnHpkOv/j9qN/tXoeCLJ3hT0Evvxos= X-Received: by 2002:a05:6830:1613:: with SMTP id g19mr15498856otr.303.1595759179525; Sun, 26 Jul 2020 03:26:19 -0700 (PDT) MIME-Version: 1.0 References: <20200722110411.ebkv6knvc6mzw5uf@smtp.gmail.com> <20200722120502.GK6419@phenom.ffwll.local> <20200722140604.27dfzfnzug5vb75r@smtp.gmail.com> <20200725011737.GA2851@realwakka> <20200725174514.esh4gqek6oddizvh@smtp.gmail.com> <20200725184918.togb54bxuifrq77c@smtp.gmail.com> In-Reply-To: From: Daniel Vetter Date: Sun, 26 Jul 2020 12:26:08 +0200 Message-ID: Subject: Re: [PATCH] drm/vkms: add missing drm_crtc_vblank_put to the get/put pair on flush To: Melissa Wen Cc: Sidong Yang , Haneen Mohammed , Rodrigo Siqueira , David Airlie , Rodrigo Siqueira , Linux Kernel Mailing List , dri-devel , kernel-usp@googlegroups.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 25, 2020 at 9:29 PM Melissa Wen wrote: > > On Sat, Jul 25, 2020 at 4:19 PM Melissa Wen wrote: > > > > > No, this very first warning continues (only once) :( > > > From here (drm_crtc_vblank_on): > > > if (atomic_read(&vblank->refcount) != 0 || drm_vblank_offdelay == 0) > > > drm_WARN_ON(dev, drm_vblank_enable(dev, pipe)); > > > > Sorry, not sure when this warning is triggered. > > Again, I just had to look at the trace: > [ 52.299388] drm_get_last_vbltimestamp+0xaa/0xc0 [drm] > [ 52.299389] drm_reset_vblank_timestamp+0x5b/0xd0 [drm] > [ 52.299389] drm_crtc_vblank_on.cold+0x37/0x103 [drm] > [ 52.299390] drm_atomic_helper_commit_modeset_enable Yeah I think vkms can't generate a reasonable timestamp when the hrtimer is off. I thought the warning comes from a different callchain, but seems to be a general problem. I guess in the vkms timestamp function we should check whether the timer is running, and if it's not running, then we just grab the current time and done. -Daniel > > > > > > > > > But I'm still wondering why after step 3 we don't get -EINVAL from > > > > vblank_get() - after vblank_off() vblank->enabled should be false > > > > again, getting us back to the same state as after 1. Is that not > > > > happening? > > > > > > Yes (sorry if it got confused), we got -EINVAL after setp 3: > > > > > > In step 3, at the end of the 2nd running, we have: > > > atomic_disable > > > --> vblank_off [!vblank->inmodeset + refcount going 0->1 + inmodeset=1] > > > and then in next vblank_get: -EINVAL (!vblank->enabled + refcount ends 1) > > > as in the first step. > > > > > > Melissa > > > > > > > -Daniel > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > -Sidong > > > > > > > > > > > > > > > > > > > > > > > > > > > > crtc->state->event = NULL; > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > 2.27.0 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > Daniel Vetter > > > > > > > > > > Software Engineer, Intel Corporation > > > > > > > > > > http://blog.ffwll.ch > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > Daniel Vetter > > > > > > > > Software Engineer, Intel Corporation > > > > > > > > http://blog.ffwll.ch > > > > > > > > _______________________________________________ > > > > > > > > dri-devel mailing list > > > > > > > > dri-devel@lists.freedesktop.org > > > > > > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Daniel Vetter > > > > > > Software Engineer, Intel Corporation > > > > > > http://blog.ffwll.ch > > > > > > > > > > > > > > > > -- > > > > Daniel Vetter > > > > Software Engineer, Intel Corporation > > > > http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8ECEAC433E1 for ; Sun, 26 Jul 2020 10:26:23 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D9F6206D8 for ; Sun, 26 Jul 2020 10:26:22 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="PHf0VFLD" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D9F6206D8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9922F89F3B; Sun, 26 Jul 2020 10:26:21 +0000 (UTC) Received: from mail-ot1-x342.google.com (mail-ot1-x342.google.com [IPv6:2607:f8b0:4864:20::342]) by gabe.freedesktop.org (Postfix) with ESMTPS id 49B6E89F3B for ; Sun, 26 Jul 2020 10:26:20 +0000 (UTC) Received: by mail-ot1-x342.google.com with SMTP id v21so2953280otj.9 for ; Sun, 26 Jul 2020 03:26:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=k2Fq4D+MVaPvOwyYejkASFNE/Fbxf9pO3/22f+1eVLs=; b=PHf0VFLDhl6XKmXhQHgwoYrMD2qxUGTx/e7U1VrDSzvUSNGyFfFVxoNihxoInyIPuw Su6+h1XQunxpBb9kezEWJX+oB5gKajxzh71pifMnMo7PgJ13V276+jHKCiZvJ4nbe3DC WhxaaPD2cSTrMa0YukAZhZl3//fYQPKxx9X+0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=k2Fq4D+MVaPvOwyYejkASFNE/Fbxf9pO3/22f+1eVLs=; b=c54MskrbfikAl+dplLduzxa/l1pOHELSi7BxVUSWFskz4Sk0nAM36ocv5lLSVh4oY8 LZ5tMXkI/7RMqbTgcagJMlctbU+UUs9TArCPCkM1GAmxMcO7OxCESnKusE8tO2JZYmnT /klBvJoFRsxSBXr/O1neMbaniOAX1VbIEJwnnNWaApsF5b+jdq7+GT53RcLtgAEpT9Vf V7l0kZBETWD+biD4AvJIS7/cmhEe6qZCJRN0JdWMD8IJXpqmRGDY7TY0pr/+8AcQoNK2 pe7VUEErb6uakf9J0qWxvyN/j5lyoL6kx1MBX/PUVynNzoqGEtT2B0nrZN+NHR+5K3za VSHA== X-Gm-Message-State: AOAM531Y6FNZYAXO3TSmR73ihZMK4hsKUPHAagNDKuEpr9qIB5m3q1pm QPmschI887TqyOPQxfWEUcTf7a8jdsK3QiJ6DjhhHw== X-Google-Smtp-Source: ABdhPJyZhUQ4Fh4nXvfvrvS+6faPmS0iTsYPW5EqoFSiJT1LIF7mkGiZ0BnwJrnHpkOv/j9qN/tXoeCLJ3hT0Evvxos= X-Received: by 2002:a05:6830:1613:: with SMTP id g19mr15498856otr.303.1595759179525; Sun, 26 Jul 2020 03:26:19 -0700 (PDT) MIME-Version: 1.0 References: <20200722110411.ebkv6knvc6mzw5uf@smtp.gmail.com> <20200722120502.GK6419@phenom.ffwll.local> <20200722140604.27dfzfnzug5vb75r@smtp.gmail.com> <20200725011737.GA2851@realwakka> <20200725174514.esh4gqek6oddizvh@smtp.gmail.com> <20200725184918.togb54bxuifrq77c@smtp.gmail.com> In-Reply-To: From: Daniel Vetter Date: Sun, 26 Jul 2020 12:26:08 +0200 Message-ID: Subject: Re: [PATCH] drm/vkms: add missing drm_crtc_vblank_put to the get/put pair on flush To: Melissa Wen X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Haneen Mohammed , Rodrigo Siqueira , David Airlie , Rodrigo Siqueira , Linux Kernel Mailing List , dri-devel , kernel-usp@googlegroups.com, Sidong Yang Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Sat, Jul 25, 2020 at 9:29 PM Melissa Wen wrote: > > On Sat, Jul 25, 2020 at 4:19 PM Melissa Wen wrote: > > > > > No, this very first warning continues (only once) :( > > > From here (drm_crtc_vblank_on): > > > if (atomic_read(&vblank->refcount) != 0 || drm_vblank_offdelay == 0) > > > drm_WARN_ON(dev, drm_vblank_enable(dev, pipe)); > > > > Sorry, not sure when this warning is triggered. > > Again, I just had to look at the trace: > [ 52.299388] drm_get_last_vbltimestamp+0xaa/0xc0 [drm] > [ 52.299389] drm_reset_vblank_timestamp+0x5b/0xd0 [drm] > [ 52.299389] drm_crtc_vblank_on.cold+0x37/0x103 [drm] > [ 52.299390] drm_atomic_helper_commit_modeset_enable Yeah I think vkms can't generate a reasonable timestamp when the hrtimer is off. I thought the warning comes from a different callchain, but seems to be a general problem. I guess in the vkms timestamp function we should check whether the timer is running, and if it's not running, then we just grab the current time and done. -Daniel > > > > > > > > > But I'm still wondering why after step 3 we don't get -EINVAL from > > > > vblank_get() - after vblank_off() vblank->enabled should be false > > > > again, getting us back to the same state as after 1. Is that not > > > > happening? > > > > > > Yes (sorry if it got confused), we got -EINVAL after setp 3: > > > > > > In step 3, at the end of the 2nd running, we have: > > > atomic_disable > > > --> vblank_off [!vblank->inmodeset + refcount going 0->1 + inmodeset=1] > > > and then in next vblank_get: -EINVAL (!vblank->enabled + refcount ends 1) > > > as in the first step. > > > > > > Melissa > > > > > > > -Daniel > > > > > > > > > > > > > > > > > > > > > > > Thanks > > > > > > > -Sidong > > > > > > > > > > > > > > > > > > > > > > > > > > > > crtc->state->event = NULL; > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > 2.27.0 > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > Daniel Vetter > > > > > > > > > > Software Engineer, Intel Corporation > > > > > > > > > > http://blog.ffwll.ch > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > Daniel Vetter > > > > > > > > Software Engineer, Intel Corporation > > > > > > > > http://blog.ffwll.ch > > > > > > > > _______________________________________________ > > > > > > > > dri-devel mailing list > > > > > > > > dri-devel@lists.freedesktop.org > > > > > > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > Daniel Vetter > > > > > > Software Engineer, Intel Corporation > > > > > > http://blog.ffwll.ch > > > > > > > > > > > > > > > > -- > > > > Daniel Vetter > > > > Software Engineer, Intel Corporation > > > > http://blog.ffwll.ch -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel