Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3323213yba; Tue, 23 Apr 2019 01:33:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzeiuflmoIiwfjKynVvjFjB4ucx3QYTiIRulHY9rD46Mv6eFwMhTHvQsXQCElE5pILEF2gU X-Received: by 2002:a17:902:4101:: with SMTP id e1mr25476624pld.25.1556008382293; Tue, 23 Apr 2019 01:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556008382; cv=none; d=google.com; s=arc-20160816; b=GIeF+YhmjmHcUfpuIjiIsMKBRKo3x3xV5NVcYpPy35IlAgJUA0Ji1L9dJtrSl9NLhY IgMILOQoBUyucOGDsEtf97krjH1m6umAcuVrSjm+ffUz0B7yIucIlD70OL7cclJ7DQdl pgftvXRkC/1U14X5geexGQDsBIRSySRRx+E7d8uErHL5mafKZVHpxt/fzU1JBUI2lFG+ v726AVp4XaEeSEFuy82lu+53uGsDyV4hOZAqxz61u2TqOw/0oHuqAdEwwA1cmgRshaYy WPQyTQ4TIOGPh8bnRWpHGYJfH/eaL2eJPcJ4CciFdH2VP0e14In/PJK92ThguuVQi6lq DzlA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:organization:references:in-reply-to:date:cc:to:from :subject:message-id; bh=PEhPr4byWfqpiKQ+E4DD80rSLipyJpQC4H59fH+bdHM=; b=QOfg4lNZU0tcBE7xoR3WEM6gRgCRtmsoknZ5IFyL0s7YKeXZWFypLwAMfSMyGrZSWB CP2OMjjNC3VK/gz3jMZPQcR6Hau4yX50C/OPNWiCfNooRyqhdIlPijnUHIHadPYOfuIc JsrP0DNry7Zsyyj0m2tughb0EowYC2rc9g73VI1NfYxDA3ZJgF4pSeev1yj/IeXK9N+y wASAkEyqldo5fDO+itREvsE8eLuobbWnpn7F4YvjnSgsd5/d5awSP9b9sQXDeDFtQcYz OuUBokR47Moobk9rjOGMo/xH4CWTNiOpOVUulrTjrD5QMbkusGb3pbRI+RJVQ/OYOpDR 1LKA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si15484801pfc.46.2019.04.23.01.32.47; Tue, 23 Apr 2019 01:33:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726694AbfDWIaQ (ORCPT + 99 others); Tue, 23 Apr 2019 04:30:16 -0400 Received: from relay3-d.mail.gandi.net ([217.70.183.195]:38751 "EHLO relay3-d.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726330AbfDWIaQ (ORCPT ); Tue, 23 Apr 2019 04:30:16 -0400 X-Originating-IP: 90.88.160.238 Received: from aptenodytes (aaubervilliers-681-1-42-238.w90-88.abo.wanadoo.fr [90.88.160.238]) (Authenticated sender: paul.kocialkowski@bootlin.com) by relay3-d.mail.gandi.net (Postfix) with ESMTPSA id 6AF6760013; Tue, 23 Apr 2019 08:30:09 +0000 (UTC) Message-ID: Subject: Re: [PATCH v5 3/4] drm/vc4: Check for the binner bo before handling OOM interrupt From: Paul Kocialkowski To: Eric Anholt , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: David Airlie , Daniel Vetter , Thomas Petazzoni , Maxime Ripard , Eben Upton Date: Tue, 23 Apr 2019 10:30:09 +0200 In-Reply-To: <87v9zf806m.fsf@anholt.net> References: <20190415123908.28986-1-paul.kocialkowski@bootlin.com> <20190415123908.28986-4-paul.kocialkowski@bootlin.com> <87v9zf806m.fsf@anholt.net> Organization: Bootlin Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.32.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, 2019-04-15 at 13:48 -0700, Eric Anholt wrote: > Paul Kocialkowski writes: > > > Since the OOM interrupt directly deals with the binner bo, it doesn't > > make sense to try and handle it without a binner buffer registered. > > > > Signed-off-by: Paul Kocialkowski > > --- > > drivers/gpu/drm/vc4/vc4_irq.c | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/drivers/gpu/drm/vc4/vc4_irq.c b/drivers/gpu/drm/vc4/vc4_irq.c > > index ffd0a4388752..723dc86b4511 100644 > > --- a/drivers/gpu/drm/vc4/vc4_irq.c > > +++ b/drivers/gpu/drm/vc4/vc4_irq.c > > @@ -64,6 +64,9 @@ vc4_overflow_mem_work(struct work_struct *work) > > struct vc4_exec_info *exec; > > unsigned long irqflags; > > > > + if (!bo) > > + return; > > + > > bin_bo_slot = vc4_v3d_get_bin_slot(vc4); > > if (bin_bo_slot < 0) { > > DRM_ERROR("Couldn't allocate binner overflow mem\n"); > > -- > > 2.21.0 > > I don't think this is going to be race-free. You're checking outside of > a lock, then proceeding to use it even if (in patch 4) the bin BO was in > the process of being freed during the file close path. Can we put all > of the overflow process here under the same lock as freeing? Definitely, sorry I missed that. Cheers, Paul -- Paul Kocialkowski, Bootlin Embedded Linux and kernel engineering https://bootlin.com