<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from text --><style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<meta content="text/html; charset=UTF-8">
<style type="text/css" style="">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
<div dir="ltr">
<div id="x_divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Thanks Emil, I'll submit v2 to address your comments.</p>
<p><br>
</p>
<p>I'm using office365, not sure this mail is OK for formatting, otherwise I'll switch to a mail client.</p>
<p><br>
</p>
<p>Regards,</p>
<p>Qiang</p>
</div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Emil Velikov <emil.l.velikov@gmail.com><br>
<b>Sent:</b> Wednesday, July 13, 2016 7:15:43 PM<br>
<b>To:</b> Yu, Qiang<br>
<b>Cc:</b> amd-gfx@lists.freedesktop.org; ML dri-devel<br>
<b>Subject:</b> Re: [PATCH][libdrm] drm: Fix multi GPU drmGetDevice return wrong device</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">On 13 July 2016 at 11:17, Yu, Qiang <Qiang.Yu@amd.com> wrote:<br>
> Hi Emil,<br>
><br>
><br>
> Nice to hear from you.<br>
><br>
><br>
> On 11 July 2016 at 06:17, Qiang Yu <Qiang.Yu@amd.com> wrote:<br>
>> drmGetDevice will always return the first device it find<br>
>> under /dev/dri/. This is not true for multi GPU situation.<br>
>><br>
> How does the following alternative solution sound:<br>
>  - keep drmFoldDuplicatedDevices as is<br>
>  - after the drmFoldDuplicatedDevices call use the find_rdev to find<br>
> the correct device in local_devices.<br>
><br>
> [yuq] This is also OK. But drmFoldDuplicatedDevices() has to be changed for<br>
> the<br>
> drmFreeDevices() in the error handling path: it also exit after see a NULL<br>
> in the array.<br>
><br>
>> Plus fix the memory leak in error handling path of<br>
>> drmGetDevices.<br>
>><br>
> Unless I'm missing something, there is no memory leak fix below ?<br>
> Alternatively please keep it as separate patch.<br>
><br>
> [yuq] This is fixed at the same time by changing drmFoldDuplicatedDevices().<br>
><br>
Heh, silly me was assumed that your earlier patch fixed all the<br>
codepaths to handle the "holes" made by drmFoldDuplicatedDevices.<br>
Seems like the ones drmFreeDevices and drmGetDevice are still<br>
outstanding, thus the predicament.<br>
<br>
In this case we could do either:<br>
 - go with the above making sure drmFoldDuplicatedDevices doesn't create 'holes'<br>
Note: we still want to fix drmFreeDevices to continue (as opposed to<br>
break) when it sees one.<br>
 - or, fix drmGetDevice/drmFreeDevices<br>
<br>
In either case we want that as separate patch, bonus points for adding<br>
a inline comment about the behaviour of drmFoldDuplicatedDevices.<br>
<br>
About the core issue a trivial suggestion - s/move target to the first<br>
of local_devices/store target at local_devices[0] for ease to use<br>
below/<br>
<br>
Thanks<br>
Emil<br>
P.S. When working with mailing lists please use plain text emails.<br>
</div>
</span></font>
</body>
</html>