Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2069555pxa; Fri, 7 Aug 2020 02:14:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw92+XBkYeANmTxgkKK5JrUb/iKEXKFKjU3u/BXaWAyVaShzlGS58AoLCCn1fPy4WFM1t1s X-Received: by 2002:a17:906:a116:: with SMTP id t22mr8616821ejy.353.1596791648286; Fri, 07 Aug 2020 02:14:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596791648; cv=none; d=google.com; s=arc-20160816; b=D7yFwRi4P2H17SM0/04gqseZV89HON/ZVXWLeuLALEIe/a6fr4/0XZl9zkfz0S4uAW +KvCsDSbIR75IxIvT5KccgWyTY+3WNKIRmuk3+NeNrLSDEBJRQai+G+sVxYcob6yNxY1 uiUMbPPSxRkCUkyOg6VGvz2Cq/ha6ydMowiFzy6lfazkp5IXw4D44Ty2dvYIv3mP5NKA QKzpzdx8bJOHmgJQ9hdT+Rs24jd2281M5HmKMbiKoEklt8mDpoIlhPYR6ZB9vpt9pHIy Lb+h6G0U31piaJzWnWNBcaNopGJm0rFq3huYB/r/XaSJkCmex9LBiDw9N5oW7e21Hiql K+gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:mail-followup-to:message-id:subject:cc:to :from:date:dkim-signature; bh=yIduASxOSE1is+l6ba3Ib+q/uSjP1gWsCSN6YMU1MGM=; b=KdriEfg1rekkA5HqNb7OmuA6OauVps4SgaKb6McVb4zxLSX0HKU5DIlMcXTnXssjAW v1aD9mgex70qvdonO/L0MGkmB2JLJugHUvew2q+r06dtwWqWAyDqec36Jrr1iGt/3Px+ PCV5YAgaUAtKY06cdfZn+G6KJiavg6En5h+OhlOdU9GHA6SnWOeggr3j4lhW4kwrXnsu QkaB92FjS1Rv8ETyA5L3IbqzNirswJSA4n3bZs+Cx8Qa0mMJM5PUl8gjLAqbGd7gcC72 +MISsDllPIZgm3VODFeer9Iah93p0Tsye4bVQPxGT9qMXivs1doMeMvj/leC4rXrVgzc mdfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=JQwvG7SK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l7si4797380edv.475.2020.08.07.02.13.44; Fri, 07 Aug 2020 02:14:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@ffwll.ch header.s=google header.b=JQwvG7SK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726932AbgHGJKw (ORCPT + 99 others); Fri, 7 Aug 2020 05:10:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726721AbgHGJKv (ORCPT ); Fri, 7 Aug 2020 05:10:51 -0400 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE0A9C061574 for ; Fri, 7 Aug 2020 02:10:48 -0700 (PDT) Received: by mail-wr1-x443.google.com with SMTP id f1so1002168wro.2 for ; Fri, 07 Aug 2020 02:10:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=yIduASxOSE1is+l6ba3Ib+q/uSjP1gWsCSN6YMU1MGM=; b=JQwvG7SK70jkxfMfT30/3cNZrD0PDGXLYYzyABgNj0q59whRkvEyofQ6QxfiRLcKn6 nO/Klfw7scX4KxlZij3JbF8aLOT94AYvbbF9BQq/2dIQsWwnJLd4is1d2M0gDhQOEYdy CXn5QDUOLpAVJvt/ZTysbRcCVI8yutvfQQ/00= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=yIduASxOSE1is+l6ba3Ib+q/uSjP1gWsCSN6YMU1MGM=; b=p1QZG9xBpDDSH9mhvXmkMYmaTVPblwbF6rsY4/dtZdWOR8tUDhfZ36DSx7ousJST2R vq/Ta/5weHHPyjVvH9/kC3qS39qIFJTTOhmQA8TsaG9n7oLKyb1GugHfhpb/r3Hcro22 +VyiTm3TrXL1VCHLf2POLXaWASJ6J+qWR2nVfAedhAeFJdMochZL6UNIrnui1NX7cu6o 0Y7nIsMoILOxXp1uaUURoJLAhUn701VBrDdVUC6OM7MR+s8T8Dk9e0TErNXHEiL32M59 8NXrj2rrxFq9hBggBo+k5UCqyzd8XBjg1wHCGMfwv3RMMN4A6axQ0DSn0ELkoa5UbhE4 YIZw== X-Gm-Message-State: AOAM532PqvVaCAbAr5gmAfNROz36THdELFoUp8fiMgU2XgJhH9WzftaF lF7LnHeO6gMzfPdyH16YEqV38A== X-Received: by 2002:a5d:6a41:: with SMTP id t1mr10202625wrw.388.1596791446966; Fri, 07 Aug 2020 02:10:46 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id c15sm9291026wme.23.2020.08.07.02.10.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Aug 2020 02:10:46 -0700 (PDT) Date: Fri, 7 Aug 2020 11:10:44 +0200 From: Daniel Vetter To: Melissa Wen Cc: Rodrigo Siqueira , Haneen Mohammed , Daniel Vetter , David Airlie , Rodrigo Siqueira , Sidong Yang , twoerner@gmail.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com Subject: Re: [PATCH v2] drm/vkms: guarantee vblank when capturing crc Message-ID: <20200807091044.GB2352366@phenom.ffwll.local> Mail-Followup-To: Melissa Wen , Rodrigo Siqueira , Haneen Mohammed , David Airlie , Rodrigo Siqueira , Sidong Yang , twoerner@gmail.com, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, kernel-usp@googlegroups.com References: <20200806111705.xebopzucxr3367z4@smtp.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200806111705.xebopzucxr3367z4@smtp.gmail.com> X-Operating-System: Linux phenom 5.7.0-1-amd64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Aug 06, 2020 at 08:17:05AM -0300, Melissa Wen wrote: > VKMS needs vblank interrupts enabled to capture CRC. When vblank is > disabled, tests like kms_cursor_crc and kms_pipe_crc_basic getting stuck > waiting for a capture that will not occur until vkms wakes up. This patch > adds a helper to set composer and ensure that vblank remains enabled as > long as the CRC capture is needed. > > It clears the execution of the following kms_cursor_crc subtests: > 1. pipe-A-cursor-[size,alpha-opaque, NxN-(on-screen, off-screen, sliding, > random, fast-moving])] - successful when running individually. > 2. pipe-A-cursor-dpms passes again > 3. pipe-A-cursor-suspend also passes > > The issue was initially tracked in the sequential execution of IGT > kms_cursor_crc subtest: when running the test sequence or one of its > subtests twice, the odd execs complete and the pairs get stuck in an > endless wait. In the IGT code, calling a wait_for_vblank on preparing for > CRC capture prevented the busy-wait. But the problem persisted in the > pipe-A-cursor-dpms and -suspend subtests. > > Checking the history, the pipe-A-cursor-dpms subtest was successful when, > in vkms_atomic_commit_tail, instead of using the flip_done op, it used > wait_for_vblanks. Another way to prevent blocking was wait_one_vblank when > enabling crtc. However, in both cases, pipe-A-cursor-suspend persisted > blocking in the 2nd start of CRC capture, which may indicate that > something got stuck in the step of CRC setup. Indeed, wait_one_vblank in > the crc setup was able to sync things and free all kms_cursor_crc > subtests. Besides, other alternatives to force enabling vblanks or prevent > disabling them such as calling drm_crtc_put_vblank or modeset_enables > before commit_planes + offdelay = 0, also unlock all subtests executions. > > Finally, due to vkms's dependence on vblank interruptions to perform > tasks, this patch uses refcount to ensure that vblanks happen when > enabling composer and while crc capture is needed. For next time around, please include a patch changelog here so people know what was changed, and why. E.g. v2: - extract a vkms_set_composer helper - fix vblank refcounting for the disabling case > > Cc: Rodrigo Siqueira > Cc: Haneen Mohammed > Co-developed-by: Sidong Yang > Signed-off-by: Sidong Yang > Co-developed-by: Daniel Vetter > Signed-off-by: Daniel Vetter Nah that's a bit too much credit for me, I'll get the r-b tag. You & Sidong figured this story out, so I'd use Co-debugged-by: Sidong here for credits. > Signed-off-by: Melissa Wen > --- > drivers/gpu/drm/vkms/vkms_composer.c | 20 +++++++++++++++++--- > drivers/gpu/drm/vkms/vkms_drv.h | 1 + > 2 files changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/vkms/vkms_composer.c b/drivers/gpu/drm/vkms/vkms_composer.c > index b8b060354667..e2ac2b9759bf 100644 > --- a/drivers/gpu/drm/vkms/vkms_composer.c > +++ b/drivers/gpu/drm/vkms/vkms_composer.c > @@ -233,6 +233,22 @@ int vkms_verify_crc_source(struct drm_crtc *crtc, const char *src_name, > return 0; > } > > +void vkms_set_composer(struct vkms_output *out, bool enabled) Since this isn't yet used outside of this file I'd just make this static. Writeback connector support can then add the prototype in the header. With that Reviewed-by: Daniel Vetter Please include that tag for revision 3. Cheers, Daniel > +{ > + bool old_enabled; > + > + if (enabled) > + drm_crtc_vblank_get(&out->crtc); > + > + spin_lock_irq(&out->lock); > + old_enabled = out->composer_enabled; > + out->composer_enabled = enabled; > + spin_unlock_irq(&out->lock); > + > + if (old_enabled) > + drm_crtc_vblank_put(&out->crtc); > +} > + > int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name) > { > struct vkms_output *out = drm_crtc_to_vkms_output(crtc); > @@ -241,9 +257,7 @@ int vkms_set_crc_source(struct drm_crtc *crtc, const char *src_name) > > ret = vkms_crc_parse_source(src_name, &enabled); > > - spin_lock_irq(&out->lock); > - out->composer_enabled = enabled; > - spin_unlock_irq(&out->lock); > + vkms_set_composer(out, enabled); > > return ret; > } > diff --git a/drivers/gpu/drm/vkms/vkms_drv.h b/drivers/gpu/drm/vkms/vkms_drv.h > index f4036bb0b9a8..2cc86d08bd4e 100644 > --- a/drivers/gpu/drm/vkms/vkms_drv.h > +++ b/drivers/gpu/drm/vkms/vkms_drv.h > @@ -142,6 +142,7 @@ int vkms_verify_crc_source(struct drm_crtc *crtc, const char *source_name, > size_t *values_cnt); > > /* Composer Support */ > +void vkms_set_composer(struct vkms_output *output, bool enabled); > void vkms_composer_worker(struct work_struct *work); > > #endif /* _VKMS_DRV_H_ */ > -- > 2.27.0 > -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch