As requested a version of the patch rebased on 3.17 is attached.
Regards,
Christian.
Am 07.12.2014 um 07:09 schrieb gregkh@xxxxxxxxxxxxxxxxxxx:
The patch below does not apply to the 3.17-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@xxxxxxxxxxxxxxx>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 86b276385c6a986872e4cd144f5940b156053c3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@xxxxxxx>
Date: Thu, 27 Nov 2014 13:12:58 +0100
Subject: [PATCH] drm/radeon: sync all BOs involved in a CS v2
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Not just the userspace relocs, otherwise we won't wait
for a swapped out page tables to be swapped in again.
v2: rebased on Alex current drm-fixes-3.18
Signed-off-by: Christian König <christian.koenig@xxxxxxx>
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx>
diff --git a/drivers/gpu/drm/radeon/radeon_cs.c b/drivers/gpu/drm/radeon/radeon_cs.c
index a3e7aed7e680..6f377de099f9 100644
--- a/drivers/gpu/drm/radeon/radeon_cs.c
+++ b/drivers/gpu/drm/radeon/radeon_cs.c
@@ -251,22 +251,19 @@ static int radeon_cs_get_ring(struct radeon_cs_parser *p, u32 ring, s32 priority
static int radeon_cs_sync_rings(struct radeon_cs_parser *p)
{
- int i, r = 0;
+ struct radeon_cs_reloc *reloc;
+ int r;
- for (i = 0; i < p->nrelocs; i++) {
+ list_for_each_entry(reloc, &p->validated, tv.head) {
struct reservation_object *resv;
- if (!p->relocs[i].robj)
- continue;
-
- resv = p->relocs[i].robj->tbo.resv;
+ resv = reloc->robj->tbo.resv;
r = radeon_semaphore_sync_resv(p->rdev, p->ib.semaphore, resv,
- p->relocs[i].tv.shared);
-
+ reloc->tv.shared);
if (r)
- break;
+ return r;
}
- return r;
+ return 0;
}
/* XXX: note that this is called from the legacy UMS CS ioctl as well */
>From bc0843dcdadf1be63f8c20a101d53a6eab0277b1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Christian=20K=C3=B6nig?= <christian.koenig@xxxxxxx>
Date: Fri, 5 Dec 2014 16:10:11 +0100
Subject: [PATCH] R600/SI: SI Control Flow Annotation bug fixed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Try to fix nested loops.
Signed-off-by: Christian K??nig <christian.koenig@xxxxxxx>
---
lib/Target/R600/SIAnnotateControlFlow.cpp | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/lib/Target/R600/SIAnnotateControlFlow.cpp b/lib/Target/R600/SIAnnotateControlFlow.cpp
index 91eb60b..2569c7f 100644
--- a/lib/Target/R600/SIAnnotateControlFlow.cpp
+++ b/lib/Target/R600/SIAnnotateControlFlow.cpp
@@ -31,6 +31,7 @@ namespace {
// Complex types used in this pass
typedef std::pair<BasicBlock *, Value *> StackEntry;
typedef SmallVector<StackEntry, 16> StackVector;
+typedef DenseMap<Value *, Value *> LoopConditionMap;
// Intrinsic names the control flow is annotated with
static const char *const IfIntrinsic = "llvm.SI.if";
@@ -65,6 +66,7 @@ class SIAnnotateControlFlow : public FunctionPass {
DominatorTree *DT;
StackVector Stack;
+ LoopConditionMap LoopConditions;
bool isTopOfStack(BasicBlock *BB);
@@ -240,8 +242,19 @@ Value *SIAnnotateControlFlow::handleLoopCondition(Value *Cond, PHINode *Broken)
continue;
}
}
- TerminatorInst *Insert = From->getTerminator();
- Value *PhiArg = CallInst::Create(Break, Broken, "", Insert);
+ BranchInst *Branch = cast<BranchInst>(From->getTerminator());
+ if (Branch->isUnconditional()) {
+ Value *PhiArg = CallInst::Create(Break, Broken, "", Branch);
+ NewPhi->setIncomingValue(i, PhiArg);
+ continue;
+ }
+
+ Value *Cond = Branch->getCondition();
+ if (LoopConditions.count(Cond))
+ Cond = LoopConditions[Cond];
+
+ Value *Args[] = { Cond, Broken };
+ Value *PhiArg = CallInst::Create(IfBreak, Args, "", Branch);
NewPhi->setIncomingValue(i, PhiArg);
}
eraseIfUnused(Phi);
@@ -275,7 +288,9 @@ void SIAnnotateControlFlow::handleLoop(BranchInst *Term) {
Broken->addIncoming(*PI == BB ? Arg : Int64Zero, *PI);
}
- Term->setCondition(CallInst::Create(Loop, Arg, "", Term));
+ CallInst *Call = CallInst::Create(Loop, Arg, "", Term);
+ LoopConditions[Call] = Cond;
+ Term->setCondition(Call);
push(Term->getSuccessor(0), Arg);
}