Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5771027pxj; Wed, 23 Jun 2021 08:36:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzodZmYRM9ugMrjmoPNDtoBqQa+gwpzC6oa2eXmz2MGGX2cTkuvEPFrY6o4RyJtLedcAjCI X-Received: by 2002:a17:907:9813:: with SMTP id ji19mr661522ejc.318.1624462616395; Wed, 23 Jun 2021 08:36:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624462616; cv=none; d=google.com; s=arc-20160816; b=scGrWL6+OZBSRjsVufqhPGoBW55svH9GMgmUqRQ+g1X+wR5oL6Ys6THmrYYfqSBC1m hXEH+CVHBoLowHOGEkE66sAfUKnztRmEcjzOoZIUEKbPVgwzyIZ970Sw+ow4kVbwPNku vFzem21qERocCFUKqH7T+uMeieLDARkJw0bSVTJrKxY3yk7qCJ+oDPV73C9LJxMQYuRA G5ttP2SMLGd1WgZCbobLDGEKWLLuaZYHW1lh0u9DEro+TENLMTtef8erV2x8ZMeXYYP9 vZTJu9eAfjbgKQ1/FZfmVmI6+bUgOAYUS5BZMPXUrY1W+zZa/SAnWQUoUnC7oHAkeJY7 z5WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=LjIR/sdRtsFDK8bZTsEpBj5GE6dxrPL0bOKYkhsGvZc=; b=p94jR6gkY7E5W0ZRKpbwKQoYwCuO2yYQFhJOndeX13bMJom+YC17T2zitxuaEGo6z5 k731bRJHKxckuSDWHLuVZm2CwLweORyMgoxUaktZ92nF02fMiyNNVXIxoapvCqUfNdHp P9GoZubIuOmuJTe1zBTZZCd+kmcvr8l04t3pYP+2uMnN0RKw4J4r3kqg+QtEIX7zXqJt OzHPciHMraCq882gXW7enZZAt7PHf7Cn247o2f1giuhX4Tm3gEwiBOwZeK0d9n/2tX3b +a3yFmDEjOa1XMBUt9qlyavQVytUjXimJWgrNOKsyeB7TwztPxth6ojU14yJupSkRhgQ oHoA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s18si28180eji.591.2021.06.23.08.36.33; Wed, 23 Jun 2021 08:36:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231396AbhFWPhl (ORCPT + 99 others); Wed, 23 Jun 2021 11:37:41 -0400 Received: from mga06.intel.com ([134.134.136.31]:41948 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229523AbhFWPhl (ORCPT ); Wed, 23 Jun 2021 11:37:41 -0400 IronPort-SDR: 5R0YjPbfnam1ka79dpZLE3E2iC6/1CgsfiNb6svrlCm+U6M4CgijBDUrj7fcpre0f0Ai4OeVZ9 iwI7guBcVVzQ== X-IronPort-AV: E=McAfee;i="6200,9189,10024"; a="268427698" X-IronPort-AV: E=Sophos;i="5.83,294,1616482800"; d="scan'208";a="268427698" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2021 08:34:38 -0700 IronPort-SDR: Ic+vQ/72rh0752HjI3D182s5di1XZZ7LJCwJJMEdDhjv+PSx0YXGbpbY2D68Ezz1sQqUgrxic1 vrslBJTFw63Q== X-IronPort-AV: E=Sophos;i="5.83,294,1616482800"; d="scan'208";a="487358319" Received: from iweiny-desk2.sc.intel.com (HELO localhost) ([10.3.52.147]) by orsmga001-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Jun 2021 08:34:37 -0700 Date: Wed, 23 Jun 2021 08:34:37 -0700 From: Ira Weiny To: Bernard Metzler Cc: Jason Gunthorpe , Mike Marciniszyn , Dennis Dalessandro , Doug Ledford , Faisal Latif , Shiraz Saleem , Kamal Heib , linux-rdma , linux-kernel Subject: Re: [PATCH V2] RDMA/siw: Convert siw_tx_hdt() to kmap_local_page() Message-ID: <20210623153437.GR1905674@iweiny-DESK2.sc.intel.com> References: <20210622203432.2715659-1-ira.weiny@intel.com> <20210622061422.2633501-5-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1 (2018-12-01) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 23, 2021 at 02:36:45PM +0000, Bernard Metzler wrote: > -----ira.weiny@intel.com wrote: ----- > > >@@ -506,11 +513,12 @@ static int siw_tx_hdt(struct siw_iwarp_tx > >*c_tx, struct socket *s) > > page_array[seg] = p; > > > > if (!c_tx->use_sendpage) { > >- iov[seg].iov_base = kmap(p) + fp_off; > >- iov[seg].iov_len = plen; > >+ void *kaddr = kmap_local_page(page_array[seg]); > > we can use 'kmap_local_page(p)' here Yes but I actually did this on purpose as it makes the code read clearly that the mapping is 'seg' element of the array. Do you prefer 'p' because this is a performant path? > > > > /* Remember for later kunmap() */ > > kmap_mask |= BIT(seg); > >+ iov[seg].iov_base = kaddr + fp_off; > >+ iov[seg].iov_len = plen; > > > > if (do_crc) > > crypto_shash_update( > >@@ -518,7 +526,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, > >struct socket *s) > > iov[seg].iov_base, > > plen); > > This patch does not apply for me. Would I have to install first > your [Patch 3/4] -- since the current patch references kmap_local_page() > already? Maybe it is better to apply if it would be just one siw > related patch in that series? Yes the other patch goes first. I split it out to make this more difficult change more reviewable. I could squash them as it is probably straight forward enough but I've been careful with this in other subsystems. Jason, do you have any issue with squashing the 2 patches? > > > > > } else if (do_crc) { > >- kaddr = kmap_local_page(p); > >+ kaddr = kmap_local_page(page_array[seg]); > > using 'kmap_local_page(p)' as you had it is straightforward > and I would prefer it. OK. I think this reads cleaner but I can see 'p' being more performant. > > > crypto_shash_update(c_tx->mpa_crc_hd, > > kaddr + fp_off, > > plen); > >@@ -542,7 +550,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, > >struct socket *s) > > > > if (++seg > (int)MAX_ARRAY) { > > siw_dbg_qp(tx_qp(c_tx), "to many fragments\n"); > >- siw_unmap_pages(page_array, kmap_mask); > >+ siw_unmap_pages(iov, kmap_mask, MAX_ARRAY); > > to minimize the iterations over the byte array in 'siw_unmap_pages()', > we may pass seg-1 instead of MAX_ARRAY Sounds good. > > > > wqe->processed -= c_tx->bytes_unsent; > > rv = -EMSGSIZE; > > goto done_crc; > >@@ -593,7 +601,7 @@ static int siw_tx_hdt(struct siw_iwarp_tx *c_tx, > >struct socket *s) > > } else { > > rv = kernel_sendmsg(s, &msg, iov, seg + 1, > > hdr_len + data_len + trl_len); > >- siw_unmap_pages(page_array, kmap_mask); > >+ siw_unmap_pages(iov, kmap_mask, MAX_ARRAY); > > to minimize the iterations over the byte array in 'siw_unmap_pages()', > we may pass seg instead of MAX_ARRAY Will do. Thanks for the review! :-D Ira