Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp816649ybf; Fri, 28 Feb 2020 08:11:30 -0800 (PST) X-Google-Smtp-Source: APXvYqw9fdZexkWMo4QfCFVIDP+OxREr017LEZx8LnTRTIqSl8rD/BlYmBlNNbwxb/LL5l1RhoiW X-Received: by 2002:aca:2412:: with SMTP id n18mr3696777oic.134.1582906290163; Fri, 28 Feb 2020 08:11:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582906290; cv=none; d=google.com; s=arc-20160816; b=DNDJE47utRjjMst0of1eHWIUdJYZAVL5PmIsVK99F00/1F8b53crP3cZlcL6e9B1Ax Aa0FvNcAL6aBOphgrLIUv4WgIoVAfCNSRWIApwrCYHquhbI9D6SlarqF6DXiKV4ZAfUf UUgwi8LtqcwHoGF1gHENlz+mDDOdAzq+3/xovEVGccO0cdolwaU/DeMQtiP9L6tGLTsg cxZArFqN2sQDuhYZMoZ1oRZnLF25vBEJLH8aosrtNV3XKQRFmSqFPMqCoFRujwZKMTIG PwoW2/POndm12Frwl3vfsuAXSSbPfWKzH+ux9ZJluVjD4Z4DgjnY1t7RAEGqS8J3ZE68 v+tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=TJIuVNRW5GZyI5ESRQqaE219pUI93KEK2zERenrB4AE=; b=hLY6yWIo5kbxpKumUBWaOz1yI8/qa1i3H46JMAXxzCRD07MoiMMI3ex3lin7kmt3f6 l1vFRyLMVuFG8eY76Mm2AXE6vMxYr30rs/NM3AMPP6LTyIfYFBkqjiIwJ5ryvw2lGTvo U+8dEAREGs7eHRTrz6XjKRo77izD79F0v9vh6IYEXwNSQw80xeBcGLc5V6tkytNe9Boy C4TCn5QL5gamMK89ZQAIPlWBPF12Mg83CP50CqbqpZiD0j2CVF0bYRuBFZX7vNljeT+Y E94dVDKPrm9iTxOZxWjai0k25CJqEEB/7SaOt00AKSMrQja5zCWHnN1bAmheysBEoDzB npBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=FZxR9CFN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15si2114557oih.41.2020.02.28.08.11.17; Fri, 28 Feb 2020 08:11:30 -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=@redhat.com header.s=mimecast20190719 header.b=FZxR9CFN; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725906AbgB1QKt (ORCPT + 99 others); Fri, 28 Feb 2020 11:10:49 -0500 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:45868 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725827AbgB1QKt (ORCPT ); Fri, 28 Feb 2020 11:10:49 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1582906248; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=TJIuVNRW5GZyI5ESRQqaE219pUI93KEK2zERenrB4AE=; b=FZxR9CFN4a0F2DDMdCkkx6M7/r2wJmilmrTGjl3IDTfFXZMoQy4A43JCEgNQYjjB937G71 NFpHemGf7fOKxfFe6vGQuJT59+yDuveA9tizRyhbY8TGOZS6zpED+JR6hC9zqOolFTgHKt ktTQnIbrfSzrEiE3G4oIr3TEhK3ny58= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-123-W0Pkfu7KMp2rwgHvaJxNmQ-1; Fri, 28 Feb 2020 11:10:46 -0500 X-MC-Unique: W0Pkfu7KMp2rwgHvaJxNmQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A884C100550E; Fri, 28 Feb 2020 16:10:44 +0000 (UTC) Received: from treble (ovpn-121-128.rdu2.redhat.com [10.10.121.128]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D20735DA2C; Fri, 28 Feb 2020 16:10:43 +0000 (UTC) Date: Fri, 28 Feb 2020 10:10:41 -0600 From: Josh Poimboeuf To: Chris Wilson Cc: linux-kernel@vger.kernel.org, Randy Dunlap , Peter Zijlstra , intel-gfx@lists.freedesktop.org Subject: Re: [PATCH] drm/i915: Minimize uaccess exposure in i915_gem_execbuffer2_ioctl() Message-ID: <20200228161041.ov7d5ox7myrnr4gi@treble> References: <158284236096.19174.6917853940060252533@skylake-alporthouse-com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <158284236096.19174.6917853940060252533@skylake-alporthouse-com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 27, 2020 at 10:26:00PM +0000, Chris Wilson wrote: > > --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c > > +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c > > @@ -2947,6 +2947,13 @@ i915_gem_execbuffer2_ioctl(struct drm_device *dev, void *data, > > u64_to_user_ptr(args->buffers_ptr); > > unsigned int i; > > > > + /* > > + * Do the call to gen8_canonical_addr() outside the > > + * uaccess-enabled region to minimize uaccess exposure. > > + */ > > + for (i = 0; i < args->buffer_count; i++) > > + exec2_list[i].offset = gen8_canonical_addr(exec2_list[i].offset); > > > Another loop over all the objects, where we intentionally try and skip > unmodified entries? To save 2 instructions from inside the second loop? > > Colour me skeptical. So are you're saying these arrays can be large and that you have performance concerns? -- Josh