Received: by 10.223.164.221 with SMTP id h29csp2569904wrb; Mon, 9 Oct 2017 07:18:05 -0700 (PDT) X-Received: by 10.101.66.10 with SMTP id c10mr9269141pgq.272.1507558685490; Mon, 09 Oct 2017 07:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507558685; cv=none; d=google.com; s=arc-20160816; b=FkNFKBPoPy/HlbSs5ieHqJrBLwdB72Bwso529AzOR31tkgwwhrMLdLrxZafk8xtKal 0jsagoXyBJS2aap3xXbLvweWm4/zG4wGjFzaMBQT1N5Z4Y8iM1Q463S8xLfzqiiq4poy TXA3taW7UpvZTQnJvmasWTLrJ9CYO4A8bjuRpn5vzLF4kIeUjpEdMv1MtMuW2dLOFdRr NyPK+3F1d0dkMbFXFWuBM3X8AlyQJwDc0u3w6rg4IDWvtskD0LFKYb1M/PCnXDooBWeI x41Bf/g4mZP6MxyzVXKXpNK9j9/RsQd03w2SfmFWYwz4Q/k558IPW7o3Ieoq7N0ycjeJ nFtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=Td5b1/vkQuYLHjeGG00vIHU2S1Sbc40BmkdtqouGPUc=; b=W1YeBP4geNrqRSMo+A3CXGIdMew2kDU8lj1PFC1Y/YSWpMcPDRwUQ/KKQ8Slubd/XX 6t0JAyJpzr64hk/8VQNmT8R3b3DxGvEMCJO0tf+XKMbjdDi1YB5iwyIZcBsL0OHVV6fp CPZToddAEWhi+eG7XSWBYt91UaFWXa16OnnmQ6qHuy70USOsWlZFVD/w9CdUGtLlfuri O9pgevUiZesrxQXGMm/ZHrpGwH7Ot2XBGpG61IOkyH37zh+2Y8gcyxa6BbNlqPpWwoPz +/92OlIrMeimNCIexXkIB2BqIyvPXj9AZIS1M6z0v4EWH3MJ5Ek6efICQ88dh9MZWTcw DFvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gFQjNqKd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u3si1873809plb.171.2017.10.09.07.17.51; Mon, 09 Oct 2017 07:18:05 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gFQjNqKd; 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=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754331AbdJIORX (ORCPT + 99 others); Mon, 9 Oct 2017 10:17:23 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:47831 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751636AbdJIORW (ORCPT ); Mon, 9 Oct 2017 10:17:22 -0400 Received: by mail-lf0-f67.google.com with SMTP id k40so8010572lfi.4 for ; Mon, 09 Oct 2017 07:17:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Td5b1/vkQuYLHjeGG00vIHU2S1Sbc40BmkdtqouGPUc=; b=gFQjNqKd3bjEHo50Vi2LLXrm8oeJ611FMbPgpj49ZnW9OQQVQbZME7jQHyjnyauPFR z+/2y/dk5M/klreO202LhQhXG3RitjhrLFqVpZGir48gWrxeZ1cN44D8UJQL/TI4W3ko KrF5hc4OShscnJBo/G+/aSjitINanmzUnXc1uGt/yoH/Ubw/peJK6QM1RmJdOimT9D9B HS0kvfoPs1aOdn4RGkt1mAmAz/Cs3Rg0P6WjGDjLRf9fbIDmjfxR/4eBzNvCmQ2RL3/i OMprgzPIzSoud4Ow52+0AIOPnmpHmvXVv6hSNyy9YNYupwQa3hP+Votrym1jChnliVEc 2NuA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Td5b1/vkQuYLHjeGG00vIHU2S1Sbc40BmkdtqouGPUc=; b=f71LJAxsgaMndtoUKcaEDOQBf+D64H2HbpC8rvPeyYIBJVWECooDV7dXpki+ggvcvl +8J4xTDHvNh03rT45AM/UI+H7JqAKDHN3Z/WyZH9/pG5p4e2pW3El8GJHa1rUvFTOPcK m6PZ6IPhtnFeyFZsTxSeH7/iW/UpNeLNwmUrhVzG8GUnJECafa8845sukcuIbHOs6WYc KMNfZmLR+fOuytOMCPxAo4CM9sOAtWSaEHzdqv7D+GRwFrOw/A5ccKV7CeiizrileuRa Xn+PHAADhi25pVOljsPzIZLJ757UN1eFnz/3g3lyGXCtxgWaom4JKyLJPWty4QLer1E6 sL6A== X-Gm-Message-State: AMCzsaWUA3NudnQG4LLlBUfuxJM9ZjV6RHkGN2fmJ4I/k3R9udfN6JcM 969VA5Idbxfk+NdVpsDjv56lezIsHUMWvs1xm5k= X-Google-Smtp-Source: AOwi7QBnkEggUKQFyhY25IQ9gcvZyKhbKW6kRgq5A63Nw9HELssheb3EyCqqR+F3VScOhPuv/AZT57ldcWTPUOMUr0w= X-Received: by 10.25.147.65 with SMTP id v62mr3722382lfd.126.1507558640316; Mon, 09 Oct 2017 07:17:20 -0700 (PDT) MIME-Version: 1.0 Received: by 10.25.167.79 with HTTP; Mon, 9 Oct 2017 07:17:19 -0700 (PDT) In-Reply-To: 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: Pintu Kumar Date: Mon, 9 Oct 2017 19:47:19 +0530 Message-ID: Subject: Re: [PATCHv2 1/1] [tools]: android/ion: userspace test utility for ion buffer sharing To: Laura Abbott Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , Pintu Kumar Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. 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? 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 1580518838123451883@xxx Fri Oct 06 14:30:22 +0000 2017 X-GM-THRID: 1579656416160844925 X-Gmail-Labels: Inbox,Category Forums