Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2053727ybi; Thu, 4 Jul 2019 04:26:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxi8qAzECnD1m1OG/GQ4le6YTftAxNjdx0ud11CbxRA3//g6d9dUh0Kw8+dO3f350EJ5RuE X-Received: by 2002:a17:902:8205:: with SMTP id x5mr49485280pln.279.1562239609338; Thu, 04 Jul 2019 04:26:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562239609; cv=none; d=google.com; s=arc-20160816; b=BNpR4rfCi2ijZN7+I4jNz1kha3fAdwGDCSAoTtVRzP57hzH+nGAY3o183HA6nW4rYt SgqyypIfie8wv+NNuukD7JV96qEAW4z3pInV9lxhAnI3osiQdifGFmQvh1BjsHt1H5PO uzRuOHMUnQ8DCK3M/o1Xnq0VMD8pX+k64Ih4oS0awWQh5ROK6PABb/sRbLNtjIsvTTa7 H2rLbCzq3jbn3W6LVCR8wCIBvxB4NCEdhJMz1VBCRB9+Jw4Bu5/mjkh5qT3Hzrin7hUc CnK2vhXkUmSPGmOBfeYCGsq+OaCqI7DBWYCXc9DrXrg0ZpcPq2GFhXCYwsQ1631UxBLH 5uaw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jwn0L0mfC7Xjt6G+bDGGq/wzxa+00p9pmek50/Z0jw0=; b=j7aCw9XnqK6ON1o3s6qRA5kbG/l9vY0Cg9bzKxSFICogbnbNI/DppGGTUe2C3gtMQ9 tsNpiC49zmLDxgNCOC4gsI5rfmTeLy3dQqGx6+THKujz9YHHH3pz6PWLIXFx/fPjkjUL 9Yn1ReD3Jk3YbPXhQodBmLL704ManD807hTRPmYMZQNHdBiRUIXZCawGFfPbav8+bVUY kXUKqtSwz2980izEnCbWjZhkC2cfnFHqS8Wm0D3NOdmcUNjPTn7Q1byLUKwE4vztRBlt 8z0khpB40XvojhfYJjib/9OBtYzIHsafJTp+yUDEyvbWa1cLKuUcd80ZpjbUz5f0+zKr k4FA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12si4684919pjt.4.2019.07.04.04.26.31; Thu, 04 Jul 2019 04:26:49 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727560AbfGDLZh (ORCPT + 99 others); Thu, 4 Jul 2019 07:25:37 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57018 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727436AbfGDLZg (ORCPT ); Thu, 4 Jul 2019 07:25:36 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B00A1882F5; Thu, 4 Jul 2019 11:25:36 +0000 (UTC) Received: from sirius.home.kraxel.org (ovpn-116-222.ams2.redhat.com [10.36.116.222]) by smtp.corp.redhat.com (Postfix) with ESMTP id 467A759442; Thu, 4 Jul 2019 11:25:35 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 1E36611AB5; Thu, 4 Jul 2019 13:25:34 +0200 (CEST) Date: Thu, 4 Jul 2019 13:25:34 +0200 From: Gerd Hoffmann To: Chia-I Wu Cc: ML dri-devel , Gurchetan Singh , David Airlie , Daniel Vetter , "open list:VIRTIO GPU DRIVER" , open list Subject: Re: [PATCH v6 08/18] drm/virtio: rework virtio_gpu_execbuffer_ioctl fencing Message-ID: <20190704112534.v7icsuverf7wrbjq@sirius.home.kraxel.org> References: <20190702141903.1131-1-kraxel@redhat.com> <20190702141903.1131-9-kraxel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Thu, 04 Jul 2019 11:25:36 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, > > if (fence) > > virtio_gpu_fence_emit(vgdev, hdr, fence); > > + if (vbuf->objs) { > > + virtio_gpu_array_add_fence(vbuf->objs, &fence->f); > > + virtio_gpu_array_unlock_resv(vbuf->objs); > > + } > This is with the spinlock held. Maybe we should move the > virtio_gpu_array_unlock_resv call out of the critical section. That would bring back the race ... > I am actually more concerned about virtio_gpu_array_add_fence, but it > is also harder to move. Should we add a kref to the object array? Yep, refcounting would be the other way to fix the race. > This bothers me because I recently ran into a CPU-bound game with very > bad lock contention here. Hmm. Any clue where this comes from? Multiple threads competing for virtio buffers I guess? Maybe we should have larger virtqueues? cheers, Gerd