From patchwork Fri Feb 10 15:29:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frode Isaksen X-Patchwork-Id: 9566987 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 4506660573 for ; Fri, 10 Feb 2017 15:37:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3195C285A0 for ; Fri, 10 Feb 2017 15:37:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 268C9285A2; Fri, 10 Feb 2017 15:37:52 +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.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, 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 130DA285A0 for ; Fri, 10 Feb 2017 15:37:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751836AbdBJPht (ORCPT ); Fri, 10 Feb 2017 10:37:49 -0500 Received: from mail-wr0-f176.google.com ([209.85.128.176]:34422 "EHLO mail-wr0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbdBJPh2 (ORCPT ); Fri, 10 Feb 2017 10:37:28 -0500 Received: by mail-wr0-f176.google.com with SMTP id o16so110761097wra.1 for ; Fri, 10 Feb 2017 07:37:07 -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=onHwQH+8gKbh8L1BEKCQaYIZ3bDTHreaJGVADQH7gpI=; b=aCg8nu01PBmKyw+ZxtjOAmpUjhhqyyxjdOUrEBG8odrcAX10l4w6sC6G02GMAr1958 mY7xY2HCjPy7lFdptlnHjLw9ZpAMuhls3WE8pIVDV+5KdHAD2jIq8zu3r1VgThBWHSUh NhDCXaRSPvsjbx5uDD8XPU7QsdNaGysuzxWvLxcWwamP1o0LqLLyLj0AJ3+Qabfefe/A AdJX9SfhBimMK/BCwPXL3j2LBKDuORWS1ikCmDIAGLlnIvztrMKjvnPcMFKDPl2bNJO7 EhRHVKzZWpsVBEtDWtz9+DNX/0JYXFjUsSukyY1osDtdxtPtmWk3YsrUzeqbeM02Oev/ 3ZvQ== 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=onHwQH+8gKbh8L1BEKCQaYIZ3bDTHreaJGVADQH7gpI=; b=mY2SGljDuHuE81TDDGUpNAQwYKbeZHR14afMGKta2lpMyGHz7BXXhpQM0AVPOsGDLJ A3hye1dZJm6Iy+vdr+VjjRj2DBKEpJQj0MAXc/Io3ucwwwj5QOkSrSTlYoEOtjdhVg0z s6J5VaAA3Hb63FmY9kWUsEkPx+NH5X5XqCLdfGJK9mXLKFDf7VHZ0B0w4FavTMfIUeVl 3mMGDEJmH2q+axVwaLgZaB08dJ4LNo36UWV6TiK4YevTfH/JObeVWlPPGVwYPBWmm+VO JoO1AiT0bZ2qU/R9RgVHf1M4rlhmMgx3fVohFE+bTP7SShyCtUe6En9h2JrMRhxKb07d rvyQ== X-Gm-Message-State: AMke39nOON8LnwjPcwZatF8pOVLbfi6SuBH1CZ+gFs+x9HMkg2Lt9OqgFfsRhmSNtV1vwHJm X-Received: by 10.223.145.227 with SMTP id 90mr8641677wri.156.1486740646307; Fri, 10 Feb 2017 07:30:46 -0800 (PST) Received: from localhost.localdomain ([90.63.244.31]) by smtp.gmail.com with ESMTPSA id o143sm2068192wmd.3.2017.02.10.07.30.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 10 Feb 2017 07:30:45 -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 7/8] spi: loopback-test: add option to use vmalloc'ed buffers Date: Fri, 10 Feb 2017 16:29:43 +0100 Message-Id: <1486740584-17875-8-git-send-email-fisaksen@baylibre.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1486740584-17875-1-git-send-email-fisaksen@baylibre.com> References: <1486740584-17875-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 ce552af..5618df3 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[] = { { @@ -970,13 +976,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; @@ -1004,8 +1016,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);