From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9FC12C47096 for ; Thu, 3 Jun 2021 07:32:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 6C7D7611C9 for ; Thu, 3 Jun 2021 07:32:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C7D7611C9 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ffwll.ch Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C1DB66F40B; Thu, 3 Jun 2021 07:32:38 +0000 (UTC) Received: from mail-oi1-x234.google.com (mail-oi1-x234.google.com [IPv6:2607:f8b0:4864:20::234]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9F03C6F40B for ; Thu, 3 Jun 2021 07:32:37 +0000 (UTC) Received: by mail-oi1-x234.google.com with SMTP id d21so5391369oic.11 for ; Thu, 03 Jun 2021 00:32:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=tbqXxzBQan5qZOKDHud6woka91j0ECnjHRdGUPfgw84=; b=UNDElItiuSVuFJY6RhUGyRLX/vcc9GuhIfJzApQ7tzNzc+K4jbKnP4HS8091PodGsR BeY6HZRqDMDA+abrWzc+7zQ2iW1kXpvoDUtEws2/ldepeZsMV+l5JdAg0flQHAoozBxt cOV0ddcIdwtjDjbo1UMBO9kV4gBKWu2Mri238= 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=tbqXxzBQan5qZOKDHud6woka91j0ECnjHRdGUPfgw84=; b=BKS1MN05ZdxuuGvFr9cfjQOfsO/8uekZdBXy57VMQlBnxyxhdwL5+hH+z1h/Szwtbc cFXC7bWOLBKebRj2+ni0CAlnIsUjqzYry2D4dXbIJemmsN3lYGqtAr9B1Fq7sQeG8h+8 3GBWd2c8OeuxCuXsfUh+yQzkxHVJeSelwXUszJqefQkRod02ANx0gmEFa+DjxpmJSkTz ce9MyU0kQxxEexkbk3JR8xkcTLRHB3aXja3FEDQx746MwuysH26Xo2BjE82ZWjMT8KQZ r+AkuFBtt7Vy1wXo47GDjP3L3iz5F4AV6a4+nYBhHL7YSkf/Ii6HjpB3YnunuFsMxJbb ZTvQ== X-Gm-Message-State: AOAM532ii5yOmKoDMAd5btKubmnwcEZlygBqQUCzpuSBOj4NnafUsMtZ MCRIl2CsCpd80roUykIBPeZC4FBF1d/wK6oVBaV8B7JCfmI= X-Google-Smtp-Source: ABdhPJxsXyGXmMMwj+H0+yYoAAlJQ64btO9wlxK2VBEVYaIliZxWr/H8ggDlea1r4cS40Kqq6SjWOB30zJwcIwIdUY4= X-Received: by 2002:aca:5701:: with SMTP id l1mr8487681oib.128.1622705556953; Thu, 03 Jun 2021 00:32:36 -0700 (PDT) MIME-Version: 1.0 References: <20210527162650.1182544-1-jason@jlekstrand.net> <20210527162650.1182544-22-jason@jlekstrand.net> In-Reply-To: From: Daniel Vetter Date: Thu, 3 Jun 2021 09:32:26 +0200 Message-ID: Subject: Re: [PATCH 21/29] drm/i915/gem: Use the proto-context to handle create parameters (v2) To: Jason Ekstrand Content-Type: text/plain; charset="UTF-8" X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Intel GFX , Maling list - DRI developers Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Thu, Jun 3, 2021 at 12:23 AM Jason Ekstrand wrote: > > On Mon, May 31, 2021 at 4:12 AM Daniel Vetter wrote: > > > > On Thu, May 27, 2021 at 11:26:42AM -0500, Jason Ekstrand wrote: > > > +static int set_proto_ctx_engines(struct drm_i915_file_private *fpriv, > > > + struct i915_gem_proto_context *pc, > > > + const struct drm_i915_gem_context_param *args) > > > +{ > > > + struct drm_i915_private *i915 = fpriv->dev_priv; > > > + struct set_proto_ctx_engines set = { .i915 = i915 }; > > > + struct i915_context_param_engines __user *user = > > > + u64_to_user_ptr(args->value); > > > + unsigned int n; > > > + u64 extensions; > > > + int err; > > > + > > > + if (!args->size) { > > > + proto_context_free_user_engines(pc); > > > + memset(&pc->legacy_rcs_sseu, 0, sizeof(pc->legacy_rcs_sseu)); > > > > Hm I wonder whether we shouldn't put this into the cleanup helper, and > > then maybe call it proto_context_reset_user_engines()? I think that makes > > the entire user engines vs sseu flow a notch clearer again. > > I fought with myself over this. The other two callers of > free_user_engines() would be fine with clearing out the SSEU as well, > I think, but neither of them need it. I erred on the side of putting > it in the one place it's actually needed to make it clear what's going > on here. I can move it if you'd like. So I'm wondering about semantics here a bit, and whether this is all real, as in, used in real userspace: Instead of resetting engines here, shouldn't we just complain if there's more than one engines_set command, ever, on a context? > As a bit of a P.S., I really hate the SSEU handling. It's horrible. > If I had it to do all over again, SSEU would be a purly dynamic > context param that you aren't allowed to set at create time. But, > sadly, we're in the mess we're in. :-( Yeah it's rather annoying. If we go with "only one engines_set per ctx create", then maybe we could streamline the SSEU stuff some more too? -Daniel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch