All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michal Orzel <michal.orzel@arm.com>
To: Julien Grall <julien@xen.org>, xen-devel@lists.xenproject.org
Cc: Julien Grall <jgrall@amazon.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Bertrand Marquis <bertrand.marquis@arm.com>,
	Volodymyr Babchuk <Volodymyr_Babchuk@epam.com>
Subject: Re: [PATCH v2] xen/arm: gic-v3-lpi: Allocate the pending table while preparing the CPU
Date: Tue, 17 May 2022 10:52:37 +0200	[thread overview]
Message-ID: <981d9872-266a-d03d-d6e4-80960971a00b@arm.com> (raw)
In-Reply-To: <09550023-320a-2d51-f3c6-f5b7a999bf33@xen.org>



On 17.05.2022 10:34, Julien Grall wrote:
> 
> 
> On 17/05/2022 07:47, Michal Orzel wrote:
>> Hi Julien,
> 
> Hi Michal,
> 
>>
>> On 16.05.2022 19:02, Julien Grall wrote:
>>> +static int cpu_callback(struct notifier_block *nfb, unsigned long action,
>>> +                        void *hcpu)
>>> +{
>>> +    unsigned long cpu = (unsigned long)hcpu;
>> As cpu does not change in this function, shouldn't we mark it as const?
> 
> As discussed in [1], this is not a common practice to use const for variable that just hold integer.
> 
> I would personally only used it if I think there is a security issue risk (e.g. the variable is used to flush the TLB like in [2]).
> 
> Would you be able to explain why you want to use const? Is it a requirement for some certification?
> 
It is not a subject of any requirement. It was my personal thought.
As it is not a common practice in Xen, I will keep that in mind for the future.

>>
>>> +    int rc = 0;
>>> +
>>> +    switch ( action )
>>> +    {
>>> +    case CPU_UP_PREPARE:
>>> +        rc = gicv3_lpi_allocate_pendtable(cpu);
>>> +        if ( rc )
>>> +            printk(XENLOG_ERR "Unable to allocate the pendtable for CPU%u\n",
>> %u requires unsigned int but cpu is unsigned long.
>> FWICS this will cause a compilation error, so you should change to %lu.
> 
> Whoops. I will fix it on the next version.
> 
>>
>>> +                   cpu);
>>> +        break;
>>>       }
>>>   -    return gicv3_lpi_set_proptable(rdist_base);
>>> +    return !rc ? NOTIFY_DONE : notifier_from_errno(rc);
>>>   }
>>>   
> 
> Cheers,
> 
> [1] https://lore.kernel.org/xen-devel/20220505103601.322110-2-michal.orzel@arm.com/
> [2] https://lore.kernel.org/xen-devel/20220221102218.33785-5-julien@xen.org/
> 
>>
>> Cheers,
>> Michal
> 

Cheers,
Michal


  reply	other threads:[~2022-05-17  8:53 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-16 17:02 [PATCH v2] xen/arm: gic-v3-lpi: Allocate the pending table while preparing the CPU Julien Grall
2022-05-17  6:47 ` Michal Orzel
2022-05-17  8:34   ` Julien Grall
2022-05-17  8:52     ` Michal Orzel [this message]
2022-05-17  8:58 ` Bertrand Marquis
2022-05-17 17:20   ` 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=981d9872-266a-d03d-d6e4-80960971a00b@arm.com \
    --to=michal.orzel@arm.com \
    --cc=Volodymyr_Babchuk@epam.com \
    --cc=bertrand.marquis@arm.com \
    --cc=jgrall@amazon.com \
    --cc=julien@xen.org \
    --cc=sstabellini@kernel.org \
    --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.