Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759217AbcDHWoG (ORCPT ); Fri, 8 Apr 2016 18:44:06 -0400 Received: from mail-qg0-f51.google.com ([209.85.192.51]:36238 "EHLO mail-qg0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759143AbcDHWoE (ORCPT ); Fri, 8 Apr 2016 18:44:04 -0400 Subject: Re: [PATCH] ion: scatterlist offset not used for buffer map To: gregkh@linuxfoundation.org, arve@android.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org References: <1460028599-22356-1-git-send-email-john.reitan@foss.arm.com> <5706B70E.4040004@redhat.com> <20160408065626.GA25580@e106921-lin.trondheim.arm.com> From: Laura Abbott Message-ID: <5708342F.8070704@redhat.com> Date: Fri, 8 Apr 2016 15:43:59 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1 MIME-Version: 1.0 In-Reply-To: <20160408065626.GA25580@e106921-lin.trondheim.arm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1234 Lines: 29 On 04/07/2016 11:56 PM, John Einar Reitan wrote: > On Thu, Apr 07, 2016 at 12:37:50PM -0700, Laura Abbott wrote: >> On 04/07/2016 04:29 AM, John Einar Reitan wrote: >>> ion's default user/kernel page mapping code don't honor the offset >>> option for scatterlists. It uses sg_page and expect the whole page to be >>> mapped, while the offset could dictate an offset within a large page. >>> >>> sg_phys correctly accounts for the offset, so should be used instead. >>> >> >> Can you be more specific about which heap and which allocation pattern >> is exposing this bug? > > The heap that exposed the bug is one I'm developing and will be posting > as a RFC soon. It uses compound pages and an sub-divides it into surface > buffers. The ion buffers are configured to hold sgl's with the compound > page and the correct offset of the buffer, via > sg_set_page(.., compound_page, .., offset_of_logical_buffer); > > sg_phys/sg_virt includes this offset, but if you poke the sg and extract > the page with sg_page yourself you must include this offset in your > calculations too. > This patch should be re-sent when you have the RFC for the heap. Unless there is a heap available in tree we don't really need this patch. Thanks, Laura