public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Manfred Spraul <manfred@colorfullife.com>
To: Christoph Lameter <cl@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Julia Lawall <julia@diku.dk>
Subject: Re: 2.6.35-rc3 deadlocks on semaphore operations
Date: Sat, 19 Jun 2010 13:06:03 +0200	[thread overview]
Message-ID: <4C1CA49B.7020104@colorfullife.com> (raw)
In-Reply-To: <alpine.DEB.2.00.1006180940140.11575@router.home>

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

On 06/18/2010 04:49 PM, Christoph Lameter wrote:
> linux-2.6$ strace -p21561
> Process 21561 attached - interrupt to quit
> semop(32768, {{0, -1, SEM_UNDO}}, 1
>
> linux-2.6$ strace -p21751
> Process 21751 attached - interrupt to quit
> semop(32768, {{0, -1, SEM_UNDO}}, 1
>
> linux-2.6$ strace -p21792
> Process 21792 attached - interrupt to quit
> semop(32768, {{0, -1, SEM_UNDO}}, 1
>
> linux-2.6$ strace -p21793
> Process 21793 attached - interrupt to quit
> semop(32768, {{0, -1, SEM_UNDO}}, 1
>
>    
What are the semaphore values?

Could you run
$ ipcs
$ cat /proc/sysvipc/sem
$ ./getall 32768 -v

getall is attached.

--
     Manfred


[-- Attachment #2: getall.c --]
[-- Type: text/plain, Size: 1729 bytes --]

/*
 * Copyright (C) 1999 by Manfred Spraul.
 * 
 * Redistribution of this file is permitted under the terms of the GNU 
 * General Public License (GPL)
 * $Header: /home/manfred/cvs-tree/manfred/ipcsem/getall.c,v 1.2 2001/02/27 15:44:32 manfred Exp $
 */

#include <sys/sem.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <assert.h>

#define TRUE	1
#define FALSE	0

union semun {
	int val;
	struct semid_ds *buf;
	unsigned short int *array;
	struct seminfo* __buf;
};


int main(int argc,char** argv)
{
	int id;
	int key;
	int res;
	int nsems;

	printf("getall <id> [-v]\n");
	if(argc < 2 || argc > 3) {
		printf("Invalid parameters.\n");
		return 1;
	}
	if (argc == 3 && strcmp(argv[2], "-v")) {
		printf("Invalid parameters.\n");
		return 1;
	}
	key = atoi(argv[1]);
	if(key < 0) {
		printf("Invalid parameters.\n");
		return 1;
	}
/*	id = semget(key,1,0);
	if(id == -1) {
		printf(" findkey() failed.\n");
		return 1;
	} */
	id = key;
	{
		union semun arg;
		struct semid_ds info;

		arg.buf = &info;
		res = semctl(id,0,2,arg);

		if(res==-1) {
			printf("semctl(2) failed (%d).\n",errno);
			return 1;
		}
		nsems = info.sem_nsems;
		printf("found %d semaphores.\n",nsems);
	}
	{
		union semun arg;
		unsigned short *pv;
		int i;
		pv = malloc(sizeof(unsigned short)*nsems);
		arg.array = pv;
		res = semctl(id,nsems, GETALL, arg);
		if(res==-1) {
			printf("GETALL failed.\n");
			return 1;
		}
		for(i=0;i<nsems;i++) {
			if (argc == 3) {
				printf(" %3d: %3d (cnt %3d zcnt %3d)\n",
					i, pv[i], semctl(id, i, GETNCNT),
					semctl(id, i, GETZCNT));
			} else {
				if(i%16 == 0)
					printf("\n 0x%4.4x:",i);
				printf(" %3d",pv[i]);
			}
		}
		printf("\n");
	}
	return 0;
}

  parent reply	other threads:[~2010-06-19 11:05 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-18 14:49 2.6.35-rc3 deadlocks on semaphore operations Christoph Lameter
2010-06-18 14:56 ` Christoph Lameter
2010-06-19 14:43   ` Manfred Spraul
2010-06-21 14:31     ` Christoph Lameter
2010-06-21 16:52       ` Manfred Spraul
2010-06-21 17:13         ` Christoph Lameter
2010-06-18 15:34 ` Julia Lawall
2010-06-19 11:06 ` Manfred Spraul [this message]
2010-06-21 17:05   ` Christoph Lameter
2010-06-21 17:16     ` Christoph Lameter
2010-06-21 18:05       ` 2.6.35-rc3 deadlocks on wakeup(?) (was on semaphore operations) Christoph Lameter
2010-06-20  6:55 ` 2.6.35-rc3 deadlocks on semaphore operations Maciej Rutecki
2010-06-21 20:01 ` Luca Tettamanti
2010-06-23 16:29   ` Manfred Spraul
2010-06-23 19:14     ` Luca Tettamanti
2010-06-24 19:22       ` Luca Tettamanti
2010-06-25 21:09         ` Manfred Spraul
2010-06-26 12:52           ` Luca Tettamanti
2010-06-26 15:47             ` 2.6.35-rc3: System unresponsive under load Manfred Spraul
2010-06-26 15:49               ` Manfred Spraul
2010-06-26 16:47               ` Luca Tettamanti
2010-06-30 19:07                 ` Manfred Spraul
2010-07-06 16:01                   ` Luca Tettamanti
2010-07-07 19:34                   ` Luca Tettamanti
2010-07-02 15:53             ` 2.6.35-rc3 deadlocks on semaphore operations Manfred Spraul
2010-06-23 20:27     ` Christoph Lameter

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=4C1CA49B.7020104@colorfullife.com \
    --to=manfred@colorfullife.com \
    --cc=cl@linux-foundation.org \
    --cc=julia@diku.dk \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox