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=-10.0 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 1433AC433E2 for ; Tue, 1 Sep 2020 05:44:05 +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 D28992098B for ; Tue, 1 Sep 2020 05:44:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="m7foSojz"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="QfisIazd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D28992098B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org 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=grQjQUIIxR2YjzAqcr1pGUd6QVrd+/buR2qbN3H36Ik=; b=m7foSojzfoYWdMsBLLxFg8VpY Q0uqVhuB/BSJCADc0+3rGn4QSKORFJl1yD6P8Ljp7qQ4lwlw9LgT8RciKs/xBcXe7eWNjRCm9zwKs TP8QSo0RiAFJEdW1RGrh/ycQP1OVSUTzrrQrdHPQyakkkkjuOJqRg8KzAClSapIaCq4CSmoMKGwny +P+/88uAi8EkbtqjJw3llzh5afMODpQFXMJprmE5iVH2Z4x/kLMLnLNwKtgHnrvfVSbHj1qjZ8zk9 nSPX+XJVuEJHui+XziCebscayoofgsg4mEO+VxZKXaFTKLaoOytFDKbFZFeJfg0kWA2XH9mxFP5Rx C7/KLbzMg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCz3y-0000ih-7W; Tue, 01 Sep 2020 05:42:34 +0000 Received: from mail-qv1-xf42.google.com ([2607:f8b0:4864:20::f42]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kCz3w-0000iK-4R for linux-arm-kernel@lists.infradead.org; Tue, 01 Sep 2020 05:42:33 +0000 Received: by mail-qv1-xf42.google.com with SMTP id j10so7164qvk.11 for ; Mon, 31 Aug 2020 22:42:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=iGwUze2oGaJp8e7svDfyTEoxtCcK4dtRTXC+KcGij48=; b=QfisIazdqtTMNcoNEj0SZAReR2Pmf9qYrfEfbMonwSdEIA+7Dm9UminlBVvpKsDzQz ooApTWc7bJW1z5pJvKoZRm84JVjAFwpEFPLHCpp1LiPVEqCmoZHUb2nULe4GROFMFwoh I54TqoMJB0ewdpQDbp9U7wOfPA+BzG4yfQ4f0X35RQOYiAwQVz1FxsJKxf/kh306qN8x RwjkLSOhYHvD0QWaRZtJMYYJmaBR7W6HDqzfjOXfTAtuGqCB3Pvhz/h2c8MGfBGJziP9 SfadU0eVMulNjZHEoD1OQLXkTLzbtdQFdunvmu8vMx2ep20SGcptpomomxA8Vnr57aH1 5osA== 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=iGwUze2oGaJp8e7svDfyTEoxtCcK4dtRTXC+KcGij48=; b=oA42+W5PpX7cpTj0KjOjvhk5C1nUmb/+4/89i7qSUbJLiHGELaVHGPZJDHOzw9LFNE Rvas2kQNeoyu8D4RMySdq/J3+eKXMIWYRO16CMuaefsRrom+AXekzj7oO7jYEZayDsSk NLgIQ7ZZh69En9TdIjkfDGJpG0FE0Zzldqx/jRPbVE9BeMolcaKnIfFrcm/1trTaIRxo RWxN4WxSZg1DszxPjVWo3MaqpP/OEzDUMUh53wtwJTBdvT2PL6zdUzdmVBNnEGddCQeE /x9iHcw6nwwAGr9LvCMfWlmeXrXavArNqH9bQANgYRgt59QCdnSc1IVd2CWYP/+PegfR U0vg== X-Gm-Message-State: AOAM532RWSRM/QoXgczRbjFGw4jENpOft4b6vCvzGyOYICXWHbaER/lC T0AtkWkn8UMhcnnedzTQVKo0oA== X-Google-Smtp-Source: ABdhPJxBeU18wZYbq6a0ep/R0bjilgWJcbebj3mDIgOZ/cwdY+tof6zfyzvZNJhxFh1hmNJtAPCKEQ== X-Received: by 2002:a0c:ca87:: with SMTP id a7mr330935qvk.17.1598938949857; Mon, 31 Aug 2020 22:42:29 -0700 (PDT) Received: from uller (ec2-34-197-84-77.compute-1.amazonaws.com. [34.197.84.77]) by smtp.gmail.com with ESMTPSA id o25sm346909qkm.42.2020.08.31.22.42.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Aug 2020 22:42:29 -0700 (PDT) Date: Tue, 1 Sep 2020 05:42:27 +0000 From: Bjorn Andersson To: Rob Clark Subject: Re: [PATCH 01/19] drm/msm: remove dangling submitqueue references Message-ID: <20200901054227.GB54956@uller> References: <20200810222657.1841322-1-jcrouse@codeaurora.org> <20200814024114.1177553-2-robdclark@gmail.com> <20200901023517.GA54956@uller> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200901_014232_384246_C14E9AD4 X-CRM114-Status: GOOD ( 29.74 ) 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: Rob Clark , Sai Prakash Ranjan , open list , Daniel Vetter , Will Deacon , David Airlie , linux-arm-msm , Joerg Roedel , Robin Murphy , dri-devel , Stephen Boyd , Sean Paul , "list@263.net:IOMMU DRIVERS , Joerg Roedel , " , Sibi Sankar , Vivek Gautam , freedreno , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" 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 Tue 01 Sep 03:42 UTC 2020, Rob Clark wrote: > On Mon, Aug 31, 2020 at 7:35 PM Bjorn Andersson > wrote: > > > > On Fri 14 Aug 02:40 UTC 2020, Rob Clark wrote: > > > > > From: Rob Clark > > > > > > Currently it doesn't matter, since we free the ctx immediately. But > > > when we start refcnt'ing the ctx, we don't want old dangling list > > > entries to hang around. > > > > > > Signed-off-by: Rob Clark > > > --- > > > drivers/gpu/drm/msm/msm_submitqueue.c | 4 +++- > > > 1 file changed, 3 insertions(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/msm/msm_submitqueue.c b/drivers/gpu/drm/msm/msm_submitqueue.c > > > index a1d94be7883a..90c9d84e6155 100644 > > > --- a/drivers/gpu/drm/msm/msm_submitqueue.c > > > +++ b/drivers/gpu/drm/msm/msm_submitqueue.c > > > @@ -49,8 +49,10 @@ void msm_submitqueue_close(struct msm_file_private *ctx) > > > * No lock needed in close and there won't > > > * be any more user ioctls coming our way > > > */ > > > - list_for_each_entry_safe(entry, tmp, &ctx->submitqueues, node) > > > + list_for_each_entry_safe(entry, tmp, &ctx->submitqueues, node) { > > > + list_del(&entry->node); > > > > If you refcount ctx, what does that do for the entries in the submit > > queue? > > > > "entry" here is kref'ed, but you're popping it off the list regardless > > of the put ends up freeing the object or not - which afaict would mean > > leaking the object. > > > > What ends up happening is the submit has reference to submit-queue, > which has reference to the ctx.. the submitqueue could be alive still > pending in-flight submits (in a later patch), but dead from the PoV of > userspace interface. > > We aren't relying (or at least aren't in the end, and I *think* I > didn't miss anything in the middle) relying on ctx->submitqueues list > to clean anything up in the end, just track what is still a valid > submitqueue from userspace PoV > Looks reasonable, thanks for the explanation. > BR, > -R > > > > > On the other hand, with the current implementation an object with higher > > refcount with adjacent objects of single refcount would end up with > > dangling pointers after the put. So in itself this change seems like a > > net gain, but I'm wondering about the plan described in the commit > > message. > > > > Regards, > > Bjorn > > > > > msm_submitqueue_put(entry); > > > + } > > > } > > > > > > int msm_submitqueue_create(struct drm_device *drm, struct msm_file_private *ctx, > > > -- > > > 2.26.2 > > > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel