All of lore.kernel.org
 help / color / mirror / Atom feed
From: Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
To: Julien Grall <julien.grall@arm.com>
Cc: "xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>,
	Viktor Mitin <Viktor_Mitin@epam.com>,
	Viktor Mitin <viktor.mitin.19@gmail.com>
Subject: Re: [Xen-devel] [PATCH v5 2/2] xen/arm: consolidate make_timer_node and make_timer_domU_node
Date: Thu, 1 Aug 2019 14:50:15 +0000	[thread overview]
Message-ID: <87wofxgct5.fsf@epam.com> (raw)
In-Reply-To: <e022de0d-2515-007f-0a66-2f7a94c68777@arm.com>


Julien Grall writes:

> Hi Volodymyr,
>
> On 01/08/2019 15:07, Volodymyr Babchuk wrote:
>>
>> Hi Julien,
>>
>> Julien Grall writes:
>>
>>> Hi,
>>>
>>> On 01/08/2019 14:49, Volodymyr Babchuk wrote:
>>>>
>>>> Viktor Mitin writes:
>>>>
>>>>> Functions make_timer_node and make_timer_domU_node are quite similar.
>>>>> So it is better to consolidate them to avoid discrepancy.
>>>>> The main difference between the functions is the timer interrupts used.
>>>>>
>>>>> Keep the domU version for the compatible as it is simpler.
>>>>> Mean do not copy platform's 'compatible' property into hwdom
>>>>> device tree, instead set either arm,armv7-timer or arm,armv8-timer,
>>>>> depending on the platform type.
>>>> It is hard to parse the last sentence. What about "Keep the domU version
>>>> for the compatible as it is simpler: do not copy platform's
>>>> 'compatible' property into hwdom device tree, instead set either
>>>> arm,armv7-timer or arm,armv8-timer, depending on the platform type." ?
>>>>
>>>>
>>>>> Keep the hw version for the clock as it is relevant for the both cases.
>>>>>
>>>>> The new function has changed prototype due to fdt_property_interrupts
>>>>>     make_timer_node(const struct kernel_info *kinfo)
>>>>>
>>>>> Suggested-by: Julien Grall <julien.grall@arm.com>
>>>>> Signed-off-by: Viktor Mitin <viktor_mitin@epam.com>
>>>>> ---
>>>>> v4 updates:
>>>>>      updated "Keep the domU version for the compatible as it is simpler"
>>>>>
>>>>> v5 updates:
>>>>>       - changed 'kept' to 'keep', etc.
>>>>>       - removed empty line
>>>>>       - updated indentation of parameters in functions calls
>>>>>       - fixed NITs
>>>>>       - updated commit message
>>>>> ---
>>>>>    xen/arch/arm/domain_build.c | 106 +++++++++++++-----------------------
>>>>>    1 file changed, 39 insertions(+), 67 deletions(-)
>>>>>
>>>>> diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>>>>> index bc7d17dd2c..58542130ca 100644
>>>>> --- a/xen/arch/arm/domain_build.c
>>>>> +++ b/xen/arch/arm/domain_build.c
>>>>> @@ -973,10 +973,8 @@ static int __init make_timer_node(const struct kernel_info *kinfo)
>>>>>            { /* sentinel */ },
>>>>>        };
>>>>>        struct dt_device_node *dev;
>>>>> -    u32 len;
>>>>> -    const void *compatible;
>>>>>        int res;
>>>>> -    unsigned int irq;
>>>>> +    unsigned int irq[MAX_TIMER_PPI];
>>>> As I said in the previous version, you are wasting stack space
>>>> there. Also, this is misleading. When I see array of 4 items, I expect
>>>> that all 4 items will be used. But you are using only 3, so it leads to
>>>> two conclusions: either you made a mistake, or I don't understand what
>>>> it happening. Either option is bad.
>>>
>>> 4 byte on a stack of 16KB... that's not really a waste worth an
>>> argument. The more the stack is pretty empty as this is boot. So yes,
>>> you will not use the last index because you don't expose hypervisor
>>> timer to guest yet! (Imagine nested virt). But at least it avoids
>>> hardcoding a number of index and match the enum.
>> Yes, but then it should be documented at least. Comment above will be
>> fine.
>
> I don't really see the problem with the current code... This is
> similar to when we use a structure but not all the field in certain
> circumstance (see dt_device_match for instance). So I would not force
> the contributor to do it.
Okay, then.

>> In this case we also can declare and use intrs[] in the same way.
>
> There is no guarantee the index in irq will match intrs[...]. So you
> need to keep them hardcoded in the latter case.
Oh, right.

-- 
Volodymyr Babchuk at EPAM
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  reply	other threads:[~2019-08-01 14:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-01 12:04 [Xen-devel] [PATCH v5 0/2] xen/arm: Consolidate make_timer_node and make_timer_domU_node Viktor Mitin
2019-08-01 12:04 ` [Xen-devel] [PATCH v5 1/2] xen/arm: extend fdt_property_interrupts to support DomU Viktor Mitin
2019-08-01 13:33   ` Volodymyr Babchuk
2019-08-01 13:54     ` Andrew Cooper
2019-08-01 12:04 ` [Xen-devel] [PATCH v5 2/2] xen/arm: consolidate make_timer_node and make_timer_domU_node Viktor Mitin
2019-08-01 13:49   ` Volodymyr Babchuk
2019-08-01 13:57     ` Julien Grall
2019-08-01 13:58       ` Julien Grall
2019-08-01 16:46         ` Viktor Mitin
2019-08-02  9:41           ` Julien Grall
2019-08-02 11:30             ` Viktor Mitin
2019-08-01 14:07       ` Volodymyr Babchuk
2019-08-01 14:22         ` Julien Grall
2019-08-01 14:50           ` Volodymyr Babchuk [this message]
2019-08-01 16:56             ` Viktor Mitin
2019-08-02  9:36               ` Julien Grall

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=87wofxgct5.fsf@epam.com \
    --to=volodymyr_babchuk@epam.com \
    --cc=Viktor_Mitin@epam.com \
    --cc=julien.grall@arm.com \
    --cc=sstabellini@kernel.org \
    --cc=viktor.mitin.19@gmail.com \
    --cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.