* Re: [PATCH] tty: serial: convert atomic_* to refcount_* APIs
[not found] <Y6NlNB9c22XiYHdD@qemulion>
@ 2022-12-22 5:55 ` Greg Kroah-Hartman
2022-12-22 14:02 ` Deepak R Varma
0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2022-12-22 5:55 UTC (permalink / raw)
To: Deepak R Varma
Cc: Maciej W. Rozycki, Jiri Slaby, linux-serial, linux-kernel,
Saurabh Singh Sengar, Praveen Kumar
On Thu, Dec 22, 2022 at 01:27:40AM +0530, Deepak R Varma wrote:
> The refcount_* APIs are designed to address known issues with the
> atomic_t APIs for reference counting. They protect the reference
> counters from overflow/underflow, use-after-free errors, provide
> improved memory ordering guarantee schemes, are neater and safer.
> Hence, replace the atomic_* APIs by their equivalent refcount_t
> API functions.
>
> This patch proposal address the following warnings generated by
> the atomic_as_refcounter.cocci coccinelle script
> atomic_add_return(-1, ...)
>
>
> Signed-off-by: Deepak R Varma <drv@mailo.com>
> ---
> Note: The patch is compile tested using dec_station.defconfig for
> MIPS architecture.
Do you have this hardware? If not, please just do
one-variable-at-a-time so that if there are real problems, we can revert
the offending change easier. And it makes it simpler to review.
But, are you sure this is correct:
> - irq_guard = atomic_add_return(1, &mux->irq_guard);
> - if (irq_guard != 1)
> + refcount_inc(&mux->irq_guard);
> + if (refcount_read(&mux->irq_guard) != 1)
That is now different logic than before, why? Are you sure this is ok?
I stopped reviewing here...
thanks,
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] tty: serial: convert atomic_* to refcount_* APIs
2022-12-22 5:55 ` [PATCH] tty: serial: convert atomic_* to refcount_* APIs Greg Kroah-Hartman
@ 2022-12-22 14:02 ` Deepak R Varma
0 siblings, 0 replies; 2+ messages in thread
From: Deepak R Varma @ 2022-12-22 14:02 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Maciej W. Rozycki, Jiri Slaby, linux-serial, linux-kernel,
Saurabh Singh Sengar, Praveen Kumar, drv
On Thu, Dec 22, 2022 at 06:55:01AM +0100, Greg Kroah-Hartman wrote:
> On Thu, Dec 22, 2022 at 01:27:40AM +0530, Deepak R Varma wrote:
> > The refcount_* APIs are designed to address known issues with the
> > atomic_t APIs for reference counting. They protect the reference
> > counters from overflow/underflow, use-after-free errors, provide
> > improved memory ordering guarantee schemes, are neater and safer.
> > Hence, replace the atomic_* APIs by their equivalent refcount_t
> > API functions.
> >
> > This patch proposal address the following warnings generated by
> > the atomic_as_refcounter.cocci coccinelle script
> > atomic_add_return(-1, ...)
> >
> >
> > Signed-off-by: Deepak R Varma <drv@mailo.com>
> > ---
> > Note: The patch is compile tested using dec_station.defconfig for
> > MIPS architecture.
>
> Do you have this hardware? If not, please just do
> one-variable-at-a-time so that if there are real problems, we can revert
> the offending change easier. And it makes it simpler to review.
Hi Greg,
I do not have the hardware. I will make a one variable per patch change as
suggest and send in a patch set.
>
> But, are you sure this is correct:
>
> > - irq_guard = atomic_add_return(1, &mux->irq_guard);
> > - if (irq_guard != 1)
> > + refcount_inc(&mux->irq_guard);
> > + if (refcount_read(&mux->irq_guard) != 1)
>
> That is now different logic than before, why? Are you sure this is ok?
This is not correct. I read it wrong. I will correct this in the patch set.
>
> I stopped reviewing here...
Thanks. I will review the rest of the changes per your advise and make the
corrections.
regards,
./drv
>
> thanks,
>
> greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-12-22 14:03 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <Y6NlNB9c22XiYHdD@qemulion>
2022-12-22 5:55 ` [PATCH] tty: serial: convert atomic_* to refcount_* APIs Greg Kroah-Hartman
2022-12-22 14:02 ` Deepak R Varma
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).