From: Dennis Dalessandro <dennis.dalessandro-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
To: Matan Barak
<matanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>,
"Hefty,
Sean" <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Cc: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
"linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
<linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Jason Gunthorpe
<jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>,
Liran Liss <liranl-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Tal Alon <talal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>,
Christoph Lameter <cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org>,
"Weiny, Ira" <ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
Majd Dibbiny <majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
Subject: Re: [PATCH for-next 02/13] IB/core: Add support to finalize objects in one transaction
Date: Wed, 21 Jun 2017 11:33:32 -0400 [thread overview]
Message-ID: <37c8c95b-eec5-af5c-8d72-eea429d84818@intel.com> (raw)
In-Reply-To: <CAAKD3BCpRwiCejxuKiP07q-jGoRF1W8Ovs5aMt07uO2gAc1Qug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
On 6/11/2017 4:16 AM, Matan Barak wrote:
> On Fri, Jun 9, 2017 at 2:51 AM, Hefty, Sean <sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org> wrote:
>>> The new ioctl based infrastructure either commits or rollbacks
>>> all objects of the command as one transaction. In order to do
>>> that, we introduce a notion of dealing with a collection of
>>> objects that are related to a specific action.
>>>
>>> This also requires adding a notion of an action and attribute.
>>> An action contains a groups of attributes, where each group
>>> contains several attributes.
>>>
>>> For example, an object could be a CQ, which has an action of
>>> CREATE_CQ.
>>> This action has multiple attributes. For example, the CQ's new handle
>>> and the comp_channel. Each layer in this hierarchy - objects, actions
>>> and attributes is split into groups. The common example for that is
>>> one group representing the common entities and another one
>>> representing the driver specific entities.
>>>
>>> When declaring these actions and attributes, we actually declare
>>> their specifications. When a command is executed, we actually
>>> allocates some space to hold auxiliary information. This auxiliary
>>> information contains meta-data about the required objects, such
>>> as pointers to their type information, pointers to the uobjects
>>> themselves (if exist), etc.
>>> The specification, along with the auxiliary information we allocated
>>> and filled is given to the finalize_objects function.
>>>
>>> Signed-off-by: Matan Barak <matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>>> Reviewed-by: Yishai Hadas <yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
>>> ---
>>> drivers/infiniband/core/rdma_core.c | 39
>>> ++++++++++++++++++++++++++++++
>>> drivers/infiniband/core/rdma_core.h | 22 ++++++++++++++++-
>>> include/rdma/uverbs_ioctl.h | 48
>>> +++++++++++++++++++++++++++++++++++++
>>> 3 files changed, 108 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/infiniband/core/rdma_core.c
>>> b/drivers/infiniband/core/rdma_core.c
>>> index 2bd58ff..3d3cf07 100644
>>> --- a/drivers/infiniband/core/rdma_core.c
>>> +++ b/drivers/infiniband/core/rdma_core.c
>>> @@ -683,3 +683,42 @@ int uverbs_finalize_object(struct ib_uobject
>>> *uobj,
>>>
>>> return ret;
>>> }
>>> +
>>> +int uverbs_finalize_objects(struct uverbs_attr_array *attr_array,
>>> + struct uverbs_attr_spec_group ** const
>>> spec_groups,
>>> + size_t num,
>>> + bool commit)
>>> +{
>>> + unsigned int i;
>>> + int ret = 0;
>>> +
>>> + for (i = 0; i < num; i++) {
>>> + struct uverbs_attr_array *attr_group_array =
>>> &attr_array[i];
>>> + const struct uverbs_attr_spec_group *attr_spec_group =
>>> + spec_groups[i];
>>> + unsigned int j;
>>> +
>>> + for (j = 0; j < attr_group_array->num_attrs; j++) {
>>> + struct uverbs_attr *attr;
>>> + struct uverbs_attr_spec *spec;
>>> +
>>> + if (!uverbs_is_valid(attr_group_array, j))
>>> + continue;
>>> +
>>> + attr = &attr_group_array->attrs[j];
>>> + spec = &attr_spec_group->attrs[j];
>>> +
>>> + if (spec->type == UVERBS_ATTR_TYPE_IDR ||
>>> + spec->type == UVERBS_ATTR_TYPE_FD) {
>>> + int current_ret;
>>> +
>>> + current_ret = uverbs_finalize_object(attr-
>>>> obj_attr.uobject,
>>> + spec->obj.access,
>>> + commit);
>>> + if (!ret)
>>> + ret = current_ret;
>>> + }
>>> + }
>>> + }
>>> + return ret;
>>> +}
>>> diff --git a/drivers/infiniband/core/rdma_core.h
>>> b/drivers/infiniband/core/rdma_core.h
>>> index 97483d1..5cc00eb 100644
>>> --- a/drivers/infiniband/core/rdma_core.h
>>> +++ b/drivers/infiniband/core/rdma_core.h
>>> @@ -82,7 +82,8 @@
>>> * applicable.
>>> * This function could create (access == NEW), destroy (access ==
>>> DESTROY)
>>> * or unlock (access == READ || access == WRITE) objects if required.
>>> - * The action will be finalized only when uverbs_finalize_object is
>>> called.
>>> + * The action will be finalized only when uverbs_finalize_object or
>>> + * uverbs_finalize_objects are called.
>>> */
>>> struct ib_uobject *uverbs_get_uobject_from_context(const struct
>>> uverbs_obj_type *type_attrs,
>>> struct ib_ucontext *ucontext,
>>> @@ -91,5 +92,24 @@ struct ib_uobject
>>> *uverbs_get_uobject_from_context(const struct uverbs_obj_type
>>> int uverbs_finalize_object(struct ib_uobject *uobj,
>>> enum uverbs_obj_access access,
>>> bool commit);
>>> +/*
>>> + * Note that certain finalize stages could return a status:
>>> + * (a) alloc_commit could return a failure if the object is
>>> committed at the
>>> + * same time when the context is destroyed.
>>> + * (b) remove_commit could fail if the object wasn't destroyed
>>> successfully.
>>> + * Since multiple objects could be finalized in one transaction, it
>>> is very NOT
>>> + * recommended to have several finalize actions which have side
>>> effects.
>>> + * For example, it's NOT recommended to have a certain action which
>>> has both
>>> + * a commit action and a destroy action or two destroy objects in the
>>> same
>>> + * action. The rule of thumb is to have one destroy or commit action
>>> with
>>> + * multiple lookups.
>>> + * The first non zero return value of finalize_object is returned
>>> from this
>>> + * function. For example, this could happen when we couldn't destroy
>>> an
>>> + * object.
>>> + */
>>> +int uverbs_finalize_objects(struct uverbs_attr_array *attr_array,
>>> + struct uverbs_attr_spec_group ** const
>>> spec_groups,
>>> + size_t num,
>>> + bool commit);
>>>
>>> #endif /* RDMA_CORE_H */
>>> diff --git a/include/rdma/uverbs_ioctl.h b/include/rdma/uverbs_ioctl.h
>>> index 4ff87ee..e06f4cf 100644
>>> --- a/include/rdma/uverbs_ioctl.h
>>> +++ b/include/rdma/uverbs_ioctl.h
>>> @@ -41,6 +41,12 @@
>>> * =======================================
>>> */
>>>
>>> +enum uverbs_attr_type {
>>> + UVERBS_ATTR_TYPE_NA,
>>> + UVERBS_ATTR_TYPE_IDR,
>>> + UVERBS_ATTR_TYPE_FD,
>>> +};
>>> +
>>> enum uverbs_obj_access {
>>> UVERBS_ACCESS_READ,
>>> UVERBS_ACCESS_WRITE,
>>> @@ -48,5 +54,47 @@ enum uverbs_obj_access {
>>> UVERBS_ACCESS_DESTROY
>>> };
>>>
>>> +struct uverbs_attr_spec {
>>> + enum uverbs_attr_type type;
>>> + struct {
>>> + /*
>>> + * higher bits mean the group and lower bits mean
>>> + * the type id within the group.
>>> + */
>>> + u16 obj_type;
>>
>> Why aren't separate fields used instead of an unspecified bit separation?
>>
>>
>
> The "spec" part isn't passed from user-space to kernel. It's intended
> to instruct the kernel parser how to parse the command.
> Since these structs are parsed automatically and built using macros, I
> was in favor of reducing the .text section size here.
My opinion is splitting would make the code nicer to read, but if it's
really only ever touched using macros I guess that's not too big of a
deal. I hardly think the .text section size here is really that big of a
concern given all the other stuff we are going to be cramming in.
-Denny
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2017-06-21 15:33 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-07 12:22 [PATCH for-next 00/13] IB/core: SG IOCTL based RDMA ABI Matan Barak
[not found] ` <1496838172-39671-1-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-06-07 12:22 ` [PATCH for-next 01/13] IB/core: Add a generic way to execute an operation on a uobject Matan Barak
2017-06-07 12:22 ` [PATCH for-next 02/13] IB/core: Add support to finalize objects in one transaction Matan Barak
[not found] ` <1496838172-39671-3-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-06-08 23:51 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373AB141A91-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-06-11 8:16 ` Matan Barak
[not found] ` <CAAKD3BCpRwiCejxuKiP07q-jGoRF1W8Ovs5aMt07uO2gAc1Qug-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-21 15:33 ` Dennis Dalessandro [this message]
[not found] ` <37c8c95b-eec5-af5c-8d72-eea429d84818-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2017-06-29 16:41 ` Matan Barak
2017-06-07 12:22 ` [PATCH for-next 03/13] IB/core: Add new ioctl interface Matan Barak
[not found] ` <1496838172-39671-4-git-send-email-matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
2017-06-13 22:48 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373AB143340-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-06-14 8:39 ` Matan Barak
[not found] ` <CAAKD3BArF5U49WQ2PcYjpSbPpQmyubJQ6vKKUer_L05QBQpT0w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-14 17:25 ` Hefty, Sean
[not found] ` <1828884A29C6694DAF28B7E6B8A82373AB1436F6-P5GAC/sN6hkd3b2yrw5b5LfspsVTdybXVpNB7YpNyf8@public.gmane.org>
2017-06-14 17:39 ` Jason Gunthorpe
[not found] ` <20170614173940.GA15278-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-14 17:46 ` Hefty, Sean
2017-06-15 11:51 ` Matan Barak
2017-06-15 11:50 ` Matan Barak
[not found] ` <CAAKD3BA+Bpwbx+pZivK_+jRLc9kCrvhQkPy4tKcaTqUZhfRiOg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2017-06-15 16:57 ` Jason Gunthorpe
[not found] ` <20170615165751.GB23773-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-20 12:03 ` Matan Barak
2017-06-20 15:38 ` Jason Gunthorpe
[not found] ` <20170620153855.GA29283-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-29 16:38 ` Matan Barak
2017-06-07 12:22 ` [PATCH for-next 04/13] IB/core: Declare a type instead of declaring only type attributes Matan Barak
2017-06-07 12:22 ` [PATCH for-next 05/13] IB/core: Add DEVICE type and root types structure Matan Barak
2017-06-07 12:22 ` [PATCH for-next 06/13] IB/core: Initialize uverbs types specification Matan Barak
2017-06-07 12:22 ` [PATCH for-next 07/13] IB/core: Add macros for declaring actions and attributes Matan Barak
2017-06-07 12:22 ` [PATCH for-next 08/13] IB/core: Explicitly destroy an object while keeping uobject Matan Barak
2017-06-07 12:22 ` [PATCH for-next 09/13] IB/core: Export ioctl enum types to user-space Matan Barak
2017-06-07 12:22 ` [PATCH for-next 10/13] IB/core: Add legacy driver's user-data Matan Barak
2017-06-07 12:22 ` [PATCH for-next 11/13] IB/core: Add completion queue (cq) object actions Matan Barak
2017-06-07 12:22 ` [PATCH for-next 12/13] IB/core: Assign root to all drivers Matan Barak
2017-06-07 12:22 ` [PATCH for-next 13/13] IB/core: Expose ioctl interface through experimental Kconfig Matan Barak
2017-06-07 15:53 ` [PATCH for-next 00/13] IB/core: SG IOCTL based RDMA ABI Jason Gunthorpe
[not found] ` <20170607155323.GB30124-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2017-06-08 14:09 ` Matan Barak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=37c8c95b-eec5-af5c-8d72-eea429d84818@intel.com \
--to=dennis.dalessandro-ral2jqcrhueavxtiumwx3w@public.gmane.org \
--cc=cl-vYTEC60ixJUAvxtiuMwx3w@public.gmane.org \
--cc=dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=ira.weiny-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org \
--cc=leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=liranl-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=majd-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=matanb-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org \
--cc=matanb-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=sean.hefty-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
--cc=talal-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
--cc=yishaih-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox