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=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 0C69BC55179 for ; Fri, 30 Oct 2020 08:57:16 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 67B1320709 for ; Fri, 30 Oct 2020 08:57:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ruRu55AF"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=ffwll.ch header.i=@ffwll.ch header.b="YsJmlG/H" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 67B1320709 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=WLZ+7kfe+M9hcqVvRsi/zpxA76AlsgOaq5vIbuZaEvQ=; b=ruRu55AFEVK4MgTzejc8q1Ro0 v5KZ9Y8XPYr3EoWY9WZ27twalpyWW7y32LMiZgIJJ6BNiWumEb90IE6gox8is08PuWaf/67MK87AQ 3Gd8GxwTJLsOsJi1W9D1sNVZgbYp2K9O5vjpO+MJoEmktHeyje47D+qvo/opFyIi1UeKSkhQrPAqN Na++/UpNTo8sD1IHK6Wu/ASa487w3dm5eY+X6qFcvs1/1kXpvfHKUz7saTYSCFaXgaauku9iJUHvO 61C785XazMLT0glqH0O0e9vquQXcQbvEDmAzTOtbUV+LgzrMPKpXodKwcQt4Ach2QANxVJuFNz6Qs /GKfZkOFA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYQDE-0001WU-DU; Fri, 30 Oct 2020 08:56:44 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kYQDA-0001V6-SN for linux-arm-kernel@lists.infradead.org; Fri, 30 Oct 2020 08:56:42 +0000 Received: by mail-wr1-x444.google.com with SMTP id k10so4222722wrw.13 for ; Fri, 30 Oct 2020 01:56:40 -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:references:mime-version :content-disposition:in-reply-to; bh=Xv94TD+Wz+qFlHRj1eF6lW3RTboLo+eylNXU68uehyM=; b=YsJmlG/HFMVq7R+lbK2IEWG3q96YKjKj/hLgzUTHgVwiPqzEVm90HLnCSN9G23yaR4 ssaGW10qUoi1TuNNKkb/p1t3yVky44QhgQDcx7rDfMVPDAO+rdUe91NegZgg0HEiFUEf KnIRfBQjWh+OBO9Je3lj2PFU+KpSok7zUai88= 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:references :mime-version:content-disposition:in-reply-to; bh=Xv94TD+Wz+qFlHRj1eF6lW3RTboLo+eylNXU68uehyM=; b=NxogLlhFYlFzWIgDGrTgYeBgJVSWRRfIxWBLdbgrRM6PP/RRS770HB20+ig6Be0Ay4 Jy4HIO8RHSrw57ULBgoZg546ux6c+p/hlVXARmkZC3HyerOUWTdixm2xh66tm/+CfO9H SBm0EFMdhzvQpmmLX2+hIIonLf5h1n7Ulxs/nvBWelhSFpZYnv+FFbR7xaw8Pre1cUHl JXlNbmZXN1v80octZxiqFcWIg6uPYDL0ObjMJgiIm3Nyd7Fpu2Li7VTd11/Hkk0wwmxf h95cB2CNS8tT8oXEAd/mkImMS8EXupzveuj3qONvCcOcrFR8nmnXkG3erGIIICebsszK z+pA== X-Gm-Message-State: AOAM531bBgS+AydlaxFkz4NhhHYAlEBOU0PEgIMvfeHCymSkh9/UwI8b K5V0xsV9oi8Y2uEt6JvvRiMmvA== X-Google-Smtp-Source: ABdhPJxNn1cigfBNCeYCIIS95vkvY6bnlYXekZsr+B50SeqCxD/aT9YV0a6DdLhYLYSBVvpBQpyGrA== X-Received: by 2002:adf:ce8a:: with SMTP id r10mr1791976wrn.188.1604048199645; Fri, 30 Oct 2020 01:56:39 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id u3sm12640314wme.0.2020.10.30.01.56.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Oct 2020 01:56:38 -0700 (PDT) Date: Fri, 30 Oct 2020 09:56:36 +0100 From: Daniel Vetter To: Maxime Ripard Subject: Re: [PATCH 1/6] drm/vc4: bo: Add a managed action to cleanup the cache Message-ID: <20201030085636.GE401619@phenom.ffwll.local> References: <20201029190104.2181730-1-maxime@cerno.tech> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201029190104.2181730-1-maxime@cerno.tech> X-Operating-System: Linux phenom 5.7.0-1-amd64 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201030_045640_958383_0CB19D89 X-CRM114-Status: GOOD ( 23.12 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dave Stevenson , David Airlie , Maarten Lankhorst , dri-devel@lists.freedesktop.org, Eric Anholt , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, Thomas Zimmermann , Daniel Vetter , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Oct 29, 2020 at 08:00:59PM +0100, Maxime Ripard wrote: > The BO cache needs to be cleaned up using vc4_bo_cache_destroy, but it's > not used consistently (vc4_drv's bind calls it in its error path, but > doesn't in unbind), and we can make that automatic through a managed > action. Let's remove the requirement to call vc4_bo_cache_destroy. > > Fixes: c826a6e10644 ("drm/vc4: Add a BO cache.") > Signed-off-by: Maxime Ripard > --- > drivers/gpu/drm/vc4/vc4_bo.c | 5 +++-- > drivers/gpu/drm/vc4/vc4_drv.c | 1 - > drivers/gpu/drm/vc4/vc4_drv.h | 2 +- > 3 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c > index f432278173cd..730d5775ab42 100644 > --- a/drivers/gpu/drm/vc4/vc4_bo.c > +++ b/drivers/gpu/drm/vc4/vc4_bo.c > @@ -1024,6 +1024,7 @@ int vc4_get_tiling_ioctl(struct drm_device *dev, void *data, > return 0; > } > > +static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused); > int vc4_bo_cache_init(struct drm_device *dev) > { > struct vc4_dev *vc4 = to_vc4_dev(dev); > @@ -1052,10 +1053,10 @@ int vc4_bo_cache_init(struct drm_device *dev) > INIT_WORK(&vc4->bo_cache.time_work, vc4_bo_cache_time_work); > timer_setup(&vc4->bo_cache.time_timer, vc4_bo_cache_time_timer, 0); > > - return 0; > + return drmm_add_action(dev, vc4_bo_cache_destroy, NULL); I think you want drmm_add_action_or_reset here, same in the other patches. Otherwise if drmm_add_action fails, you leak the thing you just set up. -Daniel > } > > -void vc4_bo_cache_destroy(struct drm_device *dev) > +static void vc4_bo_cache_destroy(struct drm_device *dev, void *unused) > { > struct vc4_dev *vc4 = to_vc4_dev(dev); > int i; > diff --git a/drivers/gpu/drm/vc4/vc4_drv.c b/drivers/gpu/drm/vc4/vc4_drv.c > index 8f10f609e4f8..eb3fcd8232b5 100644 > --- a/drivers/gpu/drm/vc4/vc4_drv.c > +++ b/drivers/gpu/drm/vc4/vc4_drv.c > @@ -303,7 +303,6 @@ static int vc4_drm_bind(struct device *dev) > gem_destroy: > vc4_gem_destroy(drm); > drm_mode_config_cleanup(drm); > - vc4_bo_cache_destroy(drm); > dev_put: > drm_dev_put(drm); > return ret; > diff --git a/drivers/gpu/drm/vc4/vc4_drv.h b/drivers/gpu/drm/vc4/vc4_drv.h > index 836fdca5e643..3a989e8b39a2 100644 > --- a/drivers/gpu/drm/vc4/vc4_drv.h > +++ b/drivers/gpu/drm/vc4/vc4_drv.h > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -808,7 +809,6 @@ struct drm_gem_object *vc4_prime_import_sg_table(struct drm_device *dev, > struct sg_table *sgt); > void *vc4_prime_vmap(struct drm_gem_object *obj); > int vc4_bo_cache_init(struct drm_device *dev); > -void vc4_bo_cache_destroy(struct drm_device *dev); > int vc4_bo_inc_usecnt(struct vc4_bo *bo); > void vc4_bo_dec_usecnt(struct vc4_bo *bo); > void vc4_bo_add_to_purgeable_pool(struct vc4_bo *bo); > -- > 2.26.2 > > _______________________________________________ > 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel