From patchwork Thu Sep 13 13:54:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alex Deucher X-Patchwork-Id: 1452611 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id 685D13FE79 for ; Thu, 13 Sep 2012 13:54:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 608B4A0E9D for ; Thu, 13 Sep 2012 06:54:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-we0-f177.google.com (mail-we0-f177.google.com [74.125.82.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 9C5A4A0E8D for ; Thu, 13 Sep 2012 06:54:11 -0700 (PDT) Received: by weyr3 with SMTP id r3so1766658wey.36 for ; Thu, 13 Sep 2012 06:54:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=P/1uarVcaHuOl3bC3bwCpkUacGLhPe4OmnmtB37DAIo=; b=IS3EoIXiqkkqqU9kPLG5TjnkuYRAFmxIxzgukdYkzxl6YaiOsyAs4silJKO7lMPEZ6 y5jNVRhAimrwghRnavu0+qqauQ36QCGyamIAzIaV4U+s/IIRZhzfdyZl3fJSEB8yTA1R 6FFm6WBsdPuco/PdGMhX3aAl6HHCrdo++8R/Q1zOEbB3QgX/NAcWvtADr0hXKatpGQnw 5F3s5QGUcvZRn3370z8oAQMMhw6/zNZV1ZYpd2nyfa4rUp3DNp1pjdWawlN44X9851Jr ZHm2Ookc/CCpqqcrIg0BcLPDDJcws4jptqk7X/IucksmyXzzU+Howcv94kuCyJGVea17 jPkg== MIME-Version: 1.0 Received: by 10.216.233.95 with SMTP id o73mr1365802weq.59.1347544450656; Thu, 13 Sep 2012 06:54:10 -0700 (PDT) Received: by 10.227.137.10 with HTTP; Thu, 13 Sep 2012 06:54:10 -0700 (PDT) In-Reply-To: <1347525227-3891-1-git-send-email-deathsimple@vodafone.de> References: <1347525227-3891-1-git-send-email-deathsimple@vodafone.de> Date: Thu, 13 Sep 2012 09:54:10 -0400 Message-ID: Subject: Re: [PATCH] drm/radeon: make 64bit fences more robust v3 From: Alex Deucher To: =?ISO-8859-1?Q?Christian_K=F6nig?= Cc: dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org On Thu, Sep 13, 2012 at 4:33 AM, Christian König wrote: > Only increase the higher 32bits if we really detect a wrap around. > > v2: instead of increasing the higher 32bits just use the higher > 32bits from the last emitted fence. > v3: also use last emitted fence value as upper limit. > > The intention of this patch is to make fences as robust as > they where before introducing 64bit fences. This is > necessary because on older systems it looks like the fence > value gets corrupted on initialization. > > Should fix: > https://bugs.freedesktop.org/show_bug.cgi?id=54129 > https://bugs.freedesktop.org/show_bug.cgi?id=51344 > https://bugs.freedesktop.org/show_bug.cgi?id=54662 > https://bugzilla.redhat.com/show_bug.cgi?id=846505 > https://bugzilla.redhat.com/show_bug.cgi?id=845639 > > Needs to be adopted for 3.5, but that shouldn't be to > much of a problem. > > Signed-off-by: Christian König > Cc: stable@vger.kernel.org This looks good to me. I made a few minor changes to the commit message to note that 3.5.x requires a different patch which will be sent out separately due to changes in the fence code. If there are no objections I'll send this out in my next -fixes pull request later today. Alex > --- > drivers/gpu/drm/radeon/radeon_fence.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c > index 7b737b9..2a59375 100644 > --- a/drivers/gpu/drm/radeon/radeon_fence.c > +++ b/drivers/gpu/drm/radeon/radeon_fence.c > @@ -131,7 +131,7 @@ int radeon_fence_emit(struct radeon_device *rdev, > */ > void radeon_fence_process(struct radeon_device *rdev, int ring) > { > - uint64_t seq, last_seq; > + uint64_t seq, last_seq, last_emitted; > unsigned count_loop = 0; > bool wake = false; > > @@ -158,13 +158,15 @@ void radeon_fence_process(struct radeon_device *rdev, int ring) > */ > last_seq = atomic64_read(&rdev->fence_drv[ring].last_seq); > do { > + last_emitted = rdev->fence_drv[ring].sync_seq[ring]; > seq = radeon_fence_read(rdev, ring); > seq |= last_seq & 0xffffffff00000000LL; > if (seq < last_seq) { > - seq += 0x100000000LL; > + seq &= 0xffffffff; > + seq |= last_emitted & 0xffffffff00000000LL; > } > > - if (seq == last_seq) { > + if (seq <= last_seq || seq > last_emitted) { > break; > } > /* If we loop over we don't want to return without > -- > 1.7.9.5 > > _______________________________________________ > dri-devel mailing list > dri-devel@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/dri-devel From b6c778e5742da8eb337ef1e0074a07cb0b89d361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Thu, 13 Sep 2012 10:33:47 +0200 Subject: [PATCH] drm/radeon: make 64bit fences more robust v3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Only increase the higher 32bits if we really detect a wrap around. v2: instead of increasing the higher 32bits just use the higher 32bits from the last emitted fence. v3: also use last emitted fence value as upper limit. The intention of this patch is to make fences as robust as they where before introducing 64bit fences. This is necessary because on older systems it looks like the fence value gets corrupted on initialization. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=51344 Should also fix: https://bugs.freedesktop.org/show_bug.cgi?id=54129 https://bugs.freedesktop.org/show_bug.cgi?id=54662 https://bugzilla.redhat.com/show_bug.cgi?id=846505 https://bugzilla.redhat.com/show_bug.cgi?id=845639 3.5 needs a separate patch due to changes in the fence code. Will send that out separately. Signed-off-by: Christian König Signed-off-by: Alex Deucher --- drivers/gpu/drm/radeon/radeon_fence.c | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c index 7b737b9..2a59375 100644 --- a/drivers/gpu/drm/radeon/radeon_fence.c +++ b/drivers/gpu/drm/radeon/radeon_fence.c @@ -131,7 +131,7 @@ int radeon_fence_emit(struct radeon_device *rdev, */ void radeon_fence_process(struct radeon_device *rdev, int ring) { - uint64_t seq, last_seq; + uint64_t seq, last_seq, last_emitted; unsigned count_loop = 0; bool wake = false; @@ -158,13 +158,15 @@ void radeon_fence_process(struct radeon_device *rdev, int ring) */ last_seq = atomic64_read(&rdev->fence_drv[ring].last_seq); do { + last_emitted = rdev->fence_drv[ring].sync_seq[ring]; seq = radeon_fence_read(rdev, ring); seq |= last_seq & 0xffffffff00000000LL; if (seq < last_seq) { - seq += 0x100000000LL; + seq &= 0xffffffff; + seq |= last_emitted & 0xffffffff00000000LL; } - if (seq == last_seq) { + if (seq <= last_seq || seq > last_emitted) { break; } /* If we loop over we don't want to return without -- 1.7.7.5