Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp3430911pxb; Mon, 4 Apr 2022 16:46:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxW3lTaMuQSJPEJedaho3d0e6iZmvRDVq5ahiNY6cTXrDh9mDA3nJl8qEGtOie928dxb+C1 X-Received: by 2002:a17:903:1d1:b0:154:61ec:749b with SMTP id e17-20020a17090301d100b0015461ec749bmr700251plh.52.1649116011200; Mon, 04 Apr 2022 16:46:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649116011; cv=none; d=google.com; s=arc-20160816; b=yhs+DP2+fVLoo1n18Q4j7zCVAbh7SG73b466WGqD4432eS4QzSGNQxmotEOCr81LMb GEfTFFNARl1SfHfAmFl3P7jLDYdx/P6n8L5mJZMVjIhG1ZDu3wlq1sXYQZghPjfO4jxz YNpTMJ8AAKoo40+kTXvthNg3wyAODA6PHHocFo20SavsRI7Dii05y7olw0DveLAyeAoN iIiwFceY0SSU/j9vklASrX7TdQDnlqtg0zX3d9fc/h8no8FTwVm94ROnzlwo7Yo7YVcr Lwzz80RSe368j+YgCe/t0Z2zZCptUWn7OMWQpE2S5OEZ/8tcT8w4defwMR5FQEedXw6I kttg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=TrcDAAVQsEN9fh4kfb2eQXKsfmuGWvYQh1NBO3pyiYg=; b=gbfhI3SmPq1B0rnhkdrtodD4tdrvq35ui4YwW0MJ4kbsDfOzPeLTWZGKHhZk1HodP/ fsTk2EuIiYGZFkS+ejyDVCDD6thakt8M22jN1tGkvCNlR9Iw7uC9hWEimlJRWPaV0+mW SgYXJyZeXPqM/hcWXbHMJl6sD/iWmph+O5FBXqYtvsJQCWN+PIVKR7mK8e06Ov5dcYhw khG67uadGxCQGvdUNz4s4GozAtfiWjF2wfEYQmR+Ty05Swusoi6tzghMn1vdBkjd3ASy vtZ2xGkP64jcJEOXMoMQLpUJ3L8ey6dBwM75B+xEC9XV8YmR3Ii5NPdvrDPWMGVkbB8G 1iBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PaNRBi3D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id mi6-20020a17090b4b4600b001c664b49d24si598712pjb.168.2022.04.04.16.46.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Apr 2022 16:46:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=PaNRBi3D; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 4187213D59; Mon, 4 Apr 2022 16:34:00 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352615AbiDAUvD (ORCPT + 99 others); Fri, 1 Apr 2022 16:51:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53342 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiDAUvC (ORCPT ); Fri, 1 Apr 2022 16:51:02 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BC3791C2D9E for ; Fri, 1 Apr 2022 13:49:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648846152; x=1680382152; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=KV+pFZKLWh422cNJSg0ZSjERIplw9IBD5K8wbfwKPgc=; b=PaNRBi3DBKJ40DpUvdvM+6M7bpKy+hQXKYfqdSLj5PTcMLfBhCog5Urb xPJ0AzDuwV4z0UaRzSbxTcGNm+Fs43I9f5JOhiL7e71zRU+ilRtKixQeT zCPrT6OvMf1xyoLqvGsh2G1BklkCnn0SHP1hioN7IfOPFL1uoAetEroHS OvVzRFmHS9eMuqimkNAqu2p+5PYFssWC5rjwT3lNIaAluy5M4WOfi2mAP DtBH45/5cqGmgWaxMmdJeSp5odYoczk23IxYiQNjY80I4NzFAPNzYWXgQ 4OwCqJUGKN6iTdwN8KAwAED3p/fCN9emVlSxysSf2RZdvF603xf0Pbms8 A==; X-IronPort-AV: E=McAfee;i="6200,9189,10304"; a="346665035" X-IronPort-AV: E=Sophos;i="5.90,228,1643702400"; d="scan'208";a="346665035" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2022 13:49:11 -0700 X-IronPort-AV: E=Sophos;i="5.90,228,1643702400"; d="scan'208";a="650850877" Received: from kmislam-mobl1.amr.corp.intel.com (HELO localhost) ([10.212.112.89]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Apr 2022 13:49:11 -0700 Date: Fri, 1 Apr 2022 13:49:11 -0700 From: Ira Weiny To: "Fabio M. De Francesco" Cc: Nicolas Saenz Julienne , Greg Kroah-Hartman , bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, outreachy@lists.linux.dev Subject: Re: [PATCH] staging: vc04_services: Convert kmap() to kmap_local_page() Message-ID: References: <20220330191414.23141-1-fmdefrancesco@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220330191414.23141-1-fmdefrancesco@gmail.com> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 30, 2022 at 09:14:14PM +0200, Fabio M. De Francesco wrote: > The use of kmap() is being deprecated in favor of kmap_local_page() > where it is feasible. In file interface/vchiq_arm/vchiq_arm.c, > function free_pagelist() calls kmap() / kunmap() from two places. > > With kmap_local_page(), the mapping is per thread, CPU local and not > globally visible. Therefore, free_pagelist() is a function where the > use of kmap_local_page() in place of kmap() is correctly suited. > > Convert to kmap_local_page() but, instead of open coding it, use the > memcpy_to_page() helper. > > Signed-off-by: Fabio M. De Francesco LGTM: Reviewed-by: Ira Weiny > --- > .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 13 +++++-------- > 1 file changed, 5 insertions(+), 8 deletions(-) > > diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > index f0bfacfdea80..efb1383b5218 100644 > --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c > @@ -431,21 +431,18 @@ free_pagelist(struct vchiq_pagelist_info *pagelistinfo, > if (head_bytes > actual) > head_bytes = actual; > > - memcpy((char *)kmap(pages[0]) + > + memcpy_to_page(pages[0], > pagelist->offset, > fragments, > head_bytes); > - kunmap(pages[0]); > } > if ((actual >= 0) && (head_bytes < actual) && > - (tail_bytes != 0)) { > - memcpy((char *)kmap(pages[num_pages - 1]) + > - ((pagelist->offset + actual) & > - (PAGE_SIZE - 1) & ~(g_cache_line_size - 1)), > + (tail_bytes != 0)) > + memcpy_to_page(pages[num_pages - 1], > + (pagelist->offset + actual) & > + (PAGE_SIZE - 1) & ~(g_cache_line_size - 1), > fragments + g_cache_line_size, > tail_bytes); > - kunmap(pages[num_pages - 1]); > - } > > down(&g_free_fragments_mutex); > *(char **)fragments = g_free_fragments; > -- > 2.34.1 >