From: Vivien Didelot <vivien.didelot@savoirfairelinux.com>
To: Andrew Lunn <andrew@lunn.ch>
Cc: David Miller <davem@davemloft.net>, netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH v3 net-next 1/2] net: dsa: mv88e6xxx: Add watchdog interrupt handler
Date: Thu, 09 Feb 2017 11:33:23 -0500 [thread overview]
Message-ID: <877f4z8gto.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <20170209161231.GC29882@lunn.ch>
Hi Andrew,
Andrew Lunn <andrew@lunn.ch> writes:
>> > +static int mv88e6097_watchdog_action(struct mv88e6xxx_chip *chip, int irq)
>> > +{
>> > + u16 reg;
>> > +
>> > + mv88e6xxx_g2_read(chip, GLOBAL2_WDOG_CONTROL, ®);
>>
>> We should not ignore read errors.
>
> We are in the middle of an interrupt handler. If we get a read error
> here, we are probable one step from a "Kernel Panic -- not syncing:
> attempted to kill idle task".
>
> About the only thing which makes sense is to print a warning
> message. But that really should happen in one central place,
> mv88e6xxx_smi_read(), so it covers all reads everywhere.
>
>> > + dev_info(chip->dev, "Watchdog event: 0x%04x", reg);
>> > +
>> > + return IRQ_HANDLED;
>> > +}
>> > +
>> > +static void mv88e6097_watchdog_free(struct mv88e6xxx_chip *chip)
>> > +{
>> > + u16 reg;
>> > +
>> > + mv88e6xxx_g2_read(chip, GLOBAL2_WDOG_CONTROL, ®);
>> > +
>> > + reg &= ~(GLOBAL2_WDOG_CONTROL_EGRESS_ENABLE |
>> > + GLOBAL2_WDOG_CONTROL_QC_ENABLE);
>> > +
>> > + mv88e6xxx_g2_write(chip, GLOBAL2_WDOG_CONTROL, reg);
>>
>> Same here.
>
> Again, and do what? We are in the process of unbinding/unloading the
> kernel module. We are going to keep going whatever, and there is no
> mechanism to say an error occurred at this point, other than a printk.
> Again, such a printk should be in mv88e6xxx_smi_write().
I do agree with the fact that there is not much left to do if such error
occurs in that context. But still, functions implemented in global2.c
(or whatever internal SMI device file) should be written regardless when
or how they will be used, in an interrupt handler, in driver probe, etc.
These should be just self-documented basic access functions to Marvell
chip registers. chip.c then implements the interface and glue with DSA,
watchdog class, etc.
Mixing this with other layers logic results in losing the robust and
self documented code that we are trying to implement here.
Thanks,
Vivien
next prev parent reply other threads:[~2017-02-09 16:34 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-08 23:03 [PATCH v3 net-next 0/2] mv88e6xxx Watchdog support Andrew Lunn
2017-02-08 23:03 ` [PATCH v3 net-next 1/2] net: dsa: mv88e6xxx: Add watchdog interrupt handler Andrew Lunn
2017-02-09 15:52 ` Vivien Didelot
2017-02-09 16:12 ` Andrew Lunn
2017-02-09 16:33 ` Vivien Didelot [this message]
2017-02-08 23:03 ` [PATCH v3 net-next 2/2] net: dsa: mv88e6xxx: Add mv88e6390 watchdog interrupt support Andrew Lunn
2017-02-09 15:46 ` Vivien Didelot
2017-02-09 16:28 ` Andrew Lunn
2017-02-13 14:30 ` [PATCH v3 net-next 0/2] mv88e6xxx Watchdog support David Miller
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=877f4z8gto.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me \
--to=vivien.didelot@savoirfairelinux.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).