2020-12-22 09:05:49

by Ahmed S. Darwish

[permalink] [raw]
Subject: [RFC PATCH 0/1] net: arcnet: Fix RESET sequence

Folks,

At drivers/net/arcnet/arcnet.c, there is:

irqreturn_t arcnet_interrupt(int irq, void *dev_id)
{
...
if (status & RESETflag) {
arcnet_close(dev);
arcnet_open(dev);
}
...
}

struct net_device_ops arcnet_netdev_ops = {
.ndo_open = arcnet_open,
.ndo_stop = arcnet_close,
...
};

which is wrong, in many ways:

1) In general, interrupt handlers should never call ->ndo_stop() and
->ndo_open() functions. They are usually full of blocking calls and
other methods that are expected to be called only from drivers
init/exit code paths.

2) arcnet_close() contains a del_timer_sync(). If the irq handler
interrupts the to-be-deleted timer then call del_timer_sync(), it
will just loop forever.

3) arcnet_close() also calls tasklet_kill(), which has a warning if
called from irq context.

4) For device reset, the sequence "arcnet_close(); arcnet_open();" is
not complete. Some children arcnet drivers have special init/exit
code sequences, which then embed a call to arcnet_open() and
arcnet_close() accordingly. Check drivers/net/arcnet/com20020.c.

Included is an RFC patch to fix the points above: if the RESET flag is
encountered, a workqueue is scheduled to run the generic reset sequence.

Note: Only compile-tested, as I do not have the hardware in question.

Thanks,

8<--------------

Ahmed S. Darwish (1):
net: arcnet: Fix RESET flag handling

drivers/net/arcnet/arc-rimi.c | 4 +-
drivers/net/arcnet/arcdevice.h | 6 +++
drivers/net/arcnet/arcnet.c | 69 +++++++++++++++++++++++++++++--
drivers/net/arcnet/com20020-isa.c | 4 +-
drivers/net/arcnet/com20020-pci.c | 2 +-
drivers/net/arcnet/com20020_cs.c | 2 +-
drivers/net/arcnet/com90io.c | 4 +-
drivers/net/arcnet/com90xx.c | 4 +-
8 files changed, 81 insertions(+), 14 deletions(-)

base-commit: 2c85ebc57b3e1817b6ce1a6b703928e113a90442
--
2.29.2


Subject: Re: [RFC PATCH 0/1] net: arcnet: Fix RESET sequence

On 2020-12-22 10:03:37 [+0100], Ahmed S. Darwish wrote:
> 2) arcnet_close() contains a del_timer_sync(). If the irq handler
> interrupts the to-be-deleted timer then call del_timer_sync(), it
> will just loop forever.

del_timer_sync() will trigger a warning if invoked from interrupt
handler.

Sebastian

2021-01-11 13:57:22

by Ahmed S. Darwish

[permalink] [raw]
Subject: Re: [RFC PATCH 0/1] net: arcnet: Fix RESET sequence

Hi,

On Tue, Dec 22, 2020 at 10:03:37AM +0100, Ahmed S. Darwish wrote:
...
>
> Included is an RFC patch to fix the points above: if the RESET flag is
> encountered, a workqueue is scheduled to run the generic reset sequence.
>
...

Kind reminder.

2021-01-18 11:21:59

by Ahmed S. Darwish

[permalink] [raw]
Subject: Re: [RFC PATCH 0/1] net: arcnet: Fix RESET sequence

On Mon, Jan 11, 2021 at 02:54:06PM +0100, Ahmed S. Darwish wrote:
> Hi,
>
> On Tue, Dec 22, 2020 at 10:03:37AM +0100, Ahmed S. Darwish wrote:
> ...
> >
> > Included is an RFC patch to fix the points above: if the RESET flag is
> > encountered, a workqueue is scheduled to run the generic reset sequence.
> >
> ...
>
> Kind reminder.

Ping. Will anyone look at this?

Thanks,

--
Ahmed S. Darwish

2021-01-19 04:51:56

by Jakub Kicinski

[permalink] [raw]
Subject: Re: [RFC PATCH 0/1] net: arcnet: Fix RESET sequence

On Mon, 18 Jan 2021 11:45:44 +0100 Ahmed S. Darwish wrote:
> On Mon, Jan 11, 2021 at 02:54:06PM +0100, Ahmed S. Darwish wrote:
> > Hi,
> >
> > On Tue, Dec 22, 2020 at 10:03:37AM +0100, Ahmed S. Darwish wrote:
> > ...
> > >
> > > Included is an RFC patch to fix the points above: if the RESET flag is
> > > encountered, a workqueue is scheduled to run the generic reset sequence.
> > >
> > ...
> >
> > Kind reminder.
>
> Ping. Will anyone look at this?

Clearly not, if you think the fix is correct please repost as non-RFC.