From: "Kok, Auke" <auke-jan.h.kok@intel.com>
To: akpm@linux-foundation.org
Cc: jeff@garzik.org, netdev@vger.kernel.org, chrisl@vmware.com,
arvidjaar@mail.ru, bruce.w.allan@intel.com,
jeffrey.t.kirsher@intel.com, jesse.brandeburg@intel.com,
john.ronciak@intel.com, peter.p.waskiewicz.jr@intel.com,
pratap@vmware.com, zach@vmware.com
Subject: Re: [patch for 2.6.27? 4/4] e1000e: prevent corruption of EEPROM/NVM
Date: Wed, 03 Sep 2008 13:59:45 -0700 [thread overview]
Message-ID: <48BEFAC1.1030303@intel.com> (raw)
In-Reply-To: <200809022148.m82LmKQu014384@imap1.linux-foundation.org>
akpm@linux-foundation.org wrote:
> From: Christopher Li <chrisl@vmware.com>
>
> Andrey reports e1000e corruption, and that a patch in vmware's ESX fixed
> it.
wrong subject? the patch applies to e1000, not e1000e...
>
> The EEPROM corruption is triggered by concurrent access of the EEPROM
> read/write. Putting a lock around it solve the problem.
>
> [akpm@linux-foundation.org: use DEFINE_SPINLOCK to avoid confusing lockdep]
> Signed-off-by: Christopher Li <chrisl@vmware.com>
> Reported-by: Andrey Borzenkov <arvidjaar@mail.ru>
> Cc: Zach Amsden <zach@vmware.com>
> Cc: Pratap Subrahmanyam <pratap@vmware.com>
> Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Cc: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Cc: Bruce Allan <bruce.w.allan@intel.com>
> Cc: PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>
> Cc: John Ronciak <john.ronciak@intel.com>
> Cc: Jeff Garzik <jeff@garzik.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
> ---
>
> drivers/net/e1000/e1000_hw.c | 23 +++++++++++++++++++++++
> 1 file changed, 23 insertions(+)
>
> diff -puN drivers/net/e1000/e1000_hw.c~e1000e-prevent-corruption-of-eeprom-nvm drivers/net/e1000/e1000_hw.c
> --- a/drivers/net/e1000/e1000_hw.c~e1000e-prevent-corruption-of-eeprom-nvm
> +++ a/drivers/net/e1000/e1000_hw.c
> @@ -144,6 +144,8 @@ static s32 e1000_host_if_read_cookie(str
> static u8 e1000_calculate_mng_checksum(char *buffer, u32 length);
> static s32 e1000_configure_kmrn_for_10_100(struct e1000_hw *hw, u16 duplex);
> static s32 e1000_configure_kmrn_for_1000(struct e1000_hw *hw);
> +static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
> +static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data);
>
> /* IGP cable length table */
> static const
> @@ -168,6 +170,8 @@ u16 e1000_igp_2_cable_length_table[IGP02
> 83, 89, 95, 100, 105, 109, 113, 116, 119, 122, 124,
> 104, 109, 114, 118, 121, 124};
>
> +static DEFINE_SPINLOCK(e1000_eeprom_lock);
> +
> /******************************************************************************
> * Set the phy type member in the hw struct.
> *
> @@ -4904,6 +4908,15 @@ static s32 e1000_spi_eeprom_ready(struct
> *****************************************************************************/
> s32 e1000_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
> {
> + s32 ret;
> + spin_lock(&e1000_eeprom_lock);
> + ret = e1000_do_read_eeprom(hw, offset, words, data);
> + spin_unlock(&e1000_eeprom_lock);
> + return ret;
> +}
> +
> +static s32 e1000_do_read_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
> +{
> struct e1000_eeprom_info *eeprom = &hw->eeprom;
> u32 i = 0;
>
> @@ -5236,6 +5249,16 @@ s32 e1000_update_eeprom_checksum(struct
> *****************************************************************************/
> s32 e1000_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
> {
> + s32 ret;
> + spin_lock(&e1000_eeprom_lock);
> + ret = e1000_do_write_eeprom(hw, offset, words, data);
> + spin_unlock(&e1000_eeprom_lock);
> + return ret;
> +}
> +
> +
> +static s32 e1000_do_write_eeprom(struct e1000_hw *hw, u16 offset, u16 words, u16 *data)
> +{
> struct e1000_eeprom_info *eeprom = &hw->eeprom;
> s32 status = 0;
>
> _
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2008-09-03 20:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-02 21:48 [patch for 2.6.27? 4/4] e1000e: prevent corruption of EEPROM/NVM akpm
2008-09-02 22:01 ` Brandeburg, Jesse
2008-09-13 19:15 ` Jeff Garzik
2008-09-03 20:59 ` Kok, Auke [this message]
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=48BEFAC1.1030303@intel.com \
--to=auke-jan.h.kok@intel.com \
--cc=akpm@linux-foundation.org \
--cc=arvidjaar@mail.ru \
--cc=bruce.w.allan@intel.com \
--cc=chrisl@vmware.com \
--cc=jeff@garzik.org \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=john.ronciak@intel.com \
--cc=netdev@vger.kernel.org \
--cc=peter.p.waskiewicz.jr@intel.com \
--cc=pratap@vmware.com \
--cc=zach@vmware.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 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.