Received: by 10.223.164.221 with SMTP id h29csp2957112wrb; Mon, 9 Oct 2017 14:20:23 -0700 (PDT) X-Received: by 10.84.192.131 with SMTP id c3mr10346425pld.435.1507584023629; Mon, 09 Oct 2017 14:20:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507584023; cv=none; d=google.com; s=arc-20160816; b=WnZm1PNn7TkNtm8h+7ckmxrXG73TqzQyVeKjZtBSdFJIJ79jaN6er4FUFlEGj4i8gj uMQb9xmrsYpEIktbHnO9lYwbn8ChYkZFJF7e9FaJyub/PguVlooeHY7PDUjFxLZWlmrh 1Lbud6ybywIRtGUelvbK3jzP/b3bqYDQ3pQvkDLMiIR9qI23uptgSQObqLDmjxFyqjnz OqdKg+60pgrg/oXsOyRMYqPRSZgsWkVRSjv115anLjEH7rZ2mRJvJhnMsfmgBidXDdOq v3y2ZMPKERABP0uQmKPrAWDpWbyvOEfL8DJ1q0gvzfs0I4CwkxhsLjZ0d+OdX8oi0R/w sTWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=yYHDJQlFh0T6abpST2hiFHvd9jQ5vv4/gAblmwhjthI=; b=Yt6DmfH3tm/9LVFnlXq0bzlIGoM+WIBJEcxQEXNHLfb6Z6MPnnItsbruqJtKCrVBs3 i43qAH5Cc/ZwI4gaGh3UAfZ5fgiR5cSnfnmDcGXeS8VCKp0dyaAoOt0yaTwUJ6caJSJK uqeik+1txKbOjj0O11txWG6shCyRujsd3BWupJo+jQmRee/RZ8l3QTOyCcqhL/K57kwe LTmHI+Um85cRvkx00jwGq2N+KC/vFXITC61SRCDaa3cKATyf4ruKdZxwvqVFXkA6cDvi kkg4TAs0jip3nV7E9RiuCk0ZCjjx448h0QIBQi9N3RbwdbqV2giO7YxhMfmGFctKTzgq ZyUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si7820732plm.480.2017.10.09.14.20.09; Mon, 09 Oct 2017 14:20:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755476AbdJIVTl (ORCPT + 99 others); Mon, 9 Oct 2017 17:19:41 -0400 Received: from mail-oi0-f52.google.com ([209.85.218.52]:56081 "EHLO mail-oi0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755071AbdJIVTk (ORCPT ); Mon, 9 Oct 2017 17:19:40 -0400 Received: by mail-oi0-f52.google.com with SMTP id g125so24481541oib.12 for ; Mon, 09 Oct 2017 14:19:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=yYHDJQlFh0T6abpST2hiFHvd9jQ5vv4/gAblmwhjthI=; b=tQOD29zdkdm6AsIx8UA2Se615RL5aX47Mm74FUiDscMnMRtCFNuBv/uKeMS5BYp0Fw Hc9FbSyPil5BVpf0gQKkId4tZFDHe1SdutVY6bJE1ZontqvWX3+dzV9tYW68LSLn7M5U yJw/e4eTLi+OepmIy0K1lq5VA52fZ8dEYCSmZ3A+bY+ZoNGDg1gGd6Lg/J9ZLp4pIjBd QBYeXIZq34Rf0vyuTCzWv97YhzGY2eI0WI1U/HDeYbJ1E6Ut6JqhGz/vpT8BZgbjI07I f0JVzZqPCDZayS4LHnQsdDE7tDuI490tblVxW52PgvUW48AAqaSgy86RPrBQVVFcCDPQ QVsQ== X-Gm-Message-State: AMCzsaWWvVUSiAooha6b3gQF9yEXIifob7VgzIfY1zGoiBBt9SN6xRCR XNZxkULRLfdfTwt5iADZR+9bRg== X-Google-Smtp-Source: AOwi7QAtwJnNTSOj9rT0KGSJL92Oyggx36YrrbnT75XrjoxGjAgI+GBq9Tpc6gLLx+DYjZmRrkKJcw== X-Received: by 10.202.96.213 with SMTP id u204mr5465796oib.366.1507583979373; Mon, 09 Oct 2017 14:19:39 -0700 (PDT) Received: from ?IPv6:2601:602:9802:a8dc::e174? ([2601:602:9802:a8dc::e174]) by smtp.gmail.com with ESMTPSA id a65sm2195490oih.45.2017.10.09.14.19.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Oct 2017 14:19:38 -0700 (PDT) Subject: Re: [PATCHv2 1/1] [tools]: android/ion: userspace test utility for ion buffer sharing To: Pintu Kumar Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Pintu Kumar References: <1506449281-8790-1-git-send-email-pintu.ping@gmail.com> <1507049339-16963-1-git-send-email-pintu.ping@gmail.com> <414b44ec-6500-c3e5-f8ca-ce1d21a3eb58@redhat.com> From: Laura Abbott Message-ID: <0984bfc6-abea-3078-2fe5-896fd5223475@redhat.com> Date: Mon, 9 Oct 2017 14:19:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/09/2017 07:17 AM, Pintu Kumar wrote: > On Fri, Oct 6, 2017 at 7:58 PM, Pintu Kumar wrote: >>>> + >>>> + heap_type = ion_info->heap_type; >>>> + heap_size = ion_info->heap_size; >>>> + flag_type = ion_info->flag_type; >>>> + alloc_data.len = heap_size; >>>> + alloc_data.heap_id_mask = heap_type; >>> >>> The heap type and heap ID are not the same thing. You need >>> to determine the heap id from using the new query ioctl. >>> >> >> Hello Laura, >> Can you point out some example on how to retrieve heap_id from query ioctl. >> Sorry, I am not able to figure out, how can I get a specific heap_id >> if I know the heap_type. >> Do, I need to query all the heaps? Then how do I map to heap_data for each heap? >> Here is what I am doing. >> >> struct ion_heap_query query; >> struct ion_heap_data heap_data[5]; >> >> query.cnt = 5; >> /* Query ION heap_id_mask from ION heap */ >> ret = ioctl(ionfd, ION_IOC_HEAP_QUERY, &query); >> if (ret < 0) { >> fprintf(stderr, "<%s>: Failed: ION_IOC_HEAP_QUERY: %s\n", >> __func__, strerror(errno)); >> goto err_heap; >> } >> >> After this how to map each heap_data[..] to query.heaps? >> Do you have any examples? > > Dear Laura, > I figured out myself. > Now I am able to query heap_id from the new QUERY ioctl. > Also I have added a script to test all the heaps from single terminal. > Things are working fine. > I will post the new patch set soon. > However I have few questions to be clarified. > 1) I have moved the test setup under: tools/testing/selftests/android/ion/ > So that it can be included easily in selftests framework later. > Hope this is fine. > Is it actually hooked up to the selftest framework? Please make sure it actually runs under the kselftest framework. > 2) I observed that ION_HEAP_TYPE_DMA heap type is returned as > "reserved" heap name. > However allocation goes through CMA area. Hope this is expected behavior. > > 3) For me CHUNK & CARVEDOUT heap is not working, on my Ubuntu PC. > So I could not check it. > I know these heaps needs to be declared first, may be in device > tree or somewhere else. > Do you know how to verify this on Ubuntu x86 PC? > The answer to both of these is that Ion is now doing heap enumeration differently. Using heap types as arguments to heap ids never really made much sense since it was conflating heap types with actual instances of heaps. The ion test module which tried to set up one of each type of heap was deleted. There really isn't any need to test multiple heap types anyway. This is a buffer sharing test and the underlying allocation doesn't have anything to do with that. Let's just get rid of the different heap types and just use the system heap which should always be available. While we're at it, just drop specifying the allocation size on the command line as well and use something hardcoded. Thanks, Laura > 4) Please see the snapshots of output from the test results. > > linux/tools/testing/selftests/android/ion$ sudo ./ion_test.sh > heap_type: 0, heap_size: 10 > -------------------------------------- > heap type: 0 > heap id: 1 > heap name: ion_system_heap > -------------------------------------- > Fill buffer content: > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > Sharing fd: 6, Client fd: 5 > : buffer release successfully.... > Received buffer fd: 4 > Read buffer content: > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0x0 0x0 0x0 0x0 0x0 > 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 > Fill buffer content: > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > 0xfd 0xfd 0xfd 0xfd > : buffer release successfully.... > ion_test.sh: heap_type: 0 - [PASS] > > heap_type: 1, heap_size: 10 > -------------------------------------- > heap type: 1 > heap id: 0 > heap name: ion_system_contig_heap > -------------------------------------- > Fill buffer content: > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > Sharing fd: 6, Client fd: 5 > : buffer release successfully.... > Received buffer fd: 4 > Read buffer content: > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0x0 0x0 0x0 0x0 0x0 > 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 > Fill buffer content: > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > 0xfd 0xfd 0xfd 0xfd > : buffer release successfully.... > ion_test.sh: heap_type: 1 - [PASS] > > heap_type: 2, heap_size: 10 > : ERROR: heap type does not exists > FAILED: ion_get_buffer_fd > : buffer release successfully.... > Received buffer fd: 0 > ERROR: improper buf fd > ion_test.sh: heap_type: 2 - [FAIL] > > heap_type: 3, heap_size: 10 > : ERROR: heap type does not exists > FAILED: ion_get_buffer_fd > : buffer release successfully.... > Received buffer fd: 0 > ERROR: improper buf fd > ion_test.sh: heap_type: 3 - [FAIL] > > heap_type: 4, heap_size: 10 > -------------------------------------- > heap type: 4 > heap id: 2 > heap name: reserved > -------------------------------------- > Fill buffer content: > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > Sharing fd: 6, Client fd: 5 > : buffer release successfully.... > Received buffer fd: 4 > Read buffer content: > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > 0xfd 0xfd 0xfd 0xfd > Fill buffer content: > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd 0xfd > 0xfd 0xfd 0xfd 0xfd > : buffer release successfully.... > ion_test.sh: heap_type: 4 - [PASS] > > done.... > > > > > Thanks, > Pintu > From 1580789856373126670@xxx Mon Oct 09 14:18:05 +0000 2017 X-GM-THRID: 1579656416160844925 X-Gmail-Labels: Inbox,Category Forums