From: Sachin Sant <sachinp@in.ibm.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: linux-scsi@vger.kernel.org, brking@linux.vnet.ibm.com,
linuxppc-dev@ozlabs.org
Subject: Re: 2.6.34-rc3 : Badness at lib/dma-debug.c:820 during ibmvscsi init
Date: Fri, 02 Apr 2010 12:07:58 +0530 [thread overview]
Message-ID: <4BB590C6.3090108@in.ibm.com> (raw)
In-Reply-To: <20100402151229V.fujita.tomonori@lab.ntt.co.jp>
FUJITA Tomonori wrote:
> On Fri, 02 Apr 2010 10:48:55 +0530
> Sachin Sant <sachinp@in.ibm.com> wrote:
>
>
>> 2.6.34-rc3 boot on a power5 box produces this badness message
>> during ibmvscsi initialization.
>>
>> ibmvscsi 30000003: Client reserve enabled
>> ibmvscsi 30000003: sent SRP login
>> ibmvscsi 30000003: SRP_LOGIN succeeded
>> ibmvscsi 30000003: DMA-API: device driver frees DMA memory with wrong function [device address=0x0000000000011520] [size=36 bytes] [mapped as scather-gather] [unmapped as single]
>>
>
> ibmvscsi has been incompatible with the dma debug facility, I
> guess. The driver uses dma_unmap_single for buffers mapped via
> dma_map_sg. It works but it's the API violation.
>
> Does this patch work?
>
Yes, this patch fixed the issue for me. Thanks
-Regards
-Sachin
> diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
> index dc1bcbe..0856436 100644
> --- a/drivers/scsi/ibmvscsi/ibmvscsi.c
> +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
> @@ -322,16 +322,6 @@ static void set_srp_direction(struct scsi_cmnd *cmd,
> srp_cmd->buf_fmt = fmt;
> }
>
> -static void unmap_sg_list(int num_entries,
> - struct device *dev,
> - struct srp_direct_buf *md)
> -{
> - int i;
> -
> - for (i = 0; i < num_entries; ++i)
> - dma_unmap_single(dev, md[i].va, md[i].len, DMA_BIDIRECTIONAL);
> -}
> -
> /**
> * unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format
> * @cmd: srp_cmd whose additional_data member will be unmapped
> @@ -349,24 +339,9 @@ static void unmap_cmd_data(struct srp_cmd *cmd,
>
> if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC)
> return;
> - else if (out_fmt == SRP_DATA_DESC_DIRECT ||
> - in_fmt == SRP_DATA_DESC_DIRECT) {
> - struct srp_direct_buf *data =
> - (struct srp_direct_buf *) cmd->add_data;
> - dma_unmap_single(dev, data->va, data->len, DMA_BIDIRECTIONAL);
> - } else {
> - struct srp_indirect_buf *indirect =
> - (struct srp_indirect_buf *) cmd->add_data;
> - int num_mapped = indirect->table_desc.len /
> - sizeof(struct srp_direct_buf);
>
> - if (num_mapped <= MAX_INDIRECT_BUFS) {
> - unmap_sg_list(num_mapped, dev, &indirect->desc_list[0]);
> - return;
> - }
> -
> - unmap_sg_list(num_mapped, dev, evt_struct->ext_list);
> - }
> + if (evt_struct->cmnd)
> + scsi_dma_unmap(evt_struct->cmnd);
> }
>
> static int map_sg_list(struct scsi_cmnd *cmd, int nseg,
>
>
--
---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------
WARNING: multiple messages have this Message-ID (diff)
From: Sachin Sant <sachinp@in.ibm.com>
To: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: brking@linux.vnet.ibm.com, linuxppc-dev@ozlabs.org,
linux-scsi@vger.kernel.org
Subject: Re: 2.6.34-rc3 : Badness at lib/dma-debug.c:820 during ibmvscsi init
Date: Fri, 02 Apr 2010 12:07:58 +0530 [thread overview]
Message-ID: <4BB590C6.3090108@in.ibm.com> (raw)
In-Reply-To: <20100402151229V.fujita.tomonori@lab.ntt.co.jp>
FUJITA Tomonori wrote:
> On Fri, 02 Apr 2010 10:48:55 +0530
> Sachin Sant <sachinp@in.ibm.com> wrote:
>
>
>> 2.6.34-rc3 boot on a power5 box produces this badness message
>> during ibmvscsi initialization.
>>
>> ibmvscsi 30000003: Client reserve enabled
>> ibmvscsi 30000003: sent SRP login
>> ibmvscsi 30000003: SRP_LOGIN succeeded
>> ibmvscsi 30000003: DMA-API: device driver frees DMA memory with wrong function [device address=0x0000000000011520] [size=36 bytes] [mapped as scather-gather] [unmapped as single]
>>
>
> ibmvscsi has been incompatible with the dma debug facility, I
> guess. The driver uses dma_unmap_single for buffers mapped via
> dma_map_sg. It works but it's the API violation.
>
> Does this patch work?
>
Yes, this patch fixed the issue for me. Thanks
-Regards
-Sachin
> diff --git a/drivers/scsi/ibmvscsi/ibmvscsi.c b/drivers/scsi/ibmvscsi/ibmvscsi.c
> index dc1bcbe..0856436 100644
> --- a/drivers/scsi/ibmvscsi/ibmvscsi.c
> +++ b/drivers/scsi/ibmvscsi/ibmvscsi.c
> @@ -322,16 +322,6 @@ static void set_srp_direction(struct scsi_cmnd *cmd,
> srp_cmd->buf_fmt = fmt;
> }
>
> -static void unmap_sg_list(int num_entries,
> - struct device *dev,
> - struct srp_direct_buf *md)
> -{
> - int i;
> -
> - for (i = 0; i < num_entries; ++i)
> - dma_unmap_single(dev, md[i].va, md[i].len, DMA_BIDIRECTIONAL);
> -}
> -
> /**
> * unmap_cmd_data: - Unmap data pointed in srp_cmd based on the format
> * @cmd: srp_cmd whose additional_data member will be unmapped
> @@ -349,24 +339,9 @@ static void unmap_cmd_data(struct srp_cmd *cmd,
>
> if (out_fmt == SRP_NO_DATA_DESC && in_fmt == SRP_NO_DATA_DESC)
> return;
> - else if (out_fmt == SRP_DATA_DESC_DIRECT ||
> - in_fmt == SRP_DATA_DESC_DIRECT) {
> - struct srp_direct_buf *data =
> - (struct srp_direct_buf *) cmd->add_data;
> - dma_unmap_single(dev, data->va, data->len, DMA_BIDIRECTIONAL);
> - } else {
> - struct srp_indirect_buf *indirect =
> - (struct srp_indirect_buf *) cmd->add_data;
> - int num_mapped = indirect->table_desc.len /
> - sizeof(struct srp_direct_buf);
>
> - if (num_mapped <= MAX_INDIRECT_BUFS) {
> - unmap_sg_list(num_mapped, dev, &indirect->desc_list[0]);
> - return;
> - }
> -
> - unmap_sg_list(num_mapped, dev, evt_struct->ext_list);
> - }
> + if (evt_struct->cmnd)
> + scsi_dma_unmap(evt_struct->cmnd);
> }
>
> static int map_sg_list(struct scsi_cmnd *cmd, int nseg,
>
>
--
---------------------------------
Sachin Sant
IBM Linux Technology Center
India Systems and Technology Labs
Bangalore, India
---------------------------------
next prev parent reply other threads:[~2010-04-02 6:38 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-02 5:18 2.6.34-rc3 : Badness at lib/dma-debug.c:820 during ibmvscsi init Sachin Sant
2010-04-02 6:12 ` FUJITA Tomonori
2010-04-02 6:37 ` Sachin Sant [this message]
2010-04-02 6:37 ` Sachin Sant
2010-04-02 6:50 ` FUJITA Tomonori
2010-04-02 6:50 ` FUJITA Tomonori
2010-04-27 7:05 ` Benjamin Herrenschmidt
2010-04-27 7:05 ` Benjamin Herrenschmidt
2010-04-27 9:34 ` FUJITA Tomonori
2010-04-27 9:34 ` FUJITA Tomonori
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=4BB590C6.3090108@in.ibm.com \
--to=sachinp@in.ibm.com \
--cc=brking@linux.vnet.ibm.com \
--cc=fujita.tomonori@lab.ntt.co.jp \
--cc=linux-scsi@vger.kernel.org \
--cc=linuxppc-dev@ozlabs.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.