<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX Processorsのトピックi.MX6 Linux frame buffer initialization</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Linux-frame-buffer-initialization/m-p/383161#M55360</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using NG6 based custom board with L3.0.35_4.0.0 BSP.&lt;/P&gt;&lt;P&gt;While debugging a kernel panic, related to IPU channel interrupt, triggered early in the kernel initialization, I have discovered a possible race condition that may lead to kernel panic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Consider the following call chain from drivers/video/mxc/mxc_ipuv3_fb.c:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;mxcfb_probe() -&amp;gt; mxcfb_register() -&amp;gt; ipu_request_irq().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;The requested interrupt (channel interrupt, EOF) is cleared and then enabled inside ipu_request_irq(). Then immediately after that call there is a call to ipu_disable_irq(mxcfbi-&amp;gt;ipu, mxcfbi-&amp;gt;ipu_ch_irq).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;My understanding (based on the code) is that the intention is to register the interrupt line and to keep it disabled until later time.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;However the above sequence is not atomic.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;If there is a HW interrupt generated somehow &lt;SPAN style="font-size: 10pt;"&gt;between i&lt;SPAN style="font-size: 10pt;"&gt;pu_request_irq() and i&lt;SPAN style="font-size: 10pt;"&gt;pu_disable_irq() calls&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;, it will be serviced:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;__irq_svc() ... mxcfb_irq_handler().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;In mxcfb_irq_handler(), there is a completion signalled. However that completion is not initialized, no call to init_completion(&amp;amp;mxc_fbi-&amp;gt;flip_complete) yet.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;That happens later in _setup_disp_channel2(), in mxcfb_set_par().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Because that &lt;SPAN style="font-size: 10pt;"&gt;completion is not yet initialized, that causes kernel to panic while servicing the EOF interrupt, because some of the &lt;SPAN style="font-size: 10pt;"&gt;completion structure members are not initialized.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I have also looked at imx_3.0.35_4.1.0 and&amp;nbsp; imx_3.0.101 branches, but no code difference in regards to this problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Do you think this is a real problem or I have missed something ...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Stefan.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 01 Dec 2014 12:44:18 GMT</pubDate>
    <dc:creator>stefanstefanov</dc:creator>
    <dc:date>2014-12-01T12:44:18Z</dc:date>
    <item>
      <title>i.MX6 Linux frame buffer initialization</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Linux-frame-buffer-initialization/m-p/383161#M55360</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi community,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am using NG6 based custom board with L3.0.35_4.0.0 BSP.&lt;/P&gt;&lt;P&gt;While debugging a kernel panic, related to IPU channel interrupt, triggered early in the kernel initialization, I have discovered a possible race condition that may lead to kernel panic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Consider the following call chain from drivers/video/mxc/mxc_ipuv3_fb.c:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;mxcfb_probe() -&amp;gt; mxcfb_register() -&amp;gt; ipu_request_irq().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;The requested interrupt (channel interrupt, EOF) is cleared and then enabled inside ipu_request_irq(). Then immediately after that call there is a call to ipu_disable_irq(mxcfbi-&amp;gt;ipu, mxcfbi-&amp;gt;ipu_ch_irq).&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;My understanding (based on the code) is that the intention is to register the interrupt line and to keep it disabled until later time.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;However the above sequence is not atomic.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;If there is a HW interrupt generated somehow &lt;SPAN style="font-size: 10pt;"&gt;between i&lt;SPAN style="font-size: 10pt;"&gt;pu_request_irq() and i&lt;SPAN style="font-size: 10pt;"&gt;pu_disable_irq() calls&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;, it will be serviced:&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;__irq_svc() ... mxcfb_irq_handler().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;In mxcfb_irq_handler(), there is a completion signalled. However that completion is not initialized, no call to init_completion(&amp;amp;mxc_fbi-&amp;gt;flip_complete) yet.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;That happens later in _setup_disp_channel2(), in mxcfb_set_par().&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Because that &lt;SPAN style="font-size: 10pt;"&gt;completion is not yet initialized, that causes kernel to panic while servicing the EOF interrupt, because some of the &lt;SPAN style="font-size: 10pt;"&gt;completion structure members are not initialized.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;I have also looked at imx_3.0.35_4.1.0 and&amp;nbsp; imx_3.0.101 branches, but no code difference in regards to this problem.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Do you think this is a real problem or I have missed something ...&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Cheers,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-size: 10pt;"&gt;Stefan.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 01 Dec 2014 12:44:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Linux-frame-buffer-initialization/m-p/383161#M55360</guid>
      <dc:creator>stefanstefanov</dc:creator>
      <dc:date>2014-12-01T12:44:18Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 Linux frame buffer initialization</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Linux-frame-buffer-initialization/m-p/383162#M55361</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I got the reply from the expert:&lt;/P&gt;&lt;P&gt;========&lt;/P&gt;&lt;P&gt;IPU will not generate interrupt before the mxcfb_probe returns. &lt;/P&gt;&lt;P&gt;Before the fb driver initialization completes, there is no display data can write to framebuffer, &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 03:03:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Linux-frame-buffer-initialization/m-p/383162#M55361</guid>
      <dc:creator>jimmychan</dc:creator>
      <dc:date>2015-01-09T03:03:06Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX6 Linux frame buffer initialization</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Linux-frame-buffer-initialization/m-p/383163#M55362</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello ,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sometimes between ipu_request_irq and ipu_disable_irq function, my kernel crashes showing NULL pointer error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;Also when I put a printk in the "ipu_disable_irq" function it crashes; again with NULL pointer error. What could be the reason of seldom crash occurrence?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In ipu_disable_irq function we have "spin_lock_irqsave" and "spin_unlock_irqrestore". What is their significance?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Shrikant&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 12 Nov 2016 10:51:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX6-Linux-frame-buffer-initialization/m-p/383163#M55362</guid>
      <dc:creator>shrikantchikodi</dc:creator>
      <dc:date>2016-11-12T10:51:54Z</dc:date>
    </item>
  </channel>
</rss>

