From patchwork Fri Feb 17 10:38:24 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Isaksen X-Patchwork-Id: 9579557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 03EB3600F6 for ; Fri, 17 Feb 2017 10:38:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E4F22280B0 for ; Fri, 17 Feb 2017 10:38:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9D4828389; Fri, 17 Feb 2017 10:38:47 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 57291280B0 for ; Fri, 17 Feb 2017 10:38:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755649AbdBQKir (ORCPT ); Fri, 17 Feb 2017 05:38:47 -0500 Received: from mail-wr0-f182.google.com ([209.85.128.182]:36257 "EHLO mail-wr0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754986AbdBQKip (ORCPT ); Fri, 17 Feb 2017 05:38:45 -0500 Received: by mail-wr0-f182.google.com with SMTP id 89so22919699wrr.3 for ; Fri, 17 Feb 2017 02:38:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Ke9VKJPD5oXwlTBlYVpg7pnVzUvw3EAjCUdLw7dUBLg=; b=R0r5KzuVIgwjIob/XJg7Svp8Kz8/Hns5oReEwC5tJ9wfTujOTLcdZXLTW5IFnsOmW7 K/wC3/72jc4nJ6WO/M5GmIZeu2NKqQ8ZGhEK74AzZl6/dTswtNN+Ka6C6Ov7CdEjVyjS w8t6TLi4dTikJwOlcmGzhUSCJzv1tVGcGyifN9X3JMyVwXBGLqlt5Wu9owo44CSYdbr0 osUDnZF8WGPmEQa8yGJ0SyqUjM4ErtIDY3g6UxwwFzKKikBPPDwvAGTKqTBTDTGZzQoF A/LMj7On23FQ2hqqrpjEBWI70jy/ydldJaPo4EOpILeF/OaNX/G1JIWqLcK/PW3OoCYJ kLtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Ke9VKJPD5oXwlTBlYVpg7pnVzUvw3EAjCUdLw7dUBLg=; b=srJKkgOPfrruEAbEttcNSKVILc7HsLxGCDLPYY+On3Do3hVx6G2JDM4do/WDiluVOf ZW/jebpw8+KrgAUTU638tOsfwViZ3gmSHDIRLDxzc0cgOkmP34SkK4US8+adWVDCrEAq o9QiU1kJsOWAgbX2wdIXb2bzNw35ZbK0nrrj4RvcZeTSSRc2ajVHhbo7OC+owgHD1Kp6 jMTA+2VF4YUNqcJ8MsBfJe5Kt2k599rH+WulCsso1bqg8fvUfvPjNktaq+IowPQJ/Sjf A5JIVlmmdxzzd3MXK8FrfEGZusGi5WKIeUYH+5l03Esz+zQCeAkuT/aI64IXlp+o91OZ u09w== X-Gm-Message-State: AMke39mQIQC7nHYZsEpMpBsspSErrn0OcsTnnq3588Hmgn3a3YoD/v7E4bU4bzVGBxKMkQ9a X-Received: by 10.223.172.17 with SMTP id v17mr5780070wrc.115.1487327924230; Fri, 17 Feb 2017 02:38:44 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id y80sm12531459wrb.12.2017.02.17.02.38.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 17 Feb 2017 02:38:43 -0800 (PST) From: Frode Isaksen To: nsekhar@ti.com, khilman@baylibre.com, ptitiano@baylibre.com, linux-arm-kernel@lists.infradead.org Cc: broonie@kernel.org, linux-spi@vger.kernel.org, Frode Isaksen Subject: [PATCH v2 6/6] spi: loopback-test: add option to use vmalloc'ed buffers Date: Fri, 17 Feb 2017 11:38:24 +0100 Message-Id: <1487327904-28311-7-git-send-email-fisaksen@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1487327904-28311-1-git-send-email-fisaksen@baylibre.com> References: <1487327904-28311-1-git-send-email-fisaksen@baylibre.com> Sender: linux-spi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-spi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Using vmalloc'ed buffers will use one SG entry for each page, that may provoke DMA errors for large transfers. Also vmalloc'ed buffers may cause errors on CPU's with VIVT cache. Add this option to catch these errors when testing. Signed-off-by: Frode Isaksen --- drivers/spi/spi-loopback-test.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/spi/spi-loopback-test.c b/drivers/spi/spi-loopback-test.c index 50e620f..86686dd 100644 --- a/drivers/spi/spi-loopback-test.c +++ b/drivers/spi/spi-loopback-test.c @@ -55,6 +55,12 @@ module_param(run_only_test, int, 0); MODULE_PARM_DESC(run_only_test, "only run the test with this number (0-based !)"); +/* use vmalloc'ed buffers */ +int use_vmalloc; +module_param(use_vmalloc, int, 0644); +MODULE_PARM_DESC(use_vmalloc, + "use vmalloc'ed buffers instead of kmalloc'ed"); + /* the actual tests to execute */ static struct spi_test spi_tests[] = { { @@ -965,13 +971,19 @@ int spi_test_run_tests(struct spi_device *spi, /* allocate rx/tx buffers of 128kB size without devm * in the hope that is on a page boundary */ - rx = kzalloc(SPI_TEST_MAX_SIZE_PLUS, GFP_KERNEL); + if (use_vmalloc) + rx = vmalloc(SPI_TEST_MAX_SIZE_PLUS); + else + rx = kzalloc(SPI_TEST_MAX_SIZE_PLUS, GFP_KERNEL); if (!rx) { ret = -ENOMEM; goto out; } - tx = kzalloc(SPI_TEST_MAX_SIZE_PLUS, GFP_KERNEL); + if (use_vmalloc) + tx = vmalloc(SPI_TEST_MAX_SIZE_PLUS); + else + tx = kzalloc(SPI_TEST_MAX_SIZE_PLUS, GFP_KERNEL); if (!tx) { ret = -ENOMEM; goto out; @@ -999,8 +1011,13 @@ int spi_test_run_tests(struct spi_device *spi, } out: - kfree(rx); - kfree(tx); + if (use_vmalloc) { + vfree(rx); + vfree(tx); + } else { + kfree(rx); + kfree(tx); + } return ret; } EXPORT_SYMBOL_GPL(spi_test_run_tests);