Commit fedf571f authored by Damien Lespiau's avatar Damien Lespiau
Browse files

series: Parse new versions of patches sent as replies to a Series



It's time to take a stab at patch versioning. This commit will parse
patches sent as replies to a previous patch (either a direct reply or
somewhere in the subtree spawn by a patch) and create a new revision to
reflect that the Series has been updated.

Turns out it's not entirely trivial. We basically need to do a similar
threading a MUA would do.

For instance, we can't purely rely on the references header, because
patches sent with git send-email don't have the full path to the root
mail in references, but just the parent mail (that's because git
send-email patches have no way to know the full context of the thread
they are sent as a reply to).

So, here again, unit testing comes to the rescue. I'm careful to have
basic coverage of all cases I'm interested in. Of course, one can extend
the number of cases recognised if needed.

A word on versioning. The parsing doesn't actually look at the "v2",
"v3" indicators on patches. The main reason for that is that the series
revision is global to a series, ie. if a series has 10 patches, patch 4
and 7 have both v2 versions sent as replies to the thread, the global
series version will be 3 (v1: original series, v2: v1 + patch 4 v2, v3:
v2 + patch 7 v2). That scheme has a benefit: it doesn't rely on the
using getting the numbering right.

v2: Fix parsing of headers from the db by using HeaderParser
v3: Fix a corner case when the version n of a patch is sent as a reply
    to version n - 2 instead of n - 1
v4: Fix a corner case where the user doesn't resend the series marker
    (ie 2/2) when sending a new version of a patch that is part of a
    series
v5: Rebase on top of the SERIES_DEFAULT_NAME change
Signed-off-by: default avatarDamien Lespiau <damien.lespiau@intel.com>
parent d9ecd196
......@@ -27,15 +27,18 @@ import operator
import codecs
from email import message_from_file
from email.header import Header, decode_header
from email.parser import HeaderParser
from email.utils import parsedate_tz, mktime_tz
import logging
from patchwork.parser import parse_patch
from patchwork.models import Patch, Project, Person, Comment, State, Series, \
SeriesRevision, get_default_initial_patch_state, SERIES_DEFAULT_NAME
SeriesRevision, SeriesRevisionPatch, get_default_initial_patch_state, \
SERIES_DEFAULT_NAME, get_default_initial_patch_state
import django
from django.conf import settings
from django.contrib.auth.models import User
from django.core.exceptions import MultipleObjectsReturned
from django.utils.log import AdminEmailHandler
list_id_headers = ['List-ID', 'X-Mailing-List', 'X-list']
......@@ -163,15 +166,14 @@ class MailContent:
self.revision = None
self.patch_order = 1 # place of the patch in the series
def build_references_list(mail):
# construct a list of possible reply message ids
def build_references_from_headers(in_reply_to, references):
refs = []
if 'In-Reply-To' in mail:
refs.append(mail.get('In-Reply-To'))
if in_reply_to:
refs.append(in_reply_to)
if 'References' in mail:
rs = mail.get('References').split()
if references:
rs = references.split()
rs.reverse()
for r in rs:
if r not in refs:
......@@ -179,6 +181,69 @@ def build_references_list(mail):
return refs
def get_object_by_msgid(cls, msgid):
try:
return cls.objects.get(msgid=msgid)
except cls.DoesNotExist:
return None
except MultipleObjectsReturned:
# it's theoritically possible to have the same message id for 2
# patches or comments, take the more recent object then, why
# not.
return cls.objects.filter(msgid=msgid).order_by('-date')[0]
def find_header_in_text(headers, name):
parser = HeaderParser()
headers = parser.parsestr(headers)
return headers[name]
def build_references_from_db(msgid):
# msgid belongs to either a patch or a comment
object = get_object_by_msgid(Patch, msgid)
if not object:
object = get_object_by_msgid(Comment, msgid)
if not object:
# cover letters are thread roots, but don't have a corresponding
# Comment object as the cover letter is stored in Series.
return []
in_reply_to = find_header_in_text(object.headers, 'In-Reply-To')
references = find_header_in_text(object.headers, 'References')
refs = build_references_from_headers(in_reply_to, references)
if not refs:
return []
# note that we recurse on the highest ancestor found, not necessarily the
# immediate parent (depends: if the mail found in the DB is from a
# actually MUA which filled in the 'References:' header or if it is a
# git send-email mail, with only 'In-References-To: defined
ancestor_msgid = refs[-1]
return refs + build_references_from_db(ancestor_msgid)
def build_references_from_mail(mail):
return build_references_from_headers(mail.get('In-Reply-To', None),
mail.get('References', None))
def build_references_list(mail):
"""Construct the list of msgids from 'mail' to the root of the thread"""
# parse the information from the mail headers
refs = build_references_from_mail(mail)
if not refs:
return refs
# Emails aren't required to have the full list of their parents in
# References:. So we need to use the db to reach the root message.
#
# git send-email emails with --in-reply-to are the ultimate occurrence of
# this behaviour as they just have the but just the direct parent in
# References.
parent_msgid = refs[-1]
return refs + build_references_from_db(parent_msgid)
def parse_series_marker(subject_prefixes):
"""If this patch is part a of multi-patches series, ie has x/n in its
subject, return (x, n). Otherwise, return (None, None)."""
......@@ -253,8 +318,15 @@ def find_content(project, mail):
refs = build_references_list(mail)
is_root = refs == []
is_cover_letter = is_root and x == 0
is_patch = patchbuf is not None
if is_cover_letter or patchbuf:
if pullurl or is_patch:
ret.patch_order = x or 1
ret.patch = Patch(name = name, pull_url = pullurl, content = patchbuf,
date = mail_date(mail), headers = mail_headers(mail))
# Create/update the Series and SeriesRevision objects
if is_cover_letter or is_patch:
msgid = mail.get('Message-Id').strip()
# Series get a generic name when they don't start by a cover letter or
......@@ -264,8 +336,9 @@ def find_content(project, mail):
if is_cover_letter or n is None:
series_name = strip_prefixes(name)
(ret.series, ret.revision) = find_series_for_mail(project, series_name,
msgid, refs)
(ret.series, ret.revision, ret.patch_order) = \
find_series_for_mail(project, series_name, msgid, is_patch,
ret.patch_order, refs)
ret.series.n_patches = n or 1
date = mail_date(mail)
......@@ -276,11 +349,6 @@ def find_content(project, mail):
ret.revision.cover_letter = clean_content(commentbuf)
return ret
if pullurl or patchbuf:
ret.patch_order = x or 1
ret.patch = Patch(name = name, pull_url = pullurl, content = patchbuf,
date = mail_date(mail), headers = mail_headers(mail))
if commentbuf:
# If this is a new patch, we defer setting comment.patch until
# patch has been saved by the caller
......@@ -304,27 +372,90 @@ def find_content(project, mail):
return ret
# The complexity here is because patches can be received out of order:
# If we receive a patch, part of series, before the root message, we create a
# placeholder series that will be updated once we receive the root message.
def find_series_for_mail(project, name, msgid, refs):
def find_previous_patch(revision, order, refs):
if not refs:
return None
# if one of the parents was a patch, this is an update. Well, almost. We
# also need to make sure we don't match a patch from a series without a
# cover letter (see comment below).
parent_patch = None
for ref in refs:
try:
patch = Patch.objects.get(msgid=ref)
parent_patch = patch
break
except Patch.DoesNotExist:
continue
if not parent_patch:
return None
# A multiple patch series, sent without a cover letter (we don't cover the
# case where patch i + 1 is sent as reply to patch i) will look like:
# - root message (patch 1/n)
# - reply 1 (patch 2/n)
# - reply 2 (patch 3/n)
# - ...
# - reply n-1 (patch n/n)
# We don't want to consider reply 1 to n-1 as new revisions of patch 1/n.
#
# However, we still want to be able to send a "PATCH v2 1/n" as a reply to
# the root message.
if revision.root_msgid != parent_patch.msgid or order == 1:
return parent_patch
return None
def find_patch_order(revisions, previous_patch):
# cycle through revisions starting by the more recent one and find
# the revision where previous_patch is
order = None
for revision in revisions:
try:
order = SeriesRevisionPatch.objects.get(revision=revision,
patch=previous_patch).order
break
except SeriesRevisionPatch.DoesNotExist:
continue
assert order is not None
return order
# The complexity here is because:
# - patches can be received out of order: If we receive a patch, part of
# series, before the root message, we create a placeholder series that will
# be updated once we receive the root message.
# - we need to create new revisions when the mail is actually a new version
# of a previous patch
def find_series_for_mail(project, name, msgid, is_patch, order, refs):
if refs == []:
root_msgid = msgid
else:
root_msgid = refs[-1]
try:
revision = SeriesRevision.objects.get(root_msgid = root_msgid)
# grab the latest revision for this mail thread
revisions = SeriesRevision.objects.filter(series__project=project,
root_msgid=root_msgid) \
.reverse()
revision = revisions[0]
series = revision.series
if name:
series.name = name
except SeriesRevision.DoesNotExist:
if is_patch:
previous_patch = find_previous_patch(revision, order, refs)
if previous_patch:
order = find_patch_order(revisions, previous_patch)
revision = revision.duplicate(exclude_patches=(order,))
# series has been updated, grab the new instance
series = revision.series
except IndexError:
if not name:
name = SERIES_DEFAULT_NAME
series = Series(name=name)
revision = SeriesRevision(root_msgid = root_msgid)
return (series, revision)
return (series, revision, order)
def find_patch_for_comment(project, refs):
for ref in refs:
......
......@@ -480,6 +480,33 @@ class SeriesRevision(models.Model):
order=order)
sp.save()
def duplicate_meta(self):
new = SeriesRevision.objects.get(pk=self.pk)
new.pk = None
new.cover_letter = None
new.version = self.version + 1
new.save()
series = new.series
series.version = new.version
series.save()
return new
def duplicate(self, exclude_patches=()):
"""Create a new revision based on 'self', incrementing the version
and populating the new revision with all 'self' patches.
exclude_patch (a list of 'order's) can be used to exclude
patches from the operation"""
new = self.duplicate_meta()
order = 0
for p in self.ordered_patches():
order += 1
if order in exclude_patches:
continue
new.add_patch(p, order)
return new
def __unicode__(self):
if hasattr(self, 'series'):
return self.series.name + " (rev " + str(self.version) + ")"
......
MIME-Version: 1.0
Received: from irsmsx102.ger.corp.intel.com [163.33.3.155]
by localhost.localdomain with IMAP (fetchmail-6.3.24)
for <damien@localhost> (single-drop); Mon, 30 Mar 2015 15:39:02 +0100 (BST)
Received: from fmsmsx107.amr.corp.intel.com (10.18.124.205) by
IRSMSX107.ger.corp.intel.com (163.33.3.99) with Microsoft SMTP Server (TLS)
id 14.3.224.2; Mon, 30 Mar 2015 15:37:30 +0100
Received: from orsmga001.jf.intel.com (10.7.209.18) by
FMSMSX107-1.cps.intel.com (10.18.124.205) with Microsoft SMTP Server id
14.3.224.2; Mon, 30 Mar 2015 07:37:29 -0700
Received: from orsmga103.jf.intel.com ([10.7.208.35]) by
orsmga001-1.jf.intel.com with ESMTP; 30 Mar 2015 07:37:16 -0700
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0DhAQCoXhlVnLHS/INcg1hcgxPCACAKhXMegRhMAQEBAQEBEQEBAQEBBg0JCRQuQQGDVAIEAQEgBA0SCh4OAwECBgIfBQIeBAQCAgIBASMBHyEIBYgqBQixaphqAQsBH4EhjmsyglKBRQWLGYk0g12CJoFWlndnAYJCAQEB
X-IPAS-Result: A0DhAQCoXhlVnLHS/INcg1hcgxPCACAKhXMegRhMAQEBAQEBEQEBAQEBBg0JCRQuQQGDVAIEAQEgBA0SCh4OAwECBgIfBQIeBAQCAgIBASMBHyEIBYgqBQixaphqAQsBH4EhjmsyglKBRQWLGYk0g12CJoFWlndnAYJCAQEB
X-IronPort-AV: E=Sophos;i="5.11,494,1422950400";
d="scan'208";a="228344716"
Received: from gabe.freedesktop.org ([131.252.210.177]) by mga03.intel.com
with ESMTP; 30 Mar 2015 07:37:14 -0700
Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by
gabe.freedesktop.org (Postfix) with ESMTP id 001656E5B8; Mon, 30 Mar 2015
07:37:13 -0700 (PDT)
X-Original-To: intel-gfx@lists.freedesktop.org
Delivered-To: intel-gfx@lists.freedesktop.org
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by
gabe.freedesktop.org (Postfix) with ESMTP id B7E436E5B8 for
<intel-gfx@lists.freedesktop.org>; Mon, 30 Mar 2015 07:37:12 -0700 (PDT)
Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by
fmsmga103.fm.intel.com with ESMTP; 30 Mar 2015 07:37:12 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.11,494,1422950400"; d="scan'208";a="687680864"
Received: from deepu.iind.intel.com ([10.223.82.144]) by
fmsmga001.fm.intel.com with ESMTP; 30 Mar 2015 07:37:11 -0700
From: <deepak.s@linux.intel.com>
To: <intel-gfx@lists.freedesktop.org>
Date: Mon, 30 Mar 2015 20:03:58 +0530
Message-ID: <1427726038-19718-1-git-send-email-deepak.s@linux.intel.com>
X-Mailer: git-send-email 1.9.1
Subject: [Intel-gfx] [PATCH] drm/i915: Clean-up idr table if context create
fails.
X-BeenThere: intel-gfx@lists.freedesktop.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: Intel graphics driver community testing & development
<intel-gfx.lists.freedesktop.org>
List-Unsubscribe: <http://lists.freedesktop.org/mailman/options/intel-gfx>,
<mailto:intel-gfx-request@lists.freedesktop.org?subject=unsubscribe>
List-Archive: <http://lists.freedesktop.org/archives/intel-gfx>
List-Post: <mailto:intel-gfx@lists.freedesktop.org>
List-Help: <mailto:intel-gfx-request@lists.freedesktop.org?subject=help>
List-Subscribe: <http://lists.freedesktop.org/mailman/listinfo/intel-gfx>,
<mailto:intel-gfx-request@lists.freedesktop.org?subject=subscribe>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
Errors-To: intel-gfx-bounces@lists.freedesktop.org
Sender: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org>
Return-Path: intel-gfx-bounces@lists.freedesktop.org
X-MS-Exchange-Organization-AVStamp-Mailbox: NAI;57084713;0;novirus
X-MS-Exchange-Organization-AuthSource: fmsmsx107.amr.corp.intel.com
X-MS-Exchange-Organization-AuthAs: Anonymous
Content-Length: 1326
RnJvbTogRGVlcGFrIFMgPGRlZXBhay5zQGxpbnV4LmludGVsLmNvbT4KCkNsZWFudXAgaWRyIHRh
YmxlIGlmIGFueSBlcnJvciBoYXBwZW5zIGFmdGVyIF9fY3JlYXRlX2h3X2NvbnRleHQoKSBpbgpp
OTE1X2dlbV9jcmVhdGVfY29udGV4dCgpCgpTaWduZWQtb2ZmLWJ5OiBEZWVwYWsgUyA8ZGVlcGFr
LnNAbGludXguaW50ZWwuY29tPgotLS0KIGRyaXZlcnMvZ3B1L2RybS9pOTE1L2k5MTVfZ2VtX2Nv
bnRleHQuYyB8IDIgKysKIDEgZmlsZSBjaGFuZ2VkLCAyIGluc2VydGlvbnMoKykKCmRpZmYgLS1n
aXQgYS9kcml2ZXJzL2dwdS9kcm0vaTkxNS9pOTE1X2dlbV9jb250ZXh0LmMgYi9kcml2ZXJzL2dw
dS9kcm0vaTkxNS9pOTE1X2dlbV9jb250ZXh0LmMKaW5kZXggZjNlODRjNC4uNjliZWJlNSAxMDA2
NDQKLS0tIGEvZHJpdmVycy9ncHUvZHJtL2k5MTUvaTkxNV9nZW1fY29udGV4dC5jCisrKyBiL2Ry
aXZlcnMvZ3B1L2RybS9pOTE1L2k5MTVfZ2VtX2NvbnRleHQuYwpAQCAtMjg3LDYgKzI4Nyw4IEBA
IGVycl91bnBpbjoKIAlpZiAoaXNfZ2xvYmFsX2RlZmF1bHRfY3R4ICYmIGN0eC0+bGVnYWN5X2h3
X2N0eC5yY3Nfc3RhdGUpCiAJCWk5MTVfZ2VtX29iamVjdF9nZ3R0X3VucGluKGN0eC0+bGVnYWN5
X2h3X2N0eC5yY3Nfc3RhdGUpOwogZXJyX2Rlc3Ryb3k6CisJaWYgKGN0eC0+ZmlsZV9wcml2KQor
CQlpZHJfcmVtb3ZlKCZjdHgtPmZpbGVfcHJpdi0+Y29udGV4dF9pZHIsIGN0eC0+dXNlcl9oYW5k
bGUpOwogCWk5MTVfZ2VtX2NvbnRleHRfdW5yZWZlcmVuY2UoY3R4KTsKIAlyZXR1cm4gRVJSX1BU
UihyZXQpOwogfQotLSAKMS45LjEKCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fCkludGVsLWdmeCBtYWlsaW5nIGxpc3QKSW50ZWwtZ2Z4QGxpc3RzLmZyZWVk
ZXNrdG9wLm9yZwpodHRwOi8vbGlzdHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8v
aW50ZWwtZ2Z4Cg==
MIME-Version: 1.0
Received: from irsmsx102.ger.corp.intel.com [163.33.3.155]
by localhost.localdomain with IMAP (fetchmail-6.3.24)
for <damien@localhost> (single-drop); Mon, 30 Mar 2015 16:45:01 +0100 (BST)
Received: from fmsmsx102.amr.corp.intel.com (10.18.124.200) by
irsmsx110.ger.corp.intel.com (163.33.3.25) with Microsoft SMTP Server (TLS)
id 14.3.224.2; Mon, 30 Mar 2015 16:42:10 +0100
Received: from orsmsx104.amr.corp.intel.com (10.22.225.131) by
FMSMSX102.amr.corp.intel.com (10.18.124.200) with Microsoft SMTP Server (TLS)
id 14.3.224.2; Mon, 30 Mar 2015 08:42:08 -0700
Received: from fmsmga001.fm.intel.com (10.253.24.23) by
ORSMSX104-1.jf.intel.com (10.22.225.131) with Microsoft SMTP Server id
14.3.224.2; Mon, 30 Mar 2015 08:42:08 -0700
Received: from fmsmga102.fm.intel.com ([10.1.193.69]) by
fmsmga001-1.fm.intel.com with ESMTP; 30 Mar 2015 08:41:51 -0700
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0BgAACwbRlVnLHS/INcgmR0XIMTwX4iCoYRgRxMAQEBAQEBEQEBAQEBBg0JCRQuhBQBAQEBAgEBAQEPEQQNDAEBBAoeCwECAgEBAgYBAQoVAwICBRkEBAICAgEBCwUTAQwBBQEMKQUdiAUIAQQIpWI+MYpBcIRiAQWTYAEBAQEBBQEBAQEBAQEVBgqBF4oIhRWCUi+BFopHiguDXYIlAYFWkRU1hSdtAYJCAQEB
X-IPAS-Result: A0BgAACwbRlVnLHS/INcgmR0XIMTwX4iCoYRgRxMAQEBAQEBEQEBAQEBBg0JCRQuhBQBAQEBAgEBAQEPEQQNDAEBBAoeCwECAgEBAgYBAQoVAwICBRkEBAICAgEBCwUTAQwBBQEMKQUdiAUIAQQIpWI+MYpBcIRiAQWTYAEBAQEBBQEBAQEBAQEVBgqBF4oIhRWCUi+BFopHiguDXYIlAYFWkRU1hSdtAYJCAQEB
X-IronPort-AV: E=Sophos;i="5.11,494,1422950400";
d="scan'208";a="16679446"
Received: from gabe.freedesktop.org ([131.252.210.177]) by mga11.intel.com
with ESMTP; 30 Mar 2015 08:41:49 -0700
Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by
gabe.freedesktop.org (Postfix) with ESMTP id 99D4F6E5DC; Mon, 30 Mar 2015
08:41:48 -0700 (PDT)
X-Original-To: intel-gfx@lists.freedesktop.org
Delivered-To: intel-gfx@lists.freedesktop.org
Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com
[209.85.212.179]) by gabe.freedesktop.org (Postfix) with ESMTP id 6D05E6E5DC
for <intel-gfx@lists.freedesktop.org>; Mon, 30 Mar 2015 08:41:46 -0700 (PDT)
Received: by wiaa2 with SMTP id a2so135549739wia.0 for
<intel-gfx@lists.freedesktop.org>; Mon, 30 Mar 2015 08:41:45 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google;
h=sender:date:from:to:cc:subject:message-id:references:mime-version
:content-type:content-disposition:in-reply-to:user-agent;
bh=bB+I4BIlHegpwvIgpLGPCsfmix4mD6SJlc6U2Sw/yI4=;
b=GnERTqkaYVSG60P0CRwvezRFSRsvbTt/JLUU9zkRaPMWxFglnGbrRfcz1Q/7OgEOso
oVcpOdQZEd+NBdLNqom+EVmhVuwqM63nsOtm2LFEGEqIyth6Yx9SM/lNNrg1Xp/rgkct
SNpaa2Jotvv/yeX/YVOUDsG+SHNJigrzooAok=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20130820;
h=x-gm-message-state:sender:date:from:to:cc:subject:message-id
:references:mime-version:content-type:content-disposition
:in-reply-to:user-agent;
bh=bB+I4BIlHegpwvIgpLGPCsfmix4mD6SJlc6U2Sw/yI4=;
b=ejyaacHc8SCc1gZpSkzYxOFJ/lHzl7mSkNFQGIpSPFbHxnGcu8WB8Yvlwbl5XGHqwp
uMOgsUAN5Iygl4T1iXy/ewtxJYxPnP87HCw2UPzQQ5xnad8ZLAMW7yMvi1eeDdnmnalE
ynYr0bnH2UF9tlpT0PbO84uCimvO4VtK/o11I1NJrQ+k4ljuBnXjOC+H54zfU8ssi14f
0BvSirNOi+kGCw7A9GG0Eb514Cp1r++lH3msSf1Ie1Lwscpg1AhN8rhhN1B3/ZEw7ukG
N3ameta9Q24ttep+HwDuE7WwuGV1TDgIChfnXMTV2zbi4bfpjp1JySMtj2hSonmJh4Rr
+l6g==
X-Gm-Message-State: ALoCoQnSOPzAmR3240+8OkdjArn1sKol7K6e3QbH6IWrFT8WN1Vlos6zE7bM8axw9b3nazMchJKr
X-Received: by 10.180.109.169 with SMTP id ht9mr24024360wib.86.1427730105724;
Mon, 30 Mar 2015 08:41:45 -0700 (PDT)
Received: from phenom.ffwll.local ([2a02:168:56c6:0:22cf:30ff:fe4c:37d6]) by
mx.google.com with ESMTPSA id n6sm16276260wjy.8.2015.03.30.08.41.44
(version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30
Mar 2015 08:41:45 -0700 (PDT)
Date: Mon, 30 Mar 2015 17:43:34 +0200
From: Daniel Vetter <daniel@ffwll.ch>
To: <deepak.s@linux.intel.com>
Message-ID: <20150330154334.GC6354@phenom.ffwll.local>
References: <1427726038-19718-1-git-send-email-deepak.s@linux.intel.com>
Content-Disposition: inline
In-Reply-To: <1427726038-19718-1-git-send-email-deepak.s@linux.intel.com>
X-Operating-System: Linux phenom 4.0.0-rc3+
User-Agent: Mutt/1.5.23 (2014-03-12)
CC: <intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Clean-up idr table if context
create fails.
X-BeenThere: intel-gfx@lists.freedesktop.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: Intel graphics driver community testing & development
<intel-gfx.lists.freedesktop.org>
List-Unsubscribe: <http://lists.freedesktop.org/mailman/options/intel-gfx>,
<mailto:intel-gfx-request@lists.freedesktop.org?subject=unsubscribe>
List-Archive: <http://lists.freedesktop.org/archives/intel-gfx>
List-Post: <mailto:intel-gfx@lists.freedesktop.org>
List-Help: <mailto:intel-gfx-request@lists.freedesktop.org?subject=help>
List-Subscribe: <http://lists.freedesktop.org/mailman/listinfo/intel-gfx>,
<mailto:intel-gfx-request@lists.freedesktop.org?subject=subscribe>
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: base64
Errors-To: intel-gfx-bounces@lists.freedesktop.org
Sender: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org>
Return-Path: intel-gfx-bounces@lists.freedesktop.org
X-MS-Exchange-Organization-AVStamp-Mailbox: NAI;57084713;0;novirus
X-MS-Exchange-Organization-AuthSource: ORSMSX104.amr.corp.intel.com
X-MS-Exchange-Organization-AuthAs: Anonymous
Content-Length: 2019
T24gTW9uLCBNYXIgMzAsIDIwMTUgYXQgMDg6MDM6NThQTSArMDUzMCwgZGVlcGFrLnNAbGludXgu
aW50ZWwuY29tIHdyb3RlOgo+IEZyb206IERlZXBhayBTIDxkZWVwYWsuc0BsaW51eC5pbnRlbC5j
b20+Cj4gCj4gQ2xlYW51cCBpZHIgdGFibGUgaWYgYW55IGVycm9yIGhhcHBlbnMgYWZ0ZXIgX19j
c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0aGUgY2FsbCB0byBpZHJfcmVt
b3ZlIHVuY29uZGl0aW9uYWwuCgpUaGFua3MsIERhbmllbAoKPiAgCWk5MTVfZ2VtX2NvbnRleHRf
dW5yZWZlcmVuY2UoY3R4KTsKPiAgCXJldHVybiBFUlJfUFRSKHJldCk7Cj4gIH0KPiAtLSAKPiAx
LjkuMQo+IAo+IF9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
Cj4gSW50ZWwtZ2Z4IG1haWxpbmcgbGlzdAo+IEludGVsLWdmeEBsaXN0cy5mcmVlZGVza3RvcC5v
cmcKPiBodHRwOi8vbGlzdHMuZnJlZWRlc2t0b3Aub3JnL21haWxtYW4vbGlzdGluZm8vaW50ZWwt
Z2Z4CgotLSAKRGFuaWVsIFZldHRlcgpTb2Z0d2FyZSBFbmdpbmVlciwgSW50ZWwgQ29ycG9yYXRp
b24KaHR0cDovL2Jsb2cuZmZ3bGwuY2gKX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
X19fX19fX19fX19fX18KSW50ZWwtZ2Z4IG1haWxpbmcgbGlzdApJbnRlbC1nZnhAbGlzdHMuZnJl
ZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0cy5mcmVlZGVza3RvcC5vcmcvbWFpbG1hbi9saXN0aW5m
by9pbnRlbC1nZngK
MIME-Version: 1.0
Received: from irsmsx102.ger.corp.intel.com [163.33.3.155]
by localhost.localdomain with IMAP (fetchmail-6.3.24)
for <damien@localhost> (single-drop); Thu, 02 Apr 2015 14:24:02 +0100 (BST)
Received: from fmsmsx106.amr.corp.intel.com (10.18.124.204) by
IRSMSX154.ger.corp.intel.com (163.33.192.96) with Microsoft SMTP Server (TLS)
id 14.3.224.2; Thu, 2 Apr 2015 14:23:08 +0100
Received: from fmsmga002.fm.intel.com (10.253.24.26) by
FMSMSX106-1.cps.intel.com (10.18.124.204) with Microsoft SMTP Server id
14.3.224.2; Thu, 2 Apr 2015 06:23:07 -0700
Received: from orsmga103.jf.intel.com ([10.7.208.35]) by
fmsmga002-1.fm.intel.com with ESMTP; 02 Apr 2015 06:22:57 -0700
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0D9AQBUQh1VnLHS/INcg1pcgxXCISIKhhGBJ0wBAQEBAQESAQEBAQEICwkJFC5BAYNcAQEBAQIBAQEBIAQNEgoeCwMDAQIGAQEKFQMCAgUZBAQCAgIBAQsCFgEfEAYLAgYCAQEBiCIIBQi1PpgxAQEBBwEBAQEBARyBIYoIh2iBRQEEiyGJPoNkgieBV5cJZwGCQgEBAQ
X-IPAS-Result: A0D9AQBUQh1VnLHS/INcg1pcgxXCISIKhhGBJ0wBAQEBAQESAQEBAQEICwkJFC5BAYNcAQEBAQIBAQEBIAQNEgoeCwMDAQIGAQEKFQMCAgUZBAQCAgIBAQsCFgEfEAYLAgYCAQEBiCIIBQi1PpgxAQEBBwEBAQEBARyBIYoIh2iBRQEEiyGJPoNkgieBV5cJZwGCQgEBAQ
X-IronPort-AV: E=Sophos;i="5.11,511,1422950400";
d="scan'208";a="229625714"
Received: from gabe.freedesktop.org ([131.252.210.177]) by mga03.intel.com
with ESMTP; 02 Apr 2015 06:22:49 -0700
Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by
gabe.freedesktop.org (Postfix) with ESMTP id 6C95C6E2DA; Thu, 2 Apr 2015
06:22:47 -0700 (PDT)
X-Original-To: intel-gfx@lists.freedesktop.org
Delivered-To: intel-gfx@lists.freedesktop.org
Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by
gabe.freedesktop.org (Postfix) with ESMTP id 5BE566E2DA for
<intel-gfx@lists.freedesktop.org>; Thu, 2 Apr 2015 06:22:46 -0700 (PDT)
Received: from orsmga002.jf.intel.com ([10.7.209.21]) by
fmsmga103.fm.intel.com with ESMTP; 02 Apr 2015 06:22:46 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.11,511,1422950400"; d="scan'208";a="707918902"
Received: from deepu.iind.intel.com (HELO [10.223.82.144]) ([10.223.82.144])
by orsmga002.jf.intel.com with ESMTP; 02 Apr 2015 06:22:44 -0700
Message-ID: <551D41EA.20307@linux.intel.com>
Date: Thu, 2 Apr 2015 18:49:38 +0530
From: Deepak S <deepak.s@linux.intel.com>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
rv:31.0) Gecko/20100101 Thunderbird/31.5.0
To: Daniel Vetter <daniel@ffwll.ch>
References: <1427726038-19718-1-git-send-email-deepak.s@linux.intel.com>
<20150330154334.GC6354@phenom.ffwll.local>
In-Reply-To: <20150330154334.GC6354@phenom.ffwll.local>
CC: <intel-gfx@lists.freedesktop.org>
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Clean-up idr table if context
create fails.
X-BeenThere: intel-gfx@lists.freedesktop.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: Intel graphics driver community testing & development
<intel-gfx.lists.freedesktop.org>
List-Unsubscribe: <http://lists.freedesktop.org/mailman/options/intel-gfx>,
<mailto:intel-gfx-request@lists.freedesktop.org?subject=unsubscribe>
List-Archive: <http://lists.freedesktop.org/archives/intel-gfx>
List-Post: <mailto:intel-gfx@lists.freedesktop.org>
List-Help: <mailto:intel-gfx-request@lists.freedesktop.org?subject=help>
List-Subscribe: <http://lists.freedesktop.org/mailman/listinfo/intel-gfx>,
<mailto:intel-gfx-request@lists.freedesktop.org?subject=subscribe>
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"; format=flowed
Errors-To: intel-gfx-bounces@lists.freedesktop.org
Sender: Intel-gfx <intel-gfx-bounces@lists.freedesktop.org>
Return-Path: intel-gfx-bounces@lists.freedesktop.org
X-MS-Exchange-Organization-AVStamp-Mailbox: NAI;57084743;0;novirus
X-MS-Exchange-Organization-AuthSource: FMSMSX106.amr.corp.intel.com
X-MS-Exchange-Organization-AuthAs: Anonymous
Content-Length: 2282
CgpPbiBNb25kYXkgMzAgTWFyY2ggMjAxNSAwOToxMyBQTSwgRGFuaWVs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lZWRlc2t0b3Aub3JnCmh0dHA6Ly9saXN0cy5mcmVlZGVz
a3RvcC5vcmcvbWFpbG1hbi9saXN0aW5mby9pbnRlbC1nZngK
MIME-Version: 1.0
Received: from irsmsx102.ger.corp.intel.com [163.33.3.155]
by localhost.localdomain with IMAP (fetchmail-6.3.24)
for <damien@localhost> (single-drop); Thu, 02 Apr 2015 14:27:03 +0100 (BST)
Received: from fmsmsx106.amr.corp.intel.com (10.18.124.204) by
irsmsx155.ger.corp.intel.com (163.33.192.3) with Microsoft SMTP Server (TLS)
id 14.3.224.2; Thu, 2 Apr 2015 14:26:10 +0100
Received: from fmsmga001.fm.intel.com (10.253.24.23) by
FMSMSX106-1.cps.intel.com (10.18.124.204) with Microsoft SMTP Server id
14.3.224.2; Thu, 2 Apr 2015 06:26:08 -0700
Received: from fmsmga103.fm.intel.com ([10.1.193.90]) by
fmsmga001-1.fm.intel.com with ESMTP; 02 Apr 2015 06:25:59 -0700
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: A0D8AQD/Qh1VnLHS/INcg1pcgxXCIyAKhXMegSdMAQEBAQEBEgEBAQEBCAsJCRQuQQGDXQEBAQMBAQEgBA0SCh4OAwECBgEBHwUCHgQEAgICAQEjAR8QEQgFiCoFCLUzmDEBAQgBAQEBHoEhjmwyglKBRQWLIYk+g2SCJ4FXlwlnAYJCAQEB
X-IPAS-Result: A0D8AQD/Qh1VnLHS/INcg1pcgxXCIyAKhXMegSdMAQEBAQEBEgEBAQEBCAsJCRQuQQGDXQEBAQMBAQEgBA0SCh4OAwECBgEBHwUCHgQEAgICAQEjAR8QEQgFiCoFCLUzmDEBAQgBAQEBHoEhjmwyglKBRQWLIYk+g2SCJ4FXlwlnAYJCAQEB
X-IronPort-AV: E=Sophos;i="5.11,511,1422950400";
d="scan'208";a="28677975"
Received: from gabe.freedesktop.org ([131.252.210.177]) by mga14.intel.com
with ESMTP; 02 Apr 2015 06:25:45 -0700
Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by
gabe.freedesktop.org (Postfix) with ESMTP id 1804E6E1B6; Thu, 2 Apr 2015
06:25:45 -0700 (PDT)
X-Original-To: intel-gfx@lists.freedesktop.org
Delivered-To: intel-gfx@lists.freedesktop.org
Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by
gabe.freedesktop.org (Postfix) with ESMTP id C9F6B6E1B6 for
<intel-gfx@lists.freedesktop.org>; Thu, 2 Apr 2015 06:25:43 -0700 (PDT)
Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by
fmsmga102.fm.intel.com with ESMTP; 02 Apr 2015 06:25:43 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.11,511,1422950400"; d="scan'208";a="689477097"