Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751714Ab0H0X0w (ORCPT ); Fri, 27 Aug 2010 19:26:52 -0400 Received: from mga01.intel.com ([192.55.52.88]:54876 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750781Ab0H0X0u (ORCPT ); Fri, 27 Aug 2010 19:26:50 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.56,280,1280732400"; d="c'?scan'208";a="601219660" From: "Luck, Tony" To: Petr Tesarik CC: "linux-ia64@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Hedi Berriche Date: Fri, 27 Aug 2010 16:26:47 -0700 Subject: RE: Serious problem with ticket spinlocks on ia64 Thread-Topic: Serious problem with ticket spinlocks on ia64 Thread-Index: ActGNP8fGGVxQmxESVOm2Y7JfmO8pwACKhog Message-ID: <987664A83D2D224EAE907B061CE93D53015D91D604@orsmsx505.amr.corp.intel.com> References: <201008271537.35709.ptesarik@suse.cz> <201008272303.34228.ptesarik@suse.cz> <987664A83D2D224EAE907B061CE93D53015D91D45F@orsmsx505.amr.corp.intel.com> <201008280013.19941.ptesarik@suse.cz> In-Reply-To: <201008280013.19941.ptesarik@suse.cz> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: multipart/mixed; boundary="_002_987664A83D2D224EAE907B061CE93D53015D91D604orsmsx505amrc_" MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 10852 Lines: 154 --_002_987664A83D2D224EAE907B061CE93D53015D91D604orsmsx505amrc_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Debugging this in the kernel seemed hard ... so I tried to construct a user level test using the same code from the kernel. See attached. But this fails so catastrophically with any number of threads greater than one, that I suspect I made some mistake cut & pasting the relevant bits of kernel infrastructure. The goal of the program is to have several child processes pounding on a lock while the parent looks in every 5 seconds to see if they are making progress. -Tony --_002_987664A83D2D224EAE907B061CE93D53015D91D604orsmsx505amrc_ Content-Type: text/plain; name="spinwrap.c" Content-Description: spinwrap.c Content-Disposition: attachment; filename="spinwrap.c"; size=7081; creation-date="Fri, 27 Aug 2010 16:14:47 GMT"; modification-date="Fri, 27 Aug 2010 16:14:47 GMT" Content-Transfer-Encoding: base64 dHlwZWRlZiBzdHJ1Y3QgewogICAgICAgIHZvbGF0aWxlIHVuc2lnbmVkIGludCBsb2NrOwp9IGFy Y2hfc3BpbmxvY2tfdDsKCiNkZWZpbmUgV09SS0VSUyA4CgpzdHJ1Y3Qgc2ggewoJYXJjaF9zcGlu bG9ja190CWw7IGNoYXIgcGFkMVs2MF07Cglsb25nIHN1Y2Nlc3M7IGNoYXIgcGFkMls1Nl07Cgls b25nIHdvcmtlcltXT1JLRVJTXTsKCWludCBsb2Nrc1tXT1JLRVJTXTsKfSAqczsKCmludCBtZTsK Ci8qIGN1dCAmIHBhc3RlIGluZnJhc3RydWN0dXJlIGZyb20ga2VybmVsIHN0YXJ0IGhlcmUgKi8K dHlwZWRlZiB1bnNpZ25lZCBsb25nIF9fdTY0OwojZGVmaW5lIF9fYWx3YXlzX2lubGluZSBpbmxp bmUgX19hdHRyaWJ1dGVfXygoYWx3YXlzX2lubGluZSkpCiNkZWZpbmUgQUNDRVNTX09OQ0UoeCkg KCoodm9sYXRpbGUgdHlwZW9mKHgpICopJih4KSkKCmV4dGVybiB1bnNpZ25lZCBsb25nIF9fYmFk X3NpemVfZm9yX2lhNjRfZmV0Y2hfYW5kX2FkZCAodm9pZCk7CmV4dGVybiB1bnNpZ25lZCBsb25n IF9fYmFkX2luY3JlbWVudF9mb3JfaWE2NF9mZXRjaF9hbmRfYWRkICh2b2lkKTsKCiNkZWZpbmUg aWE2NF9pbnZhbGEoKSBhc20gdm9sYXRpbGUgKCJpbnZhbGEiIDo6OiAibWVtb3J5IikKCiNkZWZp bmUgaWE2NF9oaW50X3BhdXNlIDAKCiNkZWZpbmUgaWE2NF9oaW50KG1vZGUpICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCih7ICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgICAgc3dpdGNoICht b2RlKSB7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgICAg Y2FzZSBpYTY0X2hpbnRfcGF1c2U6ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBc CiAgICAgICAgICAgICAgICBhc20gdm9sYXRpbGUgKCJoaW50IEBwYXVzZSIgOjo6ICJtZW1vcnki KTsgICAgICBcCiAgICAgICAgICAgICAgICBicmVhazsgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBcCiAgICAgICAgfSAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICBcCn0pCiNkZWZpbmUgY3B1X3JlbGF4KCkgaWE2NF9o aW50KGlhNjRfaGludF9wYXVzZSkKCiNkZWZpbmUgaWE2NF9mZXRjaGFkZDRfYWNxKHAsIGluYykg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAooeyAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgIFwKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAgICAgX191NjQgaWE2 NF9pbnRyaV9yZXM7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgXAogICAgICAgIGFzbSB2b2xhdGlsZSAoImZldGNoYWRkNC5hY3EgJTA9WyUxXSwlMiIg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICA6ICI9ciIoaWE2NF9pbnRyaV9yZXMpIDogInIiKHApLCAiaSIgKGluYykgICAgICBc CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgOiAibWVtb3J5Iik7ICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgICAg ICBpYTY0X2ludHJpX3JlczsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICBcCn0pCgojZGVmaW5lIElBNjRfRkVUQ0hBREQodG1wLHYsbixzeixz ZW0pICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKKHsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICBcCiAgICAgICAgc3dpdGNoIChzeikgeyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICAgICAgIGNh c2UgNDogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgIFwKICAgICAgICAgICAgICAgIHRtcCA9IGlhNjRfZmV0Y2hhZGQ0XyMjc2VtKCh1bnNp Z25lZCBpbnQgKikgdiwgbik7ICAgICAgICAgICAgICBcCiAgICAgICAgICAgICAgICBicmVhazsg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg XAogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgICAgICAgICAgICBjYXNlIDg6ICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCiAgICAg ICAgICAgICAgICB0bXAgPSBpYTY0X2ZldGNoYWRkOF8jI3NlbSgodW5zaWduZWQgbG9uZyAqKSB2 LCBuKTsgICAgICAgICAgICAgXAogICAgICAgICAgICAgICAgYnJlYWs7ICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIFwKICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBcCiAgICAgICAgICAgICAgZGVmYXVsdDogICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICAgICAgICAgX19i YWRfc2l6ZV9mb3JfaWE2NF9mZXRjaF9hbmRfYWRkKCk7ICAgICAgICAgICAgICAgICAgICAgICAg ICAgIFwKICAgICAgICB9ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcCn0pCgojZGVmaW5lIGlhNjRfZmV0Y2hhZGQo aSx2LHNlbSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgXAooeyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgIF9fdTY0 IF90bXA7ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgXAogICAgICAgIHZvbGF0aWxlIF9fdHlwZW9mX18oKih2KSkgKl92 ID0gKHYpOyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAg ICAgIC8qIENhbid0IHVzZSBhIHN3aXRjaCAoKSBoZXJlOiBnY2MgaXNuJ3QgYWx3YXlzIHNtYXJ0 IGVub3VnaCBmb3IgdGhhdC4uLiAqLyAgICAgXAogICAgICAgIGlmICgoaSkgPT0gLTE2KSAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgXAogICAgICAgICAgICAgICAgSUE2NF9GRVRDSEFERChfdG1wLCBfdiwgLTE2LCBzaXplb2Yo Kih2KSksIHNlbSk7ICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgIGVsc2UgaWYgKChp KSA9PSAtOCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgXAogICAgICAgICAgICAgICAgSUE2NF9GRVRDSEFERChfdG1wLCBfdiwgLTgs IHNpemVvZigqKHYpKSwgc2VtKTsgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgIGVs c2UgaWYgKChpKSA9PSAtNCkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICAgICAgICAgSUE2NF9GRVRDSEFERChfdG1w LCBfdiwgLTQsIHNpemVvZigqKHYpKSwgc2VtKTsgICAgICAgICAgICAgICAgICAgICAgICAgXAog ICAgICAgIGVsc2UgaWYgKChpKSA9PSAtMSkgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICAgICAgICAgSUE2NF9GRVRD SEFERChfdG1wLCBfdiwgLTEsIHNpemVvZigqKHYpKSwgc2VtKTsgICAgICAgICAgICAgICAgICAg ICAgICAgXAogICAgICAgIGVsc2UgaWYgKChpKSA9PSAxKSAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgICAgICAgICAg SUE2NF9GRVRDSEFERChfdG1wLCBfdiwgMSwgc2l6ZW9mKCoodikpLCBzZW0pOyAgICAgICAgICAg ICAgICAgICAgICAgICAgXAogICAgICAgIGVsc2UgaWYgKChpKSA9PSA0KSAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAg ICAgICAgICAgSUE2NF9GRVRDSEFERChfdG1wLCBfdiwgNCwgc2l6ZW9mKCoodikpLCBzZW0pOyAg ICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgIGVsc2UgaWYgKChpKSA9PSA4KSAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg XAogICAgICAgICAgICAgICAgSUE2NF9GRVRDSEFERChfdG1wLCBfdiwgOCwgc2l6ZW9mKCoodikp LCBzZW0pOyAgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgIGVsc2UgaWYgKChpKSA9 PSAxNikgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgXAogICAgICAgICAgICAgICAgSUE2NF9GRVRDSEFERChfdG1wLCBfdiwgMTYsIHNp emVvZigqKHYpKSwgc2VtKTsgICAgICAgICAgICAgICAgICAgICAgICAgXAogICAgICAgIGVsc2Ug ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgXAogICAgICAgICAgICAgICAgX3RtcCA9IF9fYmFkX2luY3JlbWVu dF9mb3JfaWE2NF9mZXRjaF9hbmRfYWRkKCk7ICAgICAgICAgICAgICAgICAgICAgICAgXAogICAg ICAgIChfX3R5cGVvZl9fKCoodikpKSAoX3RtcCk7ICAgICAgLyogcmV0dXJuIG9sZCB2YWx1ZSAq LyAgICAgICAgICAgICAgICAgICAgICAgICAgXAp9KQoKI2RlZmluZSBUSUNLRVRfU0hJRlQgICAg MTcKI2RlZmluZSBUSUNLRVRfQklUUyAgICAgMTUKI2RlZmluZSBUSUNLRVRfTUFTSyAgICAgKCgx IDw8IFRJQ0tFVF9CSVRTKSAtIDEpCgpzdGF0aWMgX19hbHdheXNfaW5saW5lIHZvaWQgX190aWNr ZXRfc3Bpbl9sb2NrKGFyY2hfc3BpbmxvY2tfdCAqbG9jaykKewogICAgICAgIGludCAgICAgKnAg PSAoaW50ICopJmxvY2stPmxvY2ssIHRpY2tldCwgc2VydmU7CgogICAgICAgIHRpY2tldCA9IGlh NjRfZmV0Y2hhZGQoMSwgcCwgYWNxKTsKCiAgICAgICAgaWYgKCEoKCh0aWNrZXQgPj4gVElDS0VU X1NISUZUKSBeIHRpY2tldCkgJiBUSUNLRVRfTUFTSykpCiAgICAgICAgICAgICAgICByZXR1cm47 CgogICAgICAgIGlhNjRfaW52YWxhKCk7CgpzLT5sb2Nrc1ttZV0gPSB0aWNrZXQ7CiAgICAgICAg Zm9yICg7OykgewogICAgICAgICAgICAgICAgYXNtIHZvbGF0aWxlICgibGQ0LmMubmMgJTA9WyUx XSIgOiAiPXIiKHNlcnZlKSA6ICJyIihwKSA6ICJtZW1vcnkiKTsKCiAgICAgICAgICAgICAgICBp ZiAoISgoKHNlcnZlID4+IFRJQ0tFVF9TSElGVCkgXiB0aWNrZXQpICYgVElDS0VUX01BU0spKSB7 CnMtPmxvY2tzW21lXSA9IDA7CiAgICAgICAgICAgICAgICAgICAgICAgIHJldHVybjsKCQl9CiAg ICAgICAgICAgICAgICBjcHVfcmVsYXgoKTsKICAgICAgICB9Cn0KCnN0YXRpYyBfX2Fsd2F5c19p bmxpbmUgdm9pZCBfX3RpY2tldF9zcGluX3VubG9jayhhcmNoX3NwaW5sb2NrX3QgKmxvY2spCnsK ICAgICAgICB1bnNpZ25lZCBzaG9ydCAgKnAgPSAodW5zaWduZWQgc2hvcnQgKikmbG9jay0+bG9j ayArIDEsIHRtcDsKCiAgICAgICAgYXNtIHZvbGF0aWxlICgibGQyLmJpYXMgJTA9WyUxXSIgOiAi PXIiKH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gMDsKCX0KCgl3aGlsZSAoMSkgewoJCXNsZWVwKDUpOwoJCXByaW50ZigiJWxkIFtsb2Nr ID0gJS44eF1cbiIsIHMtPnN1Y2Nlc3MsIHMtPmwubG9jayk7CgkJZm9yIChpID0gMDsgaSA8IHdv cmtlcnM7IGkrKykKCQkJcHJpbnRmKCIgJWxkICUuOHhcbiIsIHMtPndvcmtlcltpXSwgcy0+bG9j a3NbaV0pOwoJfQp9Cg== --_002_987664A83D2D224EAE907B061CE93D53015D91D604orsmsx505amrc_-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/