Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp5718390ybl; Tue, 14 Jan 2020 13:50:49 -0800 (PST) X-Google-Smtp-Source: APXvYqxYHKz9M7g+RmdRPboPPne7s0Sh5BiKqUTOh/tc6PpXZ/hEElPa1mXk+Kb4mbKcqHjqJrAJ X-Received: by 2002:a05:6808:10d:: with SMTP id b13mr18853083oie.69.1579038649881; Tue, 14 Jan 2020 13:50:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579038649; cv=none; d=google.com; s=arc-20160816; b=CtC+yHbHeT2uFGAJf2dc6z/QxWYAcbCZIhBwUd/x1cjDnz4rQM2fmPRXxSvs7x9VNt amGS3wyA6DH/nDejFPPUOayV+VuT7DyjEo9jB5DCKwbVkn1G6GWWiesEayxlJCbRG7HQ 5OOEX5pFpBPHgzqtubWB4R8l0VxTKkImbUzUX4ZioKFpZdkhxmHrySNCoMO6VWBWvjTO mms4Q7QYPudxXVxBAwwQ55m/ijArx91BHh4InZiKoRAHxnCCkiaGj/rn/DIds+2eBV/S nPlQh2Lw69ugXBfFjnhOh88HDTixqQSWmQIseLbaX+e1H7lBeI2JV3eztFWLN/R8GVL7 aP5A== 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 :in-reply-to:references:mime-version:dkim-signature; bh=Vctch71naqEGLrugWbqoCH3ToLlQlQB3yrVoOl+SPvs=; b=xnc7sppIzoQxYjrAfGRNBuaLjQdAearzQND/kmW6QkQDlHizGytZaEOEcZSHlkBxhv T0lCLr4MBLtIF14dedAaSHOXBPbHQjEu2q3OwUv0OY0REJ6MV5XGD5+kwQDcOTnc3xkv 5+xPh+JXznSTMKiEJ0r+kbHLS8THX3FuMEigpixHnhsQuSBEpFdRjMAt4GqDw5PUAIab CQ6m/OI8w5eYN/+v0FKRndV2jlNjfcb/Pb7W3FhX0K/zwnoGPwMJXfLghqS/qCshD4/y Er8Sv4+JyxQvwmukka6DPA5vGDPMu1l6HzQRIFWxlrKwFR47YSVmi/QuT3yWNbcVN4/+ 5sQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=KZsiFFqP; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a64si8778860oii.266.2020.01.14.13.50.36; Tue, 14 Jan 2020 13:50:49 -0800 (PST) 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=@linux-foundation.org header.s=google header.b=KZsiFFqP; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728943AbgANVtY (ORCPT + 99 others); Tue, 14 Jan 2020 16:49:24 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:41096 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727102AbgANVtY (ORCPT ); Tue, 14 Jan 2020 16:49:24 -0500 Received: by mail-lj1-f196.google.com with SMTP id h23so16129640ljc.8 for ; Tue, 14 Jan 2020 13:49:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Vctch71naqEGLrugWbqoCH3ToLlQlQB3yrVoOl+SPvs=; b=KZsiFFqPOkrryEiWdCUg5hoXCgV2OLEIU5JBuDM284Mh6WRn/AjOiD1HtsNJRqviVx 9kKzxAmtgZreU18bWEW2HXaM6Ao4fNRodAVWs6R4i29I6H6YakNGcUy2JKOXR0tVereO 66FAx40w7vVtGWNG+UhiUq933mXri6+ihEilQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Vctch71naqEGLrugWbqoCH3ToLlQlQB3yrVoOl+SPvs=; b=V5mRjTi2nufpRLACuA+XNavXwCzY8mX5MHHq3kLfMdw9+ugB5EYjSTWZ3g7B6puSUX MfuCySJ7Fv+H1Te59mYp4Z22VWwHEs+X+2tFUvOqyl1GPJVGecAMQJPLQedLCuDmg6bQ HgkWcXMlaSA9BFPLd2QhlSttPnqFl7oHCtGeH1Ux3HmSdbEMRJX02JBnB0PFrwF3FFFF CO/2X81fnFQP90AXM0g0ukLZaqp+QhDy/PaYyRupqFVWJXyMITs9O9UDi/hUNuTG9tJm 1s6hrJHejZx/Yo1vglp4YKqjmMHJoolNg6uz5l/J+IdXGoo7LAXCnIvNQ8xDpNrSHPQb Ilng== X-Gm-Message-State: APjAAAXYi6/EvQt5u5JlTowsuRF/Eyk429yCeuHCBhlXJYLEGGatfX00 dx0rmhz3rmoCW3zd8P5ICeIDKPSkOxk= X-Received: by 2002:a05:651c:204f:: with SMTP id t15mr16374836ljo.240.1579038560631; Tue, 14 Jan 2020 13:49:20 -0800 (PST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com. [209.85.167.54]) by smtp.gmail.com with ESMTPSA id n11sm8070638ljg.15.2020.01.14.13.49.19 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Jan 2020 13:49:19 -0800 (PST) Received: by mail-lf1-f54.google.com with SMTP id n25so11075695lfl.0 for ; Tue, 14 Jan 2020 13:49:19 -0800 (PST) X-Received: by 2002:a19:48c5:: with SMTP id v188mr3185145lfa.100.1579038558938; Tue, 14 Jan 2020 13:49:18 -0800 (PST) MIME-Version: 1.0 References: <20200114200846.29434-1-vgupta@synopsys.com> <20200114200846.29434-5-vgupta@synopsys.com> <3734021d-1756-3a09-6595-14ca58c64bf9@synopsys.com> In-Reply-To: <3734021d-1756-3a09-6595-14ca58c64bf9@synopsys.com> From: Linus Torvalds Date: Tue, 14 Jan 2020 13:49:03 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC 4/4] ARC: uaccess: use optimized generic __strnlen_user/__strncpy_from_user To: Vineet Gupta Cc: Arnd Bergmann , Khalid Aziz , Andrey Konovalov , Andrew Morton , Peter Zijlstra , Christian Brauner , Kees Cook , Ingo Molnar , Aleksa Sarai , "open list:SYNOPSYS ARC ARCHITECTURE" , "linux-kernel@vger.kernel.org" , linux-arch 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 Tue, Jan 14, 2020 at 1:37 PM Vineet Gupta wrote: > > On 1/14/20 12:42 PM, Arnd Bergmann wrote: > > > > What's wrong with the generic version on little-endian? Any > > chance you can find a way to make it work as well for you as > > this copy? > > find_zero() by default doesn't use pop count instructions. Don't you think the generic find_zero() is likely just as fast as the pop count instruction? On 32-bit, I think it's like a shift and a mask and a couple of additions. The 64-bit case has a multiply that is likely expensive unless you have a good multiplication unit (but what 64-bit architecture doesn't?), but the generic 32-bit LE code should already be pretty close to optimal, and it might not be worth it to worry about it. (The big-endian case is very different, and architectures really can do much better. But LE allows for bit tricks using the carry chain) Linus