All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Vamsi Krishna S ." <vamsi@in.ibm.com>
To: Mark Gross <mgross@unix-os.sc.intel.com>
Cc: Daniel Jacobowitz <dan@debian.org>, Pavel Machek <pavel@suse.cz>,
	linux-kernel@vger.kernel.org, alan@lxorguk.ukuu.org.uk,
	marcelo@conectiva.com.br, tachino@jp.fujitsu.com,
	jefreyr@pacbell.net, vamsi_krishna@in.ibm.com,
	richardj_moore@uk.ibm.com, hanharat@us.ibm.com,
	bsuparna@in.ibm.com, bharata@in.ibm.com,
	asit.k.mallick@intel.com, david.p.howell@intel.com,
	tony.luck@intel.com, sunil.saxena@intel.com
Subject: Re: [PATCH] multithreaded coredumps for elf exeecutables
Date: Thu, 21 Mar 2002 15:33:20 +0530	[thread overview]
Message-ID: <20020321153320.A1356@in.ibm.com> (raw)
In-Reply-To: <20020315170726.A3405@in.ibm.com> <20020320113630.A6882@in.ibm.com> <20020320133709.A10958@nevyn.them.org> <200203201912.g2KJC2W24374@unix-os.sc.intel.com>

Mark,

Does moving the down_write() to be after the registers of all 
threads are collected help? (This patch on top of our previous
one)
--
--- 2417-tcore/fs/binfmt_elf.c.ori	Thu Mar 21 15:30:08 2002
+++ 2417-tcore/fs/binfmt_elf.c	Thu Mar 21 15:27:29 2002
@@ -1289,10 +1289,6 @@
 	int dump_threads = 0;
 	int thread_status_size = 0;
 	
-	/* now stop all vm operations */
-	down_write(&current->mm->mmap_sem);
-	segs = current->mm->map_count;
-
  	if (atomic_read(&current->mm->mm_users) != 1) {
 		dump_threads = core_dumps_threads;
 	}
@@ -1337,6 +1333,19 @@
 		}
 	} /* End if(dump_threads) */
 
+	/*
+	 * This transfers the registers from regs into the standard
+	 * coredump arrangement, whatever that is. We need to do this
+	 * before acquiring mmap_sem as on some architectures (IA64)
+	 * we may need to access user pages to get register state.
+	 */
+	memset(&prstatus, 0, sizeof(prstatus));
+	elf_core_copy_regs(&prstatus.pr_reg, regs);
+
+	/* now stop all vm operations */
+	down_write(&current->mm->mmap_sem);
+	segs = current->mm->map_count;
+
 #ifdef DEBUG
 	printk("elf_core_dump: %d segs %lu limit\n", segs, limit);
 #endif
@@ -1358,16 +1367,9 @@
 	 * Set up the notes in similar form to SVR4 core dumps made
 	 * with info from their /proc.
 	 */
-	memset(&prstatus, 0, sizeof(prstatus));
 	fill_prstatus(&prstatus, current, signr);
 	fill_note(&notes[0], "CORE", NT_PRSTATUS, sizeof(prstatus), &prstatus);
 
-	/*
-	 * This transfers the registers from regs into the standard
-	 * coredump arrangement, whatever that is.
-	 */
-	elf_core_copy_regs(&prstatus.pr_reg, regs);
-
 #ifdef DEBUG
 	dump_regs("Passed in regs", (elf_greg_t *)regs);
 	dump_regs("prstatus regs", (elf_greg_t *)&prstatus.pr_reg);


-- 
Vamsi Krishna S.
Linux Technology Center,
IBM Software Lab, Bangalore.
Ph: +91 80 5262355 Extn: 3959
Internet: vamsi@in.ibm.com

On Wed, Mar 20, 2002 at 11:14:56AM -0500, Mark Gross wrote:
> I've only JUST started on the Itanium version of this patch.  In my initial 
> testing, after hacking around some of the compilation issues,  I do get a 
> type of process freezing when attempting this.  Could be this bug.  
> 
> Thanks for the tip ;)
> 
> --mgross
> 
> 
> 
> On Wednesday 20 March 2002 01:37 pm, Daniel Jacobowitz wrote:
> > On Wed, Mar 20, 2002 at 11:36:30AM +0530, Vamsi Krishna S . wrote:
> > > There is serialization at higher level. We take a write lock
> > > on current->mm->mmap_sem at the beginning of elf_core_dump
> > > function which is released just before leaving the function.
> > > So, if one thread enters elf_core_dump and starts dumping core,
> > > no other thread (same mm) of the same process can start
> > > dumping.
> > > <snip>
> >
> > That's not a feature, it's a bug.  You can't take the mmap_sem before
> > collecting thread status; it will cause a deadlock on at least ia64,
> > where some registers are collected from user memory.
> >
> > (Thanks to Manfred Spraul for explaining that to me.)

  reply	other threads:[~2002-03-21 10:01 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-15 11:37 [PATCH] multithreaded coredumps for elf exeecutables Vamsi Krishna S .
2002-03-19 15:29 ` Pavel Machek
2002-03-19 18:49   ` Mark Gross
2002-03-20  6:06     ` Vamsi Krishna S .
2002-03-20 18:37       ` Daniel Jacobowitz
2002-03-20 16:14         ` Mark Gross
2002-03-21 10:03           ` Vamsi Krishna S . [this message]
2002-03-22 16:19             ` Mark Gross
2002-03-21 10:16         ` Vamsi Krishna S .
2002-03-21 16:27           ` Daniel Jacobowitz
2002-03-21 16:52             ` Alan Cox
2002-03-21 14:10               ` Mark Gross
2002-03-21 17:34                 ` Alan Cox
2002-03-21 14:59                   ` Mark Gross
2002-03-21 20:25                 ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2002-03-22  6:06 Suparna Bhattacharya
2002-03-29  5:43 ` Jeff Jenkins
2002-03-29 12:50   ` Mark Gross

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=20020321153320.A1356@in.ibm.com \
    --to=vamsi@in.ibm.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=asit.k.mallick@intel.com \
    --cc=bharata@in.ibm.com \
    --cc=bsuparna@in.ibm.com \
    --cc=dan@debian.org \
    --cc=david.p.howell@intel.com \
    --cc=hanharat@us.ibm.com \
    --cc=jefreyr@pacbell.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcelo@conectiva.com.br \
    --cc=mgross@unix-os.sc.intel.com \
    --cc=pavel@suse.cz \
    --cc=richardj_moore@uk.ibm.com \
    --cc=sunil.saxena@intel.com \
    --cc=tachino@jp.fujitsu.com \
    --cc=tony.luck@intel.com \
    --cc=vamsi_krishna@in.ibm.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.