Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1281058

Re: [PATCH v2 1/2] scripts: Add a recorduidiv program

From Russell King - ARM Linux <linux@arm.linux.org.uk>
Newsgroups linux.kernel
Subject Re: [PATCH v2 1/2] scripts: Add a recorduidiv program
Date 2015-12-01 18:20 +0100
Message-ID <qAWKS-45N-11@gated-at.bofh.it> (permalink)
References (4 earlier) <qAyIy-5q7-15@gated-at.bofh.it> <qAySe-5tX-5@gated-at.bofh.it> <qAVF7-3r6-7@gated-at.bofh.it> <qAVYw-3yp-45@gated-at.bofh.it> <qAWhP-3F3-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Tue, Dec 01, 2015 at 11:49:29AM -0500, Steven Rostedt wrote:
> On Tue, 1 Dec 2015 16:19:44 +0000
> Russell King - ARM Linux <linux@arm.linux.org.uk> wrote:
>  
> > They hardly "do nothing", as the (eg) recordmcount plasters the build
> > log with warnings.  A solution to that would be to make recordmcount
> > silent if the section is already present.
> 
> Note, that warning found plenty of bugs when modifications of the build
> system was being done and broke recordmcount.c. I really don't want to
> silent it.
> 
> But for some reason, your build is causing lots of warnings and not for
> others. Perhaps we can add a "SILENT_RECORDMCOUNT" environment variable
> and have it set when something like CCACHE_HARDLINK or whatever is
> causing it to trigger when we don't care.

The case is:

Build 1 runs with CCACHE_HARDLINK enabled.
- Each object ccache creates will be stored in ccache, and hard linked
  into the throw-away object tree.
- recordmcount modifies in-place the object in the object tree, which
  also modifies the object in the ccache repository.

The throw-away object tree is thrown away, and a new tree is created,
and the build re-run.  It doesn't matter what CCACHE options are used,
the effect will now be the same:
- Each "hit" ccache object from the previous build will be linked or
  copied to the new throw-away object tree.
- recordmcount will be re-run on the object, which now contains the
  results of the previous recordmcount in-place modification.  This
  causes recordmcount to issue a warning.

There's two solutions to this: one is to disable CCACHE_HARDLINK for
all kernel builds which use in-place object modification.  The other
solution is to avoid in-place object modification, instead doing a
read-write-rename.

I think I ought to ask another question though, before we decide what
to do.  With recordmcount doing in-place object modification, what
happens if a SIGINT or similar is received half way through the
modification of an object?  I would hope that make would delete the
object and not leave it around.

Another suggestion - maybe recordmcount, which fstat()s the file,
should check the st_nlink before modifying the file, and error out
with a helpful error message telling people not to use hardlinks,
which would stop nasty surprises (and make it a rule that this should
be implemented as a general principle for good build behaviour) - iow,
something like this (untested):

 scripts/recordmcount.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/scripts/recordmcount.c b/scripts/recordmcount.c
index 698768bdc581..bb7589fd7392 100644
--- a/scripts/recordmcount.c
+++ b/scripts/recordmcount.c
@@ -203,6 +203,10 @@ static void *mmap_file(char const *fname)
 		fprintf(stderr, "not a regular file: %s\n", fname);
 		fail_file();
 	}
+	if (sb.st_nlink != 1) {
+		fprintf(stderr, "file is hard linked: %s\n", fname);
+		fail_file();
+	}
 	addr = mmap(0, sb.st_size, PROT_READ|PROT_WRITE, MAP_PRIVATE,
 		    fd_map, 0);
 	mmap_failed = 0;


-- 
FTTC broadband for 0.8mile line: currently at 9.6Mbps down 400kbps up
according to speedtest.net.
--
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/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-11-30 16:40 +0100
  Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Michal Marek <mmarek@suse.com> - 2015-11-30 16:50 +0100
    Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Michal Marek <mmarek@suse.cz> - 2015-12-01 17:10 +0100
      Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-01 17:30 +0100
        Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Michal Marek <mmarek@suse.cz> - 2015-12-01 17:50 +0100
        Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Steven Rostedt <rostedt@goodmis.org> - 2015-12-01 17:50 +0100
          Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-01 18:20 +0100
            Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Steven Rostedt <rostedt@goodmis.org> - 2015-12-01 18:30 +0100
              Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-01 19:20 +0100
                Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Michal Marek <mmarek@suse.cz> - 2015-12-01 22:40 +0100
                Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-02 11:30 +0100
                Re: [PATCH v2 1/2] scripts: Add a recorduidiv program Steven Rostedt <rostedt@goodmis.org> - 2015-12-02 15:10 +0100
                Re: [PATCH] scripts: recordmcount: break hardlinks Steven Rostedt <rostedt@goodmis.org> - 2015-12-11 15:40 +0100
                Re: [PATCH] scripts: recordmcount: break hardlinks Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-11 15:50 +0100
                Re: [PATCH] scripts: recordmcount: break hardlinks Steven Rostedt <rostedt@goodmis.org> - 2015-12-11 16:10 +0100
                Re: [PATCH] scripts: recordmcount: break hardlinks Steven Rostedt <rostedt@goodmis.org> - 2015-12-11 19:20 +0100
                Re: [PATCH] scripts: recordmcount: break hardlinks Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-11 19:40 +0100
                Re: [PATCH] scripts: recordmcount: break hardlinks Russell King - ARM Linux <linux@arm.linux.org.uk> - 2015-12-11 20:00 +0100
                Re: [PATCH] scripts: recordmcount: break hardlinks Steven Rostedt <rostedt@goodmis.org> - 2015-12-11 20:30 +0100
                Re: [PATCH] scripts: recordmcount: break hardlinks Steven Rostedt <rostedt@goodmis.org> - 2015-12-11 20:00 +0100

csiph-web