From: Corey Minyard <tcminyard@gmail.com>
To: "Zheng, Lv" <lv.zheng@intel.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
"Wysocki, Rafael J" <rafael.j.wysocki@intel.com>,
"Brown, Len" <len.brown@intel.com>,
"Zhao, Yakui" <yakui.zhao@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>,
"openipmi-developer@lists.sourceforge.net"
<openipmi-developer@lists.sourceforge.net>
Subject: Re: [PATCH 03/13] ACPI/IPMI: Fix race caused by the unprotected ACPI IPMI transfers
Date: Thu, 25 Jul 2013 19:48:05 -0500 [thread overview]
Message-ID: <51F1C745.60800@acm.org> (raw)
In-Reply-To: <1AE640813FDE7649BE1B193DEA596E8802435A78@SHSMSX101.ccr.corp.intel.com>
On 07/25/2013 07:16 PM, Zheng, Lv wrote:
>>
>> If I understand this correctly, the problem would be if:
>>
>> rem_time = wait_for_completion_timeout(&tx_msg->tx_complete,
>> IPMI_TIMEOUT);
>>
>> returns on a timeout, then checks msg_done and races with something setting
>> msg_done. If that is the case, you would need the smp_rmb() before checking
>> msg_done.
>>
>> However, the timeout above is unnecessary. You are using
>> ipmi_request_settime(), so you can set the timeout when the IPMI command
>> fails and returns a failure message. The driver guarantees a return message
>> for each request. Just remove the timeout from the completion, set the
>> timeout and retries in the ipmi request, and the completion should handle the
>> barrier issues.
> It's just difficult for me to determine retry count and timeout value, maybe retry=0, timeout=IPMI_TIMEOUT is OK.
> The code of the timeout completion is already there, I think the quick fix code should not introduce this logic.
> I'll add a new patch to apply your comment.
Since it is a local BMC, I doubt a retry is required. That is probably
fine. Or you could set retry=1 and timeout=IPMI_TIMEOUT/2 if you wanted
to be more sure, but I doubt it would make a difference. The only time
you really need to worry about retries is if you are resetting the BMC
or it is being overloaded.
>
>> Plus, from a quick glance at the code, it doesn't look like it will properly handle a
>> situation where the timeout occurs and is handled then the response comes in
>> later.
> PATCH 07 fixed this issue.
> Here we just need the smp_rmb() or holding tx_msg_lock() around the acpi_format_ipmi_response().
If you apply the fix like I suggest, then the race goes away. If
there's no timeout and it just waits for the completion, things get a
lot simpler.
>
> Thanks for commenting.
No problem, thanks for working on this.
-corey
next prev parent reply other threads:[~2013-07-26 0:48 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1370652213.git.lv.zheng@intel.com>
2013-07-23 8:08 ` [PATCH 00/13] ACPI/IPMI: Fix several issues in the current codes Lv Zheng
2013-07-23 8:08 ` [PATCH 01/13] ACPI/IPMI: Fix potential response buffer overflow Lv Zheng
2013-07-23 14:54 ` Greg KH
2013-07-24 0:21 ` Zheng, Lv
2013-07-24 0:44 ` Zheng, Lv
2013-07-23 8:09 ` [PATCH 02/13] ACPI/IPMI: Fix atomic context requirement of ipmi_msg_handler() Lv Zheng
2013-07-23 8:09 ` [PATCH 03/13] ACPI/IPMI: Fix race caused by the unprotected ACPI IPMI transfers Lv Zheng
2013-07-24 23:38 ` Rafael J. Wysocki
2013-07-25 3:09 ` Zheng, Lv
2013-07-25 12:06 ` Rafael J. Wysocki
2013-07-25 18:12 ` Corey Minyard
2013-07-25 19:32 ` Rafael J. Wysocki
2013-07-26 0:18 ` Zheng, Lv
2013-07-26 0:16 ` Zheng, Lv
2013-07-26 0:48 ` Corey Minyard [this message]
2013-07-26 1:30 ` Zheng, Lv
2013-07-26 0:09 ` Zheng, Lv
2013-07-23 8:09 ` [PATCH 04/13] ACPI/IPMI: Fix race caused by the unprotected ACPI IPMI user Lv Zheng
2013-07-25 21:59 ` Rafael J. Wysocki
2013-07-26 1:17 ` Zheng, Lv
2013-07-23 8:09 ` [PATCH 05/13] ACPI/IPMI: Fix issue caused by the per-device registration of the IPMI operation region handler Lv Zheng
2013-07-23 8:09 ` [PATCH 06/13] ACPI/IPMI: Add reference counting for ACPI operation region handlers Lv Zheng
2013-07-25 20:27 ` Rafael J. Wysocki
2013-07-26 0:47 ` Zheng, Lv
2013-07-26 8:09 ` Zheng, Lv
2013-07-26 14:00 ` Rafael J. Wysocki
2013-07-29 1:43 ` Zheng, Lv
2013-07-25 21:29 ` Rafael J. Wysocki
2013-07-26 1:54 ` Zheng, Lv
2013-07-26 8:15 ` Zheng, Lv
2013-07-26 14:49 ` Rafael J. Wysocki
2013-07-29 1:56 ` Zheng, Lv
2013-07-23 8:09 ` [PATCH 07/13] ACPI/IPMI: Add reference counting for ACPI IPMI transfers Lv Zheng
2013-07-25 22:23 ` Rafael J. Wysocki
2013-07-26 1:21 ` Zheng, Lv
2013-07-26 13:41 ` Rafael J. Wysocki
2013-07-23 8:10 ` [PATCH 08/13] ACPI/IPMI: Cleanup several acpi_ipmi_device members Lv Zheng
2013-07-25 22:25 ` Rafael J. Wysocki
2013-07-26 1:25 ` Zheng, Lv
2013-07-26 13:38 ` Rafael J. Wysocki
2013-07-29 1:12 ` Zheng, Lv
2013-07-23 8:10 ` [PATCH 09/13] ACPI/IPMI: Cleanup some initialization codes Lv Zheng
2013-07-23 8:10 ` [PATCH 10/13] ACPI/IPMI: Cleanup some inclusion codes Lv Zheng
2013-07-23 8:10 ` [PATCH 11/13] ACPI/IPMI: Cleanup some Kconfig codes Lv Zheng
2013-07-23 8:10 ` [PATCH 12/13] Testing: Add module load/unload test suite Lv Zheng
2013-07-23 8:10 ` [PATCH 13/13] ACPI/IPMI: Add IPMI operation region test device driver Lv Zheng
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=51F1C745.60800@acm.org \
--to=tcminyard@gmail.com \
--cc=len.brown@intel.com \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lv.zheng@intel.com \
--cc=minyard@acm.org \
--cc=openipmi-developer@lists.sourceforge.net \
--cc=rafael.j.wysocki@intel.com \
--cc=rjw@sisk.pl \
--cc=yakui.zhao@intel.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;
as well as URLs for NNTP newsgroup(s).