Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 0C714CDB474 for ; Mon, 16 Oct 2023 13:27:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B05B710E1D9; Mon, 16 Oct 2023 13:27:25 +0000 (UTC) Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.100]) by gabe.freedesktop.org (Postfix) with ESMTPS id B1C2210E1D9 for ; Mon, 16 Oct 2023 13:27:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1697462844; x=1728998844; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=zMahU4VxtTe1D6RA08HDtoaXEFqZ+ZoKr4blNA4Cb0o=; b=P6cf6iF8oAbov+S+l2U6cJG/lqqzvmkWiMNZNTsQbLU/yKWxAdNSSiMH e9mOUsuz7JoL15scjW2YYj4SY3GM48x6G2PI+fG2nsB/2CcUr6O9GBd7q /FwuriU1JYj4SrU7nqkK1BtGAPlA67MKxdnh5yPykYBLtxp2jkKc9B0iO vRdQHB65x1jlPRvszvi7f119C95DtkaRAFwFSNe8TuJC1/6Ja7SEfJFnc 65ZEjahqH8cWTNqe3zeT/TfRybIJl7821WfI2XqRxqfxtwiJgXAimryRy wAnB5l3HUNlmHztHIABHv9AVXc+/6nApDk4FhdZcK4LD1ntkm5IMEDzVq g==; X-IronPort-AV: E=McAfee;i="6600,9927,10863"; a="452004688" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="452004688" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 06:27:24 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10863"; a="755694945" X-IronPort-AV: E=Sophos;i="6.03,229,1694761200"; d="scan'208";a="755694945" Received: from hlykke-mobl.ger.corp.intel.com (HELO [10.249.254.194]) ([10.249.254.194]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Oct 2023 06:27:22 -0700 Message-ID: <38020a85-22fb-9a86-b6a8-a60614ae7d80@linux.intel.com> Date: Mon, 16 Oct 2023 15:27:19 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Content-Language: en-US To: Francois Dugast References: <20231013102226.2961-1-thomas.hellstrom@linux.intel.com> <51dcf3d7-fe44-cebd-7922-b29e3d864cbc@linux.intel.com> From: =?UTF-8?Q?Thomas_Hellstr=c3=b6m?= In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Intel-xe] [RFC PATCH] drm/xe/uAPi: Clarify the meaning of min_page_size and MIN_ALIGNMENT X-BeenThere: intel-xe@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel Xe graphics driver List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-xe@lists.freedesktop.org, Rodrigo Vivi Errors-To: intel-xe-bounces@lists.freedesktop.org Sender: "Intel-xe" On 10/16/23 13:30, Francois Dugast wrote: > On Mon, Oct 16, 2023 at 01:03:07PM +0200, Thomas Hellström wrote: >> Hi, >> >> On 10/13/23 22:16, Rodrigo Vivi wrote: >>> On Fri, Oct 13, 2023 at 12:22:26PM +0200, Thomas Hellström wrote: >>>> In particular, don't *enforce* alignment of buffer object sizes to >>>> MIN_ALIGNMENT, as enforcing that for imported dma-bufs would not >>>> really make sense. >>>> >>>> Cc: Maarten Lankhorst >>>> Cc: Zbigniew Kempczyński >>>> Cc: Rodrigo Vivi >>>> Cc: Matthew Brost >>>> Cc: Francois Dugast >>>> Signed-off-by: Thomas Hellström >>>> --- >>>> include/uapi/drm/xe_drm.h | 17 ++++++++++++----- >>>> 1 file changed, 12 insertions(+), 5 deletions(-) >>>> >>>> diff --git a/include/uapi/drm/xe_drm.h b/include/uapi/drm/xe_drm.h >>>> index d48d8e3c898c..5895c95879d1 100644 >>>> --- a/include/uapi/drm/xe_drm.h >>>> +++ b/include/uapi/drm/xe_drm.h >>>> @@ -167,11 +167,10 @@ struct drm_xe_query_mem_region { >>>> * >>>> * When the kernel allocates memory for this region, the >>>> * underlying pages will be at least @min_page_size in size. >>>> - * >>>> - * Important note: When userspace allocates a GTT address which >>>> - * can point to memory allocated from this region, it must also >>>> - * respect this minimum alignment. This is enforced by the >>>> - * kernel. >>> This old statement seems bold on the kernel is enforcing it. If we are >>> but intend to not enforce anymore we should also change the code in >>> the same patch, no?! >>> Also by the commit message I had the impression that this was removing >>> the enforcement, and not just the documentation about it. >> This RFC was more intended to trigger a discussion on how to handle this. >> I'll actually bring back the above somewhat reworded and also rework the >> commit message a bit to reflect that this is an RFC for an uAPI change under >> discussion. >> >>>> + * Buffer objects with an allowable placement in this region may >>>> + * be created with a smaller size, but for increased performance, >>>> + * user-space drivers should align sizes of such buffer objects >>>> + * to this value whenever possible. >>>> */ >>>> __u32 min_page_size; >>>> /** >>>> @@ -252,6 +251,14 @@ struct drm_xe_query_config { >>>> #define XE_QUERY_CONFIG_REV_AND_DEVICE_ID 0 >>>> #define XE_QUERY_CONFIG_FLAGS 1 >>>> #define XE_QUERY_CONFIG_FLAGS_HAS_VRAM (0x1 << 0) >>>> +/* >>>> + * XE_QUERY_CONFIG_MIN_ALIGNMENT - GPU VM bind address - and size alignment. >>>> + * GPU virtual address mappings of buffer objects must have their VM addr and >>>> + * range aligned to this value, with the exception of buffer objects with >>>> + * allowable placement in system memory only. If this alignment results in >>>> + * a mapping beyond the end of the buffer object, accesses beyond the >>>> + * end of the buffer object have undefined reslut. >>> s/reslut/result. >>> >>> Should we make this into a kernel doc? >> It looks like all other defines of constants in this file doesn't use >> kerneldoc. If we want to do that, It looks like we need to break this out to >> a top-level DOC: section, similar to what's done for >> XE_RESET_FAILED_UEVENT. >> >> /Thomas >> >> > Hi Thomas, > > A proposal to make constants visible in kernel doc is part of the > uAPI alignment series take 2: > https://patchwork.freedesktop.org/patch/562078/?series=124977&rev=1 > > Francois Ah, thanks Francois, I'll take a look. /Thomas