From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: Prarit Bhargava <prarit@redhat.com>
Cc: linux-scsi@vger.kernel.org, Jayamohan.Kallickal@emulex.com,
mchristi@redhat.com
Subject: Re: [PATCH]: be2iscsi: Fix MSIX interrupt names
Date: Tue, 24 May 2011 17:09:50 +0200 [thread overview]
Message-ID: <1355717.cj2chV3kM3@donald.sf-tec.de> (raw)
In-Reply-To: <4DDBC529.9020008@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 1569 bytes --]
Am Dienstag, 24. Mai 2011, 10:48:09 schrieb Prarit Bhargava:
> On 05/20/2011 04:17 PM, Rolf Eike Beer wrote:
> > This could be simpler if you would use devres and devm_kzalloc() and
> > devm_request_irq(). You simply need to return with error then and the
> > driver core would free everything you already allocated.
> >
> > Eike
>
> Thanks for the suggestion Eike.
>
> I've never used devres before. This seems to work -- please review as [v3].
No, sorry, this wont work. You need to change your call of pci_enable_device()
to pcim_enable_device(). Afterwards you should check what else in your probe
routine can be converted to devres. This is optional, but why duplicate work?
What you need to take care of: resources that you do not allocate by devres
(e.g. the scsi_host) and which are explicitely freed by you must not be needed
e.g. in the IRQ handler if that would be freed by devres, i.e.:
int ret;
pcim_enable_device()
beiscsi_hba_alloc()
devm_request_irq()
ret = something();
if (ret != 0) {
beiscsi_free_hba();
return ret;
}
// devres would now free IRQs etc.
If an IRQ happens right before it is freed by devres (which could e.g. happen
if you enable IRQ debugging) you could hit a NULL or stale host pointer. If
your IRQ handler requires some resources to always be present (e.g. the
scsi_host) then you must explicitely deregister it before releasing those
resources. At the end this makes the init savings void. So you better add a
single check
if (unlikely(my_hba == NULL))
return IRQ_NONE;
to your IRQ handler to be safe.
Eike
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2011-05-24 15:10 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4DD6AEB7.2090900@redhat.com>
2011-05-20 18:12 ` [PATCH]: be2iscsi: Fix MSIX interrupt names Prarit Bhargava
2011-05-20 18:33 ` Jayamohan.Kallickal
2011-05-20 18:51 ` Prarit Bhargava
2011-05-20 20:17 ` Rolf Eike Beer
2011-05-24 14:48 ` Prarit Bhargava
2011-05-24 15:09 ` Rolf Eike Beer [this message]
2011-06-01 18:55 ` Jayamohan.Kallickal
2011-06-01 19:41 ` Rolf Eike Beer
2011-06-01 23:50 ` Jayamohan.Kallickal
2011-06-02 9:35 ` Rolf Eike Beer
2011-05-20 19:13 ` Prarit Bhargava
2011-05-20 22:07 ` Jayamohan.Kallickal
2011-05-20 23:45 ` Prarit Bhargava
2011-05-23 17:22 ` Jayamohan.Kallickal
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=1355717.cj2chV3kM3@donald.sf-tec.de \
--to=eike-kernel@sf-tec.de \
--cc=Jayamohan.Kallickal@emulex.com \
--cc=linux-scsi@vger.kernel.org \
--cc=mchristi@redhat.com \
--cc=prarit@redhat.com \
/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