All of lore.kernel.org
 help / color / mirror / Atom feed
From: Roland Dreier <rdreier@cisco.com>
To: Joachim Fenkes <fenkes@de.ibm.com>
Cc: LinuxPPC-Dev <linuxppc-dev@ozlabs.org>,
	LKML <linux-kernel@vger.kernel.org>,
	OF-General <general@lists.openfabrics.org>
Subject: Re: [PATCH] eHCA: Add "Modify Port" verb
Date: Mon, 23 Apr 2007 12:20:14 -0700	[thread overview]
Message-ID: <ada3b2q7v9t.fsf@cisco.com> (raw)
In-Reply-To: <200704231823.48723.fenkes@de.ibm.com> (Joachim Fenkes's message of "Mon, 23 Apr 2007 18:23:48 +0200")

 > +	if (hipz_h_query_port(shca->ipz_hca_handle, port, rblock) != H_SUCCESS) {
 > +		ehca_err(&shca->ib_device, "Can't query port properties");
 > +		ret = -EINVAL;
 > +		goto modify_port1;
 > +	}
 > +
 > +	cap = (rblock->capability_mask | props->set_port_cap_mask)
 > +		& ~props->clr_port_cap_mask;
 > +
 > +	hret = hipz_h_modify_port(shca->ipz_hca_handle, port,
 > +				  cap, props->init_type, port_modify_mask);

Is this thread-safe?  What if two different bits are set at the same
time from two different threads?  It seems that both calls could get
the same result from hipz_h_query_port(), and then the second call to
hipz_h_modify_port() would overwrite the first call.

You could look at the implementation in mthca to see the locking I
used there.

 - R.

WARNING: multiple messages have this Message-ID (diff)
From: Roland Dreier <rdreier@cisco.com>
To: Joachim Fenkes <fenkes@de.ibm.com>
Cc: "LinuxPPC-Dev" <linuxppc-dev@ozlabs.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"OF-General" <general@lists.openfabrics.org>,
	Roland Dreier <rolandd@cisco.com>,
	"Hoang-Nam Nguyen" <hnguyen@de.ibm.com>
Subject: Re: [PATCH] eHCA: Add "Modify Port" verb
Date: Mon, 23 Apr 2007 12:20:14 -0700	[thread overview]
Message-ID: <ada3b2q7v9t.fsf@cisco.com> (raw)
In-Reply-To: <200704231823.48723.fenkes@de.ibm.com> (Joachim Fenkes's message of "Mon, 23 Apr 2007 18:23:48 +0200")

 > +	if (hipz_h_query_port(shca->ipz_hca_handle, port, rblock) != H_SUCCESS) {
 > +		ehca_err(&shca->ib_device, "Can't query port properties");
 > +		ret = -EINVAL;
 > +		goto modify_port1;
 > +	}
 > +
 > +	cap = (rblock->capability_mask | props->set_port_cap_mask)
 > +		& ~props->clr_port_cap_mask;
 > +
 > +	hret = hipz_h_modify_port(shca->ipz_hca_handle, port,
 > +				  cap, props->init_type, port_modify_mask);

Is this thread-safe?  What if two different bits are set at the same
time from two different threads?  It seems that both calls could get
the same result from hipz_h_query_port(), and then the second call to
hipz_h_modify_port() would overwrite the first call.

You could look at the implementation in mthca to see the locking I
used there.

 - R.

  parent reply	other threads:[~2007-04-23 19:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-23 16:23 [PATCH] eHCA: Add "Modify Port" verb Joachim Fenkes
2007-04-23 16:23 ` Joachim Fenkes
2007-04-23 16:55 ` [ofa-general] " Hal Rosenstock
2007-04-23 16:55   ` Hal Rosenstock
2007-04-24 21:48   ` Christoph Raisch
2007-04-24 21:48     ` Christoph Raisch
2007-04-23 19:20 ` Roland Dreier [this message]
2007-04-23 19:20   ` Roland Dreier
2007-04-24 12:25   ` Joachim Fenkes
2007-04-24 12:25     ` Joachim Fenkes
  -- strict thread matches above, loose matches on Subject: below --
2007-04-24 15:44 Joachim Fenkes
2007-04-24 15:44 ` Joachim Fenkes
2007-04-24 17:52 ` Roland Dreier
2007-04-24 17:52   ` Roland Dreier

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=ada3b2q7v9t.fsf@cisco.com \
    --to=rdreier@cisco.com \
    --cc=fenkes@de.ibm.com \
    --cc=general@lists.openfabrics.org \
    --cc=linux-kernel@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.