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.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 29FF6C4346E for ; Tue, 29 Sep 2020 10:53:07 +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 39020207C4 for ; Tue, 29 Sep 2020 10:53:06 +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="jsz6B1+Y" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 39020207C4 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 76FB989D9A; Tue, 29 Sep 2020 10:53:05 +0000 (UTC) Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by gabe.freedesktop.org (Postfix) with ESMTPS id D7CD589D9A for ; Tue, 29 Sep 2020 10:53:04 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id k15so4816399wrn.10 for ; Tue, 29 Sep 2020 03:53:04 -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=m/8RcwvNRZX4QrC1qgXuNqwd8pHZ5jEfkIMP8FcXGzs=; b=jsz6B1+YEp5B8KlbE/d0+3hD+n5mvwweCSSsHXznFq2L+MbyNhnwBbEVTadiV9A8e8 Hj/4Q37N4gMr3WISbfGAUlxUR7jJYV5BX7k2uQWCUyOolHRZurqdtTKtWu98cbslD4kd j3VLPxLK5+IeiS53iuP6Pb2M5x1wuj8Ww0P4c= 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=m/8RcwvNRZX4QrC1qgXuNqwd8pHZ5jEfkIMP8FcXGzs=; b=NY8BoH+H6iTM3eWDCS6q73alR8nWM12ByrrHFqbPF8vgnOx6gaI9cXFNBUQodRT49u 32raXAN5UhUsTS8R3rK4zPM7KkZX02GO5QdGodqzCRMisk1KCF9Vsku4H2mafTPU3AlV nXyTF+OyDsIL7KBSnWQ+dCsdPU0NFtwDRuksPDu4eBYJ/YBffkfcbKKO0UDBp1pEMiJd n3Sq/ZChbw3BkhazDt7I2ctoh0w5lbvNuiy6pAATA0rz5UUAZ4wOQeLbXQJbqSdLWyJq lgKcsnr79g5g+vemx9QX8s4S5eETYZopKu8/4X9J7bSgbiTppE0P33TCk/ZMa1pozGZY RLAA== X-Gm-Message-State: AOAM5328G4ucnxBcb06do3ex3d+IADP4JjMG0HAXlw7s3ZsSvgy+tbnF 2Is0oOEolA60vfFQZdqOG3eb2g== X-Google-Smtp-Source: ABdhPJzmw2CD/MpLrTQRlDKQtbpWYZdfZO7lS5wPv+xREi43g7gWZnZuZtDrMycOZuDAjAbXvAqStA== X-Received: by 2002:a5d:6552:: with SMTP id z18mr3513370wrv.32.1601376783538; Tue, 29 Sep 2020 03:53:03 -0700 (PDT) Received: from phenom.ffwll.local ([2a02:168:57f4:0:efd0:b9e5:5ae6:c2fa]) by smtp.gmail.com with ESMTPSA id l5sm5116546wmf.10.2020.09.29.03.53.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 29 Sep 2020 03:53:02 -0700 (PDT) Date: Tue, 29 Sep 2020 12:53:00 +0200 From: Daniel Vetter To: Gerd Hoffmann Subject: Re: [PATCH v2 4/4] drm/qxl: use qxl pin function Message-ID: <20200929105300.GM438822@phenom.ffwll.local> Mail-Followup-To: Gerd Hoffmann , dri-devel@lists.freedesktop.org, Dave Airlie , David Airlie , Huang Rui , Christian =?iso-8859-1?Q?K=F6nig?= , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , open list References: <20200929095115.24430-1-kraxel@redhat.com> <20200929095115.24430-5-kraxel@redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20200929095115.24430-5-kraxel@redhat.com> X-Operating-System: Linux phenom 5.7.0-1-amd64 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: David Airlie , open list , dri-devel@lists.freedesktop.org, "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Huang Rui , "open list:DRM DRIVER FOR QXL VIRTUAL GPU" , Dave Airlie , Christian =?iso-8859-1?Q?K=F6nig?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue, Sep 29, 2020 at 11:51:15AM +0200, Gerd Hoffmann wrote: > Otherwise ttm throws a WARN because we try to pin without a reservation. > > Fixes: 9d36d4320462 ("drm/qxl: switch over to the new pin interface") > Signed-off-by: Gerd Hoffmann > --- > drivers/gpu/drm/qxl/qxl_object.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/qxl/qxl_object.c b/drivers/gpu/drm/qxl/qxl_object.c > index d3635e3e3267..eb45267d51db 100644 > --- a/drivers/gpu/drm/qxl/qxl_object.c > +++ b/drivers/gpu/drm/qxl/qxl_object.c > @@ -145,7 +145,7 @@ int qxl_bo_create(struct qxl_device *qdev, > return r; > } > if (pinned) > - ttm_bo_pin(&bo->tbo); > + qxl_bo_pin(bo); I think this is now after ttm_bo_init, and at that point the object is visible to lru users and everything. So I do think you need to grab locks here instead of just incrementing the pin count alone. It's also I think a bit racy, since ttm_bo_init drops the lock, so someone might have snuck in and evicted the object already. I think what you need is to call ttm_bo_init_reserved, then ttm_bo_pin, then ttm_bo_unreserve, all explicitly. -Daniel > *bo_ptr = bo; > return 0; > } > -- > 2.27.0 > -- 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