* Re: [PATCH 2/2] x86, microcode, AMD: Add microcode revision to /proc/cpuinfo
From: Ingo Molnar @ 2011-10-23 11:48 UTC (permalink / raw)
To: Borislav Petkov; +Cc: X86-ML, LKML
In-Reply-To: <20111019142057.GA26786@aftab>
* Borislav Petkov <bp@amd64.org> wrote:
> On Tue, Oct 18, 2011 at 02:25:10AM -0400, Ingo Molnar wrote:
> > The standard way we mention commits in changelogs is:
> >
> > Enable microcode revision output for AMD after commit 506ed6b53e00
> > ("x86, intel: Output microcode revision in /proc/cpuinfo") did it
> > for Intel.
> >
> > ... because humans are pretty bad at transforming sha1's to the real
> > commit title when reading such text.
>
> Why, I thought transforming sha1's to commit messages is one of the job
> requirements of serious kernel hackers.
>
> :-)
But they are not the only ones reading changelogs ;-)
> > Please fix the changelog for the first commit as well.
>
> Done, git branch at
>
> git://amd64.org/linux/bp.git tip-ucode
>
> updated.
Pulled, thanks,
Ingo
^ permalink raw reply
* Re: [22/27] VFS: Fix automount for negative autofs dentries
From: Greg KH @ 2011-10-23 11:48 UTC (permalink / raw)
To: Ian Kent
Cc: Greg KH, linux-kernel, stable, stable-review, torvalds, akpm,
alan, David Howells, Al Viro, Chuck Ebbert
In-Reply-To: <1319370078.7876.8.camel@perseus.themaw.net>
On Sun, Oct 23, 2011 at 07:41:18PM +0800, Ian Kent wrote:
> On Sun, 2011-10-23 at 08:24 +0200, Greg KH wrote:
> > 3.0-stable review patch. If anyone has any objections, please let us know.
>
> Yes, as others point out, either the patch needs to be correctly
> backported or the dependent patches need to be pulled in.
>
> I can do either of these, what would you prefer?
I'd prefer to take the dependant patches, as that would make things sync
up with what is in Linus's tree, I just wanted to get Miklos's and
David's acks that this is the way to go before I did it.
thanks,
greg k-h
^ permalink raw reply
* Re: Request for DIscussion: Cpufreq logging, and frequency floors
From: Mark Brown @ 2011-10-23 11:48 UTC (permalink / raw)
To: Steven Finney (Palm GBU); +Cc: cpufreq@vger.kernel.org
In-Reply-To: <465E946FB313F242A955E3365C8D13A510491297@ushqwmb10>
On Fri, Oct 21, 2011 at 02:31:57PM -0700, Steven Finney (Palm GBU) wrote:
> 2) The ability to keep a diagnostic log of all the frequency changes so,
> e.g., it's possible to determine if bad behavior (e.g. dropouts) is
> correlated with a low frequency.
This is a really good and useful idea but it seems to me like it would
be better done with the standard trace subsystem - that provides good
facilities for enabling and disabling the trace as needed and would make
it easy to tie in with the other subsystems that are in play.
^ permalink raw reply
* Re: [PATCH] CIFS: fix automount for DFS shares
From: Jeff Layton @ 2011-10-23 11:46 UTC (permalink / raw)
To: Ian Kent; +Cc: Gerlando Falauto, linux-kernel, David Howells
In-Reply-To: <1319368474.7876.4.camel@perseus.themaw.net>
On Sun, 23 Oct 2011 19:14:34 +0800
Ian Kent <raven@themaw.net> wrote:
> On Fri, 2011-10-07 at 13:09 +0200, Gerlando Falauto wrote:
> > Automounting directories are now invalidated by .d_revalidate()
> > so to be d_instantiate()d again with the right DCACHE_NEED_AUTOMOUNT
> > flag
>
> But why doesn't CIFS know this is a DFS inode the first time around, it
> appears to do a truck load of work looking that stuff up?
>
This area needs some work...
The readdir codepath in cifs uses the FIND_FIRST/NEXT calls on the
wire. Those return both filenames and attributes for the particular SMB
call infolevel. That in turn is used to instantiate dentries and inodes
for those entries.
Unfortunately though, we have not found a way to determine whether a
particular inode is a DFS referral from within this codepath. The only
way to know for sure (AFAIK) is to try an operation on a specific
pathname and then look for a NT_STATUS_PATH_NOT_COVERED return code.
> >
> > Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> > ---
> > fs/cifs/dir.c | 7 ++++++-
> > 1 files changed, 6 insertions(+), 1 deletions(-)
> >
> > diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> > index 9ea65cf..67f54d3 100644
> > --- a/fs/cifs/dir.c
> > +++ b/fs/cifs/dir.c
> > @@ -637,8 +637,13 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
> > if (direntry->d_inode) {
> > if (cifs_revalidate_dentry(direntry))
> > return 0;
> > - else
> > + else {
> > + /* We want automonting inodes to be
> > + * considered invalid or so */
> > + if (IS_AUTOMOUNT(direntry->d_inode))
> > + return 0;
>
> I'd be inclined to set DCACHE_NEED_AUTOMOUNT here but are we certain
> that cifs_revalidate_dentry() will always return 0 for a DFS inode or at
> least ones that don't yet have DCACHE_NEED_AUTOMOUNT set and why?
>
You mean you'd set that in the "return 1" case here? That doesn't sound
quite right if so. This inode could be entirely unrelated to DFS.
Currently, cifs_revalidate_dentry checks to see if the attributes on
the inode are "too old" (past the actimeo setting). If they are then it
will issue a QUERY_PATH_INFO call on the wire to try and update those
attributes. If it's a DFS inode then you'll get an error back and that
function should return 0.
It's possible however that the inode has already had its attributes
updated recently, and was found to be an automount point. That is, it
got S_AUTOMOUNT set but no referral chasing happened. At that point I'm
a little fuzzy as to what should happen...
The safest thing would seem to be to return 0 in that case, to force an
invalidation and lookup on this dentry again, but maybe there's a better
way to handle that?
> > return 1;
> > + }
> > }
> >
> > /*
>
>
--
Jeff Layton <jlayton@redhat.com>
^ permalink raw reply
* Re: [22/27] VFS: Fix automount for negative autofs dentries
From: Ian Kent @ 2011-10-23 11:41 UTC (permalink / raw)
To: Greg KH
Cc: linux-kernel, stable, stable-review, torvalds, akpm, alan,
David Howells, Al Viro, Chuck Ebbert
In-Reply-To: <20111023062540.684446582@pistachio.kroah.org>
On Sun, 2011-10-23 at 08:24 +0200, Greg KH wrote:
> 3.0-stable review patch. If anyone has any objections, please let us know.
Yes, as others point out, either the patch needs to be correctly
backported or the dependent patches need to be pulled in.
I can do either of these, what would you prefer?
>
> ------------------
>
> From: David Howells <dhowells@redhat.com>
>
> commit 5a30d8a2b8ddd5102c440c7e5a7c8e1fd729c818 upstream.
> [ backport for 3.0.x: LOOKUP_PARENT => LOOKUP_CONTINUE by Chuck Ebbert
> <cebbert@redhat.com> ]
>
> Autofs may set the DCACHE_NEED_AUTOMOUNT flag on negative dentries. These
> need attention from the automounter daemon regardless of the LOOKUP_FOLLOW flag.
>
> Signed-off-by: David Howells <dhowells@redhat.com>
> Acked-by: Ian Kent <raven@themaw.net>
> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Chuck Ebbert <cebbert@redhat.com>
> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
>
> ---
> fs/namei.c | 24 +++++++++++++++---------
> 1 file changed, 15 insertions(+), 9 deletions(-)
>
> --- a/fs/namei.c
> +++ b/fs/namei.c
> @@ -779,19 +779,25 @@ static int follow_automount(struct path
> if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_CONTINUE))
> return -EISDIR; /* we actually want to stop here */
>
> - /* We want to mount if someone is trying to open/create a file of any
> - * type under the mountpoint, wants to traverse through the mountpoint
> - * or wants to open the mounted directory.
> - *
> + /*
> * We don't want to mount if someone's just doing a stat and they've
> * set AT_SYMLINK_NOFOLLOW - unless they're stat'ing a directory and
> * appended a '/' to the name.
> */
> - if (!(flags & LOOKUP_FOLLOW) &&
> - !(flags & (LOOKUP_CONTINUE | LOOKUP_DIRECTORY |
> - LOOKUP_OPEN | LOOKUP_CREATE)))
> - return -EISDIR;
> -
> + if (!(flags & LOOKUP_FOLLOW)) {
> + /* We do, however, want to mount if someone wants to open or
> + * create a file of any type under the mountpoint, wants to
> + * traverse through the mountpoint or wants to open the mounted
> + * directory.
> + * Also, autofs may mark negative dentries as being automount
> + * points. These will need the attentions of the daemon to
> + * instantiate them before they can be used.
> + */
> + if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
> + LOOKUP_OPEN | LOOKUP_CREATE)) &&
> + path->dentry->d_inode)
> + return -EISDIR;
> + }
> current->total_link_count++;
> if (current->total_link_count >= 40)
> return -ELOOP;
>
>
^ permalink raw reply
* Re: kernel.org tarball/patch signature files
From: Greg KH @ 2011-10-23 11:37 UTC (permalink / raw)
To: Jari Ruusu; +Cc: linux-kernel
In-Reply-To: <4EA3F7C0.24E469C5@users.sourceforge.net>
On Sun, Oct 23, 2011 at 02:17:20PM +0300, Jari Ruusu wrote:
> I noticed that patch-3.0.7.sign is a detached signature file for
> DECOMPRESSED patch-3.0.7.{bz2,gz,xz}.
That's exactly what I said in my announcement:
https://lkml.org/lkml/2011/10/23/51
so I'm glad it's working properly :)
> Maybe this is not the best possible
> way to sign compressed tarballs/patches. This is because it places hell of
> lot of trust on quality/security of decompressor implementation.
> Historically decompressor implementations have had bugs and security flaws.
> It is stupid to assume that there won't be any more of them.
>
> Wrong order to verify compressed tarball/patch:
>
> (1) Feed potentially maliciously formatted data to decompressor, and exploit
> any undiscovered/unpatched vulnerability in decompressor implementation.
> (2) Verify decompressed output.
>
> Much better order would be:
>
> (1) Verify compressed data.
> (2) Feed trusted data to decompressor.
>
> So, would it be possible to have multiple signature files like this? Please.
>
> patch-3.X.Y.bz2
> patch-3.X.Y.bz2.sign
> patch-3.X.Y.gz
> patch-3.X.Y.gz.sign
> patch-3.X.Y.xz
> patch-3.X.Y.xz.sign
Nope, sorry, let's try this way instead. That way we only have to
generate one signature, not 3.
If you are really worried about decompressor bugs, then run them in a
virtual machine/chroot :)
greg k-h
^ permalink raw reply
* [U-Boot] [RESEND PATCH v3] Add assert() for debug assertions
From: Mike Frysinger @ 2011-10-23 11:37 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20111023083537.2DD1A18AE823@gemini.denx.de>
On Sun, Oct 23, 2011 at 04:35, Wolfgang Denk wrote:
> Simon Glass wrote:
>> > Can you please #ifdef it so it doesn't get added for the non-debug
>> > case, too?
>>
>> Well I could, but then if someone defines DEBUG in a file they will
>> get a link error I think. Or are you thinking of adding a new CONFIG
>> which *permits* people to use DEBUG?
>
> I don't understand what you mean.
>
> __assert_fail() only ever gets used (and thus needs to be compiled in)
> if DEBUG is defined, right? ?SO why cannot you wrap the code in a
> "#ifdef DEBUG" ?
people often enable DEBUG on a per file basis. so if i'm debugging
drivers/spi/bfin_spi.c, i put "#define DEBUG" at the top of it.
-mike
^ permalink raw reply
* Re: Linux 3.1-rc9
From: Ingo Molnar @ 2011-10-23 11:34 UTC (permalink / raw)
To: Martin Schwidefsky
Cc: Linus Torvalds, Simon Kirby, Peter Zijlstra,
Linux Kernel Mailing List, Dave Jones, Thomas Gleixner
In-Reply-To: <20111020163609.16816e78@de.ibm.com>
* Martin Schwidefsky <schwidefsky@de.ibm.com> wrote:
> +#define cputime_zero ((__force cputime_t) 0ULL)
> +#define cputime64_zero ((__force cputime64_t) 0ULL)
Hm, why are these still needed?
This:
if (*newval == cputime_zero)
return;
Could be written as the much simpler:
if (!*newval)
return;
with no ill effect that i can see.
Thanks,
Ingo
^ permalink raw reply
* Re: [Qemu-devel] [PATCH 06/21] target-sparc: Extract common code for floating-point operations.
From: Blue Swirl @ 2011-10-23 11:34 UTC (permalink / raw)
To: Richard Henderson; +Cc: qemu-devel
In-Reply-To: <4E9DFBDC.6040302@twiddle.net>
On Tue, Oct 18, 2011 at 22:21, Richard Henderson <rth@twiddle.net> wrote:
> On 10/18/2011 01:24 PM, Blue Swirl wrote:
>>> #ifdef TARGET_SPARC64
>>> -float64 helper_fabsd(CPUState *env, float64 src)
>>> +float64 helper_fabsd(float64 src)
>>
>> This probably should go to previous patch.
>
> Sure.
>
>>> +/* Turn off the stupid always-inline hack in osdep.h. This gets in the
>>> + way of the callback mechanisms we use in this file, generating warnings
>>> + for always-inline functions called indirectly. */
>>> +#define always_inline inline
>>
>> It would be better to just delete the offending (or all) inlines.
>
> I certainly would like to delete the offending hack in osdep.h.
>
> The inline markers themselves are generated by def-helper.h, and are required
> so that we don't wind up with a corresponding number of defined-but-not-used
> errors from the helper.h definitions.
>
> I really didn't know any one way to handle this situation that would be
> immediately acceptable to everyone. I assumed limiting the change to
> the sparc front-end would minimize the pushback.
It should also be possible to add non-inlined wrapper functions to
inlined functions.
>>> +static void gen_ne_fop_FF(DisasContext *dc, int rd, int rs,
>>
>> 'ne' is for no exception? How about noexcp or something?
>
> no-exception when it's first introduced. Then after patch 11 it would
> become no-env. Preferences for the intermediate stage?
Nevermind then.
^ permalink raw reply
* Re: [PATCH] vfs - fix automount should ignore LOOKUP_FOLLOW
From: Ian Kent @ 2011-10-23 11:33 UTC (permalink / raw)
To: Miklos Szeredi
Cc: Linus Torvalds, Kernel Mailing List, Al Viro, David Howells
In-Reply-To: <CAJfpegtA8BmTsPTFb5VpMkb=tRmLvjauMGUbhy7Grco5vcncDg@mail.gmail.com>
On Sun, 2011-10-23 at 06:41 +0200, Miklos Szeredi wrote:
> On Sat, Oct 22, 2011 at 10:01 AM, Ian Kent <raven@themaw.net> wrote:
> > The recent patch by Miklos Szeredi that was meant to restore the original
> > behavior of not triggering automounts on stat(2) and other symlink following
> > syscalls also eliminated the unconditional triggering of automounts for
> > intermediate path components by eliminating the LOOKUP_CONTUNUE flag from
> > the check in fs/namei.c:follow_automount().
> >
> > This introduces a regression itself because it alters the original behaviour
> > which was to unconditionally automount on intermediate path components.
>
> LOOKUP_CONTINUE flag no longer exists (commit 49084c3 "kill LOOKUP_CONTINUE")
Oh .. right, now I think about it I did see that commit, opps!
>
> So this patch makes no sense for HEAD, it may make sense for backports.
Yeah, I was a bit to hasty trying to solve my own backport mistake.
>
> Miklos
>
> >
> > Signed-off-by: Ian Kent <raven@themaw.net>
> > ---
> >
> > fs/namei.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/fs/namei.c b/fs/namei.c
> > index 0b3138d..e4eee7c 100644
> > --- a/fs/namei.c
> > +++ b/fs/namei.c
> > @@ -732,7 +732,7 @@ static int follow_automount(struct path *path, unsigned flags,
> > * as being automount points. These will need the attentions
> > * of the daemon to instantiate them before they can be used.
> > */
> > - if (!(flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY |
> > + if (!(flags & (LOOKUP_PARENT | LOOKUP_CONTINUE | LOOKUP_DIRECTORY |
> > LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) &&
> > path->dentry->d_inode)
> > return -EISDIR;
> >
> >
^ permalink raw reply
* Re: [PATCH 00/28 v6] m68k: Convert to genirq
From: Greg Ungerer @ 2011-10-23 11:29 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, Thomas Gleixner, linux-kernel, netdev
In-Reply-To: <CAMuHMdX7C5NU5_MO5GdO=Pf2X59B3vFo4Y9B5wg-NQzwVbbLZA@mail.gmail.com>
Hi Geert,
On 10/23/2011 07:49 PM, Geert Uytterhoeven wrote:
> On Thu, Oct 20, 2011 at 14:18, Geert Uytterhoeven<geert@linux-m68k.org> wrote:
>> On Sun, Sep 11, 2011 at 13:59, Geert Uytterhoeven<geert@linux-m68k.org> wrote:
>>> This patch series converts the m68k/mmu (nommu was converted before)
>>> architecture to the generic hardirq framework.
>>>
>>> á- [01/28] genirq: Add missing "else" in irq_shutdown()
>>> á- [02/28] ide-{cd,floppy,tape}: Do not include<linux/irq.>
>>> á- [03/28] keyboard: Do not include<linux/irq.>
>>> á- [04/28] m68k/irq: Rename irq_controller to irq_chip
>>> á- [05/28] m68k/irq: Kill irq_node_t typedef, always use struct irq_node
>>> á- [06/28] m68k/irq: Rename irq_node to irq_data
>>> á- [07/28] m68k/irq: Switch irq_chip methods to "struct irq_data *data"
>>> á- [08/28] m68k/irq: Rename setup_irq() to m68k_setup_irq() and make it static
>>> á- [09/28] m68k/irq: Extract irq_set_chip()
>>> á- [10/28] m68k/irq: Add m68k_setup_irq_controller()
>>> á- [11/28] m68k/irq: Rename {,__}m68k_handle_int()
>>> á- [12/28] m68k/irq: Remove obsolete IRQ_FLG_* definitions and users
>>> á- [13/28] m68k/irq: Add genirq support
>>> á- [14/28] m68k/atari: Convert Atari to genirq
>>> á- [15/28] m68k/atari: Remove code and comments about different irq types
>>> á- [16/28] m68k/amiga: Refactor amiints.c
>>> á- [17/28] m68k/amiga: Convert Amiga to genirq
>>> á- [18/28] m68k/amiga: Optimize interrupts using chain handlers
>>> á- [19/28] m68k/mac: Convert Mac to genirq
>>> á- [20/28] m68k/mac: Optimize interrupts using chain handlers
>>> á- [21/28] m68k/hp300: Convert HP9000/300 and HP9000/400 to genirq
>>> á- [22/28] m68k/vme: Convert VME to genirq
>>> á- [23/28] m68k/apollo: Convert Apollo to genirq
>>> á- [24/28] m68k/sun3: Use the kstat_irqs_cpu() wrapper
>>> á- [25/28] m68k/sun3: Convert Sun3/3x to genirq
>>> á- [26/28] m68k/q40: Convert Q40/Q60 to genirq
>>> á- [27/28] m68k/irq: Remove obsolete m68k irq framework
>>> á- [28/28] m68k/irq: Remove obsolete support for user vector interrupt fixups
>>>
>>> Overview:
>>> á- [01] is a fix for the core genirq code,
>>
>> This went into v3.1-rc6.
>>
>>> á- [02-03] are fixes to avoid compile problems later in the conversion
>>> á áprocess,
>>
>> The keyboard path went into the tty -next tree.
>> The IDE one is still pending (I've just resent it).
>
> The IDE one got acked in the mean time.
>
>>> I will update my m68k-genirq branch as soon as master.kernel.org is available
>>> again.
>>
>> Updated, on top of m68k master (which is at v3.1-rc10 now).
>> http://git.kernel.org/?p=linux/kernel/git/geert/linux-m68k.git;a=shortlog;h=refs/heads/m68k-genirq
>>
>> If noone objects, I'd like to add this to the m68k master and for-3.2 branches.
>
> I added it to m68k master.
>
> As there were several merge conflicts with current -next
> (arch/m68k/kernel/Makefile_mm
> due to the mmu/nommu merge, and drivers/net/macsonic.c in [12/28] due
> to the network
> driver reshuffling dance), I did not add it to for-3.2 and for-next,
> but to for-3.3.
>
> Depending on Stephen's return during or after the merge window, and
> the merge timing
> of the m68knommu and netdev trees, I may stil try to sneak it in 3.2, though.
I can ask Linus to pull the m68knommu tree early in the merge window,
if that will help.
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close, FAX: +61 7 3891 3630
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
^ permalink raw reply
* Re: [PATCH 00/28 v6] m68k: Convert to genirq
From: Greg Ungerer @ 2011-10-23 11:29 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, Thomas Gleixner, linux-kernel, netdev
In-Reply-To: <CAMuHMdX7C5NU5_MO5GdO=Pf2X59B3vFo4Y9B5wg-NQzwVbbLZA@mail.gmail.com>
Hi Geert,
On 10/23/2011 07:49 PM, Geert Uytterhoeven wrote:
> On Thu, Oct 20, 2011 at 14:18, Geert Uytterhoeven<geert@linux-m68k.org> wrote:
>> On Sun, Sep 11, 2011 at 13:59, Geert Uytterhoeven<geert@linux-m68k.org> wrote:
>>> This patch series converts the m68k/mmu (nommu was converted before)
>>> architecture to the generic hardirq framework.
>>>
>>> á- [01/28] genirq: Add missing "else" in irq_shutdown()
>>> á- [02/28] ide-{cd,floppy,tape}: Do not include<linux/irq.>
>>> á- [03/28] keyboard: Do not include<linux/irq.>
>>> á- [04/28] m68k/irq: Rename irq_controller to irq_chip
>>> á- [05/28] m68k/irq: Kill irq_node_t typedef, always use struct irq_node
>>> á- [06/28] m68k/irq: Rename irq_node to irq_data
>>> á- [07/28] m68k/irq: Switch irq_chip methods to "struct irq_data *data"
>>> á- [08/28] m68k/irq: Rename setup_irq() to m68k_setup_irq() and make it static
>>> á- [09/28] m68k/irq: Extract irq_set_chip()
>>> á- [10/28] m68k/irq: Add m68k_setup_irq_controller()
>>> á- [11/28] m68k/irq: Rename {,__}m68k_handle_int()
>>> á- [12/28] m68k/irq: Remove obsolete IRQ_FLG_* definitions and users
>>> á- [13/28] m68k/irq: Add genirq support
>>> á- [14/28] m68k/atari: Convert Atari to genirq
>>> á- [15/28] m68k/atari: Remove code and comments about different irq types
>>> á- [16/28] m68k/amiga: Refactor amiints.c
>>> á- [17/28] m68k/amiga: Convert Amiga to genirq
>>> á- [18/28] m68k/amiga: Optimize interrupts using chain handlers
>>> á- [19/28] m68k/mac: Convert Mac to genirq
>>> á- [20/28] m68k/mac: Optimize interrupts using chain handlers
>>> á- [21/28] m68k/hp300: Convert HP9000/300 and HP9000/400 to genirq
>>> á- [22/28] m68k/vme: Convert VME to genirq
>>> á- [23/28] m68k/apollo: Convert Apollo to genirq
>>> á- [24/28] m68k/sun3: Use the kstat_irqs_cpu() wrapper
>>> á- [25/28] m68k/sun3: Convert Sun3/3x to genirq
>>> á- [26/28] m68k/q40: Convert Q40/Q60 to genirq
>>> á- [27/28] m68k/irq: Remove obsolete m68k irq framework
>>> á- [28/28] m68k/irq: Remove obsolete support for user vector interrupt fixups
>>>
>>> Overview:
>>> á- [01] is a fix for the core genirq code,
>>
>> This went into v3.1-rc6.
>>
>>> á- [02-03] are fixes to avoid compile problems later in the conversion
>>> á áprocess,
>>
>> The keyboard path went into the tty -next tree.
>> The IDE one is still pending (I've just resent it).
>
> The IDE one got acked in the mean time.
>
>>> I will update my m68k-genirq branch as soon as master.kernel.org is available
>>> again.
>>
>> Updated, on top of m68k master (which is at v3.1-rc10 now).
>> http://git.kernel.org/?p=linux/kernel/git/geert/linux-m68k.git;a=shortlog;h=refs/heads/m68k-genirq
>>
>> If noone objects, I'd like to add this to the m68k master and for-3.2 branches.
>
> I added it to m68k master.
>
> As there were several merge conflicts with current -next
> (arch/m68k/kernel/Makefile_mm
> due to the mmu/nommu merge, and drivers/net/macsonic.c in [12/28] due
> to the network
> driver reshuffling dance), I did not add it to for-3.2 and for-next,
> but to for-3.3.
>
> Depending on Stephen's return during or after the merge window, and
> the merge timing
> of the m68knommu and netdev trees, I may stil try to sneak it in 3.2, though.
I can ask Linus to pull the m68knommu tree early in the merge window,
if that will help.
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close, FAX: +61 7 3891 3630
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
^ permalink raw reply
* Re: [PATCH 00/28 v6] m68k: Convert to genirq
From: Greg Ungerer @ 2011-10-23 11:29 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linux-m68k, Thomas Gleixner, linux-kernel, netdev
In-Reply-To: <CAMuHMdX7C5NU5_MO5GdO=Pf2X59B3vFo4Y9B5wg-NQzwVbbLZA@mail.gmail.com>
Hi Geert,
On 10/23/2011 07:49 PM, Geert Uytterhoeven wrote:
> On Thu, Oct 20, 2011 at 14:18, Geert Uytterhoeven<geert@linux-m68k.org> wrote:
>> On Sun, Sep 11, 2011 at 13:59, Geert Uytterhoeven<geert@linux-m68k.org> wrote:
>>> This patch series converts the m68k/mmu (nommu was converted before)
>>> architecture to the generic hardirq framework.
>>>
>>> á- [01/28] genirq: Add missing "else" in irq_shutdown()
>>> á- [02/28] ide-{cd,floppy,tape}: Do not include<linux/irq.>
>>> á- [03/28] keyboard: Do not include<linux/irq.>
>>> á- [04/28] m68k/irq: Rename irq_controller to irq_chip
>>> á- [05/28] m68k/irq: Kill irq_node_t typedef, always use struct irq_node
>>> á- [06/28] m68k/irq: Rename irq_node to irq_data
>>> á- [07/28] m68k/irq: Switch irq_chip methods to "struct irq_data *data"
>>> á- [08/28] m68k/irq: Rename setup_irq() to m68k_setup_irq() and make it static
>>> á- [09/28] m68k/irq: Extract irq_set_chip()
>>> á- [10/28] m68k/irq: Add m68k_setup_irq_controller()
>>> á- [11/28] m68k/irq: Rename {,__}m68k_handle_int()
>>> á- [12/28] m68k/irq: Remove obsolete IRQ_FLG_* definitions and users
>>> á- [13/28] m68k/irq: Add genirq support
>>> á- [14/28] m68k/atari: Convert Atari to genirq
>>> á- [15/28] m68k/atari: Remove code and comments about different irq types
>>> á- [16/28] m68k/amiga: Refactor amiints.c
>>> á- [17/28] m68k/amiga: Convert Amiga to genirq
>>> á- [18/28] m68k/amiga: Optimize interrupts using chain handlers
>>> á- [19/28] m68k/mac: Convert Mac to genirq
>>> á- [20/28] m68k/mac: Optimize interrupts using chain handlers
>>> á- [21/28] m68k/hp300: Convert HP9000/300 and HP9000/400 to genirq
>>> á- [22/28] m68k/vme: Convert VME to genirq
>>> á- [23/28] m68k/apollo: Convert Apollo to genirq
>>> á- [24/28] m68k/sun3: Use the kstat_irqs_cpu() wrapper
>>> á- [25/28] m68k/sun3: Convert Sun3/3x to genirq
>>> á- [26/28] m68k/q40: Convert Q40/Q60 to genirq
>>> á- [27/28] m68k/irq: Remove obsolete m68k irq framework
>>> á- [28/28] m68k/irq: Remove obsolete support for user vector interrupt fixups
>>>
>>> Overview:
>>> á- [01] is a fix for the core genirq code,
>>
>> This went into v3.1-rc6.
>>
>>> á- [02-03] are fixes to avoid compile problems later in the conversion
>>> á áprocess,
>>
>> The keyboard path went into the tty -next tree.
>> The IDE one is still pending (I've just resent it).
>
> The IDE one got acked in the mean time.
>
>>> I will update my m68k-genirq branch as soon as master.kernel.org is available
>>> again.
>>
>> Updated, on top of m68k master (which is at v3.1-rc10 now).
>> http://git.kernel.org/?p=linux/kernel/git/geert/linux-m68k.git;a=shortlog;h=refs/heads/m68k-genirq
>>
>> If noone objects, I'd like to add this to the m68k master and for-3.2 branches.
>
> I added it to m68k master.
>
> As there were several merge conflicts with current -next
> (arch/m68k/kernel/Makefile_mm
> due to the mmu/nommu merge, and drivers/net/macsonic.c in [12/28] due
> to the network
> driver reshuffling dance), I did not add it to for-3.2 and for-next,
> but to for-3.3.
>
> Depending on Stephen's return during or after the merge window, and
> the merge timing
> of the m68knommu and netdev trees, I may stil try to sneak it in 3.2, though.
I can ask Linus to pull the m68knommu tree early in the merge window,
if that will help.
Regards
Greg
------------------------------------------------------------------------
Greg Ungerer -- Principal Engineer EMAIL: gerg@snapgear.com
SnapGear Group, McAfee PHONE: +61 7 3435 2888
8 Gardner Close, FAX: +61 7 3891 3630
Milton, QLD, 4064, Australia WEB: http://www.SnapGear.com
^ permalink raw reply
* devel/acpi-cpufreq.v3: arch/x86/built-in.o:(.data+0x5f88): undefined reference to `x86_acpi_suspend_lowlevel'
From: Sander Eikelenboom @ 2011-10-23 11:29 UTC (permalink / raw)
To: Konrad Rzeszutek Wilk; +Cc: xen-devel@lists.xensource.com
Hi Konrad,
I tried to compile a kernel based on your latest "linux-next" tree (which seems to work fine),
and the "devel/acpi-cpufreq.v3" branch pulled in. This fails with a compile error:
CC drivers/usb/storage/sierra_ms.o
CC drivers/xen/pci.o
CC drivers/video/efifb.o
CC drivers/usb/storage/option_ms.o
CC drivers/video/output.o
CC drivers/xen/acpi.o
CC drivers/xen/acpi_processor.o
LD drivers/xen/xen-evtchn.o
LD drivers/xen/xen-gntdev.o
LD drivers/xen/xen-gntalloc.o
LD drivers/video/fb.o
LD drivers/usb/storage/usb-storage.o
LD drivers/usb/storage/usb-libusual.o
LD drivers/video/built-in.o
LD drivers/usb/storage/built-in.o
LD drivers/usb/built-in.o
LD drivers/xen/built-in.o
LD drivers/built-in.o
LD vmlinux.o
MODPOST vmlinux.o
GEN .version
CHK include/generated/compile.h
UPD include/generated/compile.h
CC init/version.o
LD init/built-in.o
LD .tmp_vmlinux1
arch/x86/built-in.o:(.data+0x5f88): undefined reference to `x86_acpi_suspend_lowlevel'
make: *** [.tmp_vmlinux1] Error 1
--
Sander
^ permalink raw reply
* Re: [V2][PATCH 5/5] oprofile, x86: Reimplement nmi timer mode using perf event
From: Ingo Molnar @ 2011-10-23 11:27 UTC (permalink / raw)
To: Robert Richter, Peter Zijlstra; +Cc: LKML, oprofile-list, Peter Zijlstra
In-Reply-To: <1319050075-23901-6-git-send-email-robert.richter@amd.com>
* Robert Richter <robert.richter@amd.com> wrote:
> The legacy x86 nmi watchdog code was removed with the implementation
> of the perf based nmi watchdog. This broke Oprofile's nmi timer
> mode. To run nmi timer mode we relied on a continuous ticking nmi
> source which the nmi watchdog provided. The nmi tick was no longer
> available and current watchdog can not be used anymore since it runs
> with very long periods in the range of seconds. This patch
> reimplements the nmi timer mode using a perf counter nmi source.
>
> V2:
> * removing pr_info()
> * fix undefined reference to `__udivdi3' for 32 bit build
> * fix section mismatch of .cpuinit.data:nmi_timer_cpu_nb
> * removed nmi timer setup in arch/x86
> * implemented function stubs for op_nmi_init/exit()
> * made code more readable in oprofile_init()
>
> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
> Signed-off-by: Robert Richter <robert.richter@amd.com>
> ---
> arch/Kconfig | 4 +
> arch/x86/oprofile/Makefile | 3 +-
> arch/x86/oprofile/init.c | 30 ++-----
> arch/x86/oprofile/nmi_timer_int.c | 66 --------------
> drivers/oprofile/nmi_timer_int.c | 173 +++++++++++++++++++++++++++++++++++++
> drivers/oprofile/oprof.c | 24 +++---
> drivers/oprofile/oprof.h | 9 ++
> kernel/events/core.c | 2 +
> 8 files changed, 208 insertions(+), 103 deletions(-)
> delete mode 100644 arch/x86/oprofile/nmi_timer_int.c
> create mode 100644 drivers/oprofile/nmi_timer_int.c
Looks clean to me. Peter, any objections?
Thanks,
Ingo
^ permalink raw reply
* Re: [Qemu-devel] [PATCH 3/4] loader: Add rom_add_file_buf for adding roms from a buffer
From: Blue Swirl @ 2011-10-23 11:27 UTC (permalink / raw)
To: Jordan Justen; +Cc: Jordan Justen, qemu-devel
In-Reply-To: <CAFe8ug8y+GXvQYruVyur8ga1DcLyyKPMzd9mAxnuer4BmU2AFQ@mail.gmail.com>
On Tue, Oct 18, 2011 at 21:17, Jordan Justen <jljusten@gmail.com> wrote:
> On Tue, Oct 18, 2011 at 11:05, Blue Swirl <blauwirbel@gmail.com> wrote:
>> On Mon, Oct 17, 2011 at 7:16 PM, Jordan Justen
>> <jordan.l.justen@intel.com> wrote:
>>> rom_add_file_buf is similar to rom_add_file, except the rom's
>>> contents are provided in a buffer.
>>>
>>> rom_add_file is modified to call rom_add_file_buf after
>>> reading the rom's contents from the file.
>>>
>>> Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
>>> ---
>>> hw/loader.c | 71 +++++++++++++++++++++++++++++++++++++++-------------------
>>> hw/loader.h | 5 ++++
>>> 2 files changed, 53 insertions(+), 23 deletions(-)
>>>
>>> diff --git a/hw/loader.c b/hw/loader.c
>>> index 5676c18..d1a4a98 100644
>>> --- a/hw/loader.c
>>> +++ b/hw/loader.c
>>> @@ -557,11 +557,11 @@ static void rom_insert(Rom *rom)
>>> QTAILQ_INSERT_TAIL(&roms, rom, next);
>>> }
>>>
>>> -int rom_add_file(const char *file, const char *fw_dir,
>>> - target_phys_addr_t addr, int32_t bootindex)
>>> +int rom_add_file_buf(const char *file, const void *data, size_t size,
>>> + const char *fw_dir,
>>> + target_phys_addr_t addr, int32_t bootindex)
>>> {
>>> Rom *rom;
>>> - int rc, fd = -1;
>>> char devpath[100];
>>>
>>> rom = g_malloc0(sizeof(*rom));
>>> @@ -571,28 +571,16 @@ int rom_add_file(const char *file, const char *fw_dir,
>>> rom->path = g_strdup(file);
>>> }
>>>
>>> - fd = open(rom->path, O_RDONLY | O_BINARY);
>>> - if (fd == -1) {
>>> - fprintf(stderr, "Could not open option rom '%s': %s\n",
>>> - rom->path, strerror(errno));
>>> - goto err;
>>> - }
>>> -
>>> if (fw_dir) {
>>> rom->fw_dir = g_strdup(fw_dir);
>>> rom->fw_file = g_strdup(file);
>>> }
>>> rom->addr = addr;
>>> - rom->romsize = lseek(fd, 0, SEEK_END);
>>> + rom->romsize = size;
>>> rom->data = g_malloc0(rom->romsize);
>>> - lseek(fd, 0, SEEK_SET);
>>> - rc = read(fd, rom->data, rom->romsize);
>>> - if (rc != rom->romsize) {
>>> - fprintf(stderr, "rom: file %-20s: read error: rc=%d (expected %zd)\n",
>>> - rom->name, rc, rom->romsize);
>>> - goto err;
>>> - }
>>> - close(fd);
>>> +
>>> + memcpy(rom->data, data, rom->romsize);
>>
>> This is not optimal, instead the data should be used directly. That
>> way also mmap()ed, deduplicated ROM files are possible.
>
> In my 4th patch I use a buffer from a memory region via
> memory_region_get_ram_ptr. Comments for memory_region_get_ram_ptr say
> 'Use with care'.
>
> So, would the best thing be for me to allocate a new buffer in my 4th
> patch, do the memcpy there, and then use the pointer directly here?
No, instead of memcpy just do
rom->data = data;
Then also the corresponding g_free(data) below should be removed.
The line g_free(rom->data) in the error path would be a problem for
the future mmap() case though. Should be solvable with with some
refactoring then, we'd need to be able to munmap() anyway.
> Thanks,
>
> -Jordan
>
>>
>>> +
>>> rom_insert(rom);
>>> if (rom->fw_file && fw_cfg) {
>>> const char *basename;
>>> @@ -614,14 +602,51 @@ int rom_add_file(const char *file, const char *fw_dir,
>>>
>>> add_boot_device_path(bootindex, NULL, devpath);
>>> return 0;
>>> +}
>>> +
>>> +int rom_add_file(const char *file, const char *fw_dir,
>>> + target_phys_addr_t addr, int32_t bootindex)
>>> +{
>>> + char *filename;
>>> + void *data = NULL;
>>> + size_t size;
>>> + int rc, fd = -1;
>>> +
>>> + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, file);
>>> + if (filename == NULL) {
>>> + filename = g_strdup(file);
>>> + }
>>> +
>>> + fd = open(filename, O_RDONLY | O_BINARY);
>>> + if (fd == -1) {
>>> + fprintf(stderr, "Could not open option rom '%s': %s\n",
>>> + filename, strerror(errno));
>>> + goto err;
>>> + }
>>> +
>>> + size = lseek(fd, 0, SEEK_END);
>>> + data = g_malloc0(size);
>>> + lseek(fd, 0, SEEK_SET);
>>> + rc = read(fd, data, size);
>>
>> It should be easy to replace this with mmap(), maybe later.
>>
>>> + if (rc != size) {
>>> + fprintf(stderr, "rom: file %-20s: read error: rc=%d (expected %zd)\n",
>>> + filename, rc, size);
>>> + goto err;
>>> + }
>>> + close(fd);
>>> +
>>> + rc = rom_add_file_buf(filename, data, size, fw_dir, addr, bootindex);
>>> + if (rc != 0) {
>>> + goto err;
>>> + }
>>> +
>>> + g_free(data);
>>> + return 0;
>>>
>>> err:
>>> if (fd != -1)
>>> close(fd);
>>> - g_free(rom->data);
>>> - g_free(rom->path);
>>> - g_free(rom->name);
>>> - g_free(rom);
>>> + g_free(data);
>>> return -1;
>>> }
>>>
>>> diff --git a/hw/loader.h b/hw/loader.h
>>> index fc6bdff..9efe64a 100644
>>> --- a/hw/loader.h
>>> +++ b/hw/loader.h
>>> @@ -21,6 +21,9 @@ void pstrcpy_targphys(const char *name,
>>> const char *source);
>>>
>>>
>>> +int rom_add_file_buf(const char *file, const void *data, size_t size,
>>> + const char *fw_dir,
>>> + target_phys_addr_t addr, int32_t bootindex);
>>> int rom_add_file(const char *file, const char *fw_dir,
>>> target_phys_addr_t addr, int32_t bootindex);
>>> int rom_add_blob(const char *name, const void *blob, size_t len,
>>> @@ -31,6 +34,8 @@ int rom_copy(uint8_t *dest, target_phys_addr_t addr, size_t size);
>>> void *rom_ptr(target_phys_addr_t addr);
>>> void do_info_roms(Monitor *mon);
>>>
>>> +#define rom_add_file_buf_fixed(_f, _d, _s, _a, _i) \
>>> + rom_add_file_buf(_f, _d, _s, NULL, _a, _i)
>>> #define rom_add_file_fixed(_f, _a, _i) \
>>> rom_add_file(_f, NULL, _a, _i)
>>> #define rom_add_blob_fixed(_f, _b, _l, _a) \
>>> --
>>> 1.7.1
>>>
>>>
>>>
>>
>>
>
^ permalink raw reply
* kernel.org tarball/patch signature files
From: Jari Ruusu @ 2011-10-23 11:17 UTC (permalink / raw)
To: Greg Kroah-Hartman; +Cc: linux-kernel
I noticed that patch-3.0.7.sign is a detached signature file for
DECOMPRESSED patch-3.0.7.{bz2,gz,xz}. Maybe this is not the best possible
way to sign compressed tarballs/patches. This is because it places hell of
lot of trust on quality/security of decompressor implementation.
Historically decompressor implementations have had bugs and security flaws.
It is stupid to assume that there won't be any more of them.
Wrong order to verify compressed tarball/patch:
(1) Feed potentially maliciously formatted data to decompressor, and exploit
any undiscovered/unpatched vulnerability in decompressor implementation.
(2) Verify decompressed output.
Much better order would be:
(1) Verify compressed data.
(2) Feed trusted data to decompressor.
So, would it be possible to have multiple signature files like this? Please.
patch-3.X.Y.bz2
patch-3.X.Y.bz2.sign
patch-3.X.Y.gz
patch-3.X.Y.gz.sign
patch-3.X.Y.xz
patch-3.X.Y.xz.sign
--
Jari Ruusu 1024R/3A220F51 5B 4B F9 BB D3 3F 52 E9 DB 1D EB E3 24 0E A9 DD
^ permalink raw reply
* Re: copy_*_user
From: Xin Tong @ 2011-10-23 11:25 UTC (permalink / raw)
To: H. Peter Anvin; +Cc: Américo Wang, linux-kernel
In-Reply-To: <4EA3E926.80203@zytor.com>
I do not remember, probably I was under the impression that kernel
accesses physical memory directly from my os course in college. So ,
the kernel access memory using the page table of the current process
here?
Thanks
Xin
On Sun, Oct 23, 2011 at 6:15 AM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 10/23/2011 11:23 AM, Xin Tong wrote:
>> I found that __copy_from_user_ll(void *to, const void __user *from,
>> unsigned long n) eventually calls some asm which use mov and rep on
>> the passed-in to & from pointers. This is in kernel mode and to & from
>> are virtual addresses ? are not the kernel accessing physical RAM
>> directly ( without pagetable ) ?
>
> No. What gave you that idea?
>
> -hpa
>
>
^ permalink raw reply
* [RFC/PATCH] kvm tools, bios: Don't include glibc headers
From: Pekka Enberg @ 2011-10-23 11:24 UTC (permalink / raw)
To: kvm; +Cc: Pekka Enberg, Asias He, Cyrill Gorcunov, Ingo Molnar, Sasha Levin
From: Pekka Enberg <penberg@kernel.org>
We should not include glibc headers from BIOS code which can't rely on glibc at
runtime.
This patch fixes the following build breakage on 64-bit:
CC bios/e820.o
In file included from /usr/include/features.h:387:0,
from /usr/include/unistd.h:26,
from include/kvm/util.h:12,
from bios/e820.c:5:
/usr/include/gnu/stubs.h:7:27: fatal error: gnu/stubs-32.h: No such file or directory compilation terminated.
make: *** [bios/bios.bin.elf] Error 1
when built without the 'glibc-devel.i686' package on Fedora, for example.
Cc: Asias He <asias.hejun@gmail.com>
Cc: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
---
tools/kvm/README | 2 +-
tools/kvm/bios/e820.c | 1 -
tools/kvm/bios/int10.c | 3 ---
3 files changed, 1 insertions(+), 5 deletions(-)
diff --git a/tools/kvm/README b/tools/kvm/README
index 7cbf530..c262995 100644
--- a/tools/kvm/README
+++ b/tools/kvm/README
@@ -102,7 +102,7 @@ For rpm based systems:
32-bit:
yum install glibc-devel
64-bit:
-yum install glibc-devel glibc-devel.i686 glibc-static
+yum install glibc-devel glibc-static
On 64-bit Arch Linux make sure the multilib repository is enabled in your
/etc/pacman.conf and run
diff --git a/tools/kvm/bios/e820.c b/tools/kvm/bios/e820.c
index 1eafb5b..a9bca29 100644
--- a/tools/kvm/bios/e820.c
+++ b/tools/kvm/bios/e820.c
@@ -2,7 +2,6 @@
#include "kvm/segment.h"
#include "kvm/bios.h"
-#include "kvm/util.h"
#include <asm/processor-flags.h>
#include <asm/e820.h>
diff --git a/tools/kvm/bios/int10.c b/tools/kvm/bios/int10.c
index 6387ca8..32f7c92 100644
--- a/tools/kvm/bios/int10.c
+++ b/tools/kvm/bios/int10.c
@@ -1,12 +1,9 @@
#include "kvm/segment.h"
#include "kvm/bios.h"
-#include "kvm/util.h"
#include "kvm/vesa.h"
#include "bios/memcpy.h"
-#include <stdint.h>
-
#define VESA_MAGIC ('V' + ('E' << 8) + ('S' << 16) + ('A' << 24))
/* VESA General Information table */
--
1.7.6.4
^ permalink raw reply related
* Re: [PATCH] kvm tools: Simplify msi message handling
From: Pekka Enberg @ 2011-10-23 11:23 UTC (permalink / raw)
To: Sasha Levin; +Cc: kvm, mingo, asias.hejun, gorcunov
In-Reply-To: <1319196910-1184-1-git-send-email-levinsasha928@gmail.com>
On Fri, 21 Oct 2011, Sasha Levin wrote:
> This patch simplifies passing around msi messages by using
> 'struct kvm_irq_routing_msi' for storing of msi messages instead
> of passing all msi parameters around.
>
> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
This breaks something. After I apply this patch, the guest doesn't seem to
enter userspace.
Pekka
^ permalink raw reply
* Re: [PATCH 1/3] drm/i915: Ivybridge still has fences!
From: Chris Wilson @ 2011-10-23 11:23 UTC (permalink / raw)
To: intel-gfx; +Cc: Daniel Vetter, stable
In-Reply-To: <1318189923-4609-1-git-send-email-daniel.vetter@ffwll.ch>
Regardless of the outcome of Jesse's request for an if-ladder, the
substance of the patches look sound.
However, I remain unconvinced that there are 32 fence registers on IVB.
Daniel's evidence is based upon the size of the register map (and not
on the BSPEC explicitly stating a change to 32 ;-), but most tellingly
the bitfields for fence-number in other registers have not been updated -
so we can only safely allocated the first 16 anyway...
(For instance, FBC_CTL).
-Chris
--
Chris Wilson, Intel Open Source Technology Centre
^ permalink raw reply
* Re: [PATCH] CIFS: fix automount for DFS shares
From: Ian Kent @ 2011-10-23 11:14 UTC (permalink / raw)
To: Gerlando Falauto; +Cc: linux-kernel, David Howells, Jeffrey Layton
In-Reply-To: <1317985771-28876-2-git-send-email-gerlando.falauto@keymile.com>
On Fri, 2011-10-07 at 13:09 +0200, Gerlando Falauto wrote:
> Automounting directories are now invalidated by .d_revalidate()
> so to be d_instantiate()d again with the right DCACHE_NEED_AUTOMOUNT
> flag
But why doesn't CIFS know this is a DFS inode the first time around, it
appears to do a truck load of work looking that stuff up?
>
> Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
> ---
> fs/cifs/dir.c | 7 ++++++-
> 1 files changed, 6 insertions(+), 1 deletions(-)
>
> diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
> index 9ea65cf..67f54d3 100644
> --- a/fs/cifs/dir.c
> +++ b/fs/cifs/dir.c
> @@ -637,8 +637,13 @@ cifs_d_revalidate(struct dentry *direntry, struct nameidata *nd)
> if (direntry->d_inode) {
> if (cifs_revalidate_dentry(direntry))
> return 0;
> - else
> + else {
> + /* We want automonting inodes to be
> + * considered invalid or so */
> + if (IS_AUTOMOUNT(direntry->d_inode))
> + return 0;
I'd be inclined to set DCACHE_NEED_AUTOMOUNT here but are we certain
that cifs_revalidate_dentry() will always return 0 for a DFS inode or at
least ones that don't yet have DCACHE_NEED_AUTOMOUNT set and why?
> return 1;
> + }
> }
>
> /*
^ permalink raw reply
* [RFC/PATCH] sequencer: factor code out of revert builtin
From: Ramkumar Ramachandra @ 2011-10-23 11:09 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano, Jonathan Nieder, Christian Couder
In-Reply-To: <1319310826-508-1-git-send-email-artagnon@gmail.com>
Start building the generalized sequencer by moving code from revert.c
into sequencer.c and sequencer.h. Make the builtin responsible only
for command-line parsing, and expose a new sequencer_pick_revisions()
to do the actual work of sequencing commits.
This is intended to be almost a pure code movement patch with no
functional changes. Check with:
$ git blame -s -CCC HEAD^..HEAD -- sequencer.c | grep -C3 '^[^^]'
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
Assuming that this iteration of the mini-series is alright, I quickly
wanted to demonstrate the big "code movement" patch that I'll begin
the next series with. Does it look alright sans a few glitches like
the replication of action_name()?
builtin/revert.c | 821 +-----------------------------------------------------
sequencer.c | 802 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
sequencer.h | 26 ++
3 files changed, 828 insertions(+), 821 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index df9459b..c272920 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -1,19 +1,9 @@
#include "cache.h"
#include "builtin.h"
-#include "object.h"
-#include "commit.h"
-#include "tag.h"
-#include "run-command.h"
-#include "exec_cmd.h"
-#include "utf8.h"
#include "parse-options.h"
-#include "cache-tree.h"
#include "diff.h"
#include "revision.h"
#include "rerere.h"
-#include "merge-recursive.h"
-#include "refs.h"
-#include "dir.h"
#include "sequencer.h"
/*
@@ -39,40 +29,11 @@ static const char * const cherry_pick_usage[] = {
NULL
};
-enum replay_subcommand { REPLAY_NONE, REPLAY_RESET, REPLAY_CONTINUE };
-
-struct replay_opts {
- enum replay_action action;
- enum replay_subcommand subcommand;
-
- /* Boolean options */
- int edit;
- int record_origin;
- int no_commit;
- int signoff;
- int allow_ff;
- int allow_rerere_auto;
-
- int mainline;
-
- /* Merge strategy */
- const char *strategy;
- const char **xopts;
- size_t xopts_nr, xopts_alloc;
-
- /* Only used by REPLAY_NONE */
- struct rev_info *revs;
-};
-
-#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
-
static const char *action_name(const struct replay_opts *opts)
{
return opts->action == REPLAY_REVERT ? "revert" : "cherry-pick";
}
-static char *get_encoding(const char *message);
-
static const char * const *revert_or_cherry_pick_usage(struct replay_opts *opts)
{
return opts->action == REPLAY_REVERT ? revert_usage : cherry_pick_usage;
@@ -222,784 +183,6 @@ static void parse_args(int argc, const char **argv, struct replay_opts *opts)
usage_with_options(usage_str, options);
}
-struct commit_message {
- char *parent_label;
- const char *label;
- const char *subject;
- char *reencoded_message;
- const char *message;
-};
-
-static int get_message(struct commit *commit, struct commit_message *out)
-{
- const char *encoding;
- const char *abbrev, *subject;
- int abbrev_len, subject_len;
- char *q;
-
- if (!commit->buffer)
- return -1;
- encoding = get_encoding(commit->buffer);
- if (!encoding)
- encoding = "UTF-8";
- if (!git_commit_encoding)
- git_commit_encoding = "UTF-8";
-
- out->reencoded_message = NULL;
- out->message = commit->buffer;
- if (strcmp(encoding, git_commit_encoding))
- out->reencoded_message = reencode_string(commit->buffer,
- git_commit_encoding, encoding);
- if (out->reencoded_message)
- out->message = out->reencoded_message;
-
- abbrev = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);
- abbrev_len = strlen(abbrev);
-
- subject_len = find_commit_subject(out->message, &subject);
-
- out->parent_label = xmalloc(strlen("parent of ") + abbrev_len +
- strlen("... ") + subject_len + 1);
- q = out->parent_label;
- q = mempcpy(q, "parent of ", strlen("parent of "));
- out->label = q;
- q = mempcpy(q, abbrev, abbrev_len);
- q = mempcpy(q, "... ", strlen("... "));
- out->subject = q;
- q = mempcpy(q, subject, subject_len);
- *q = '\0';
- return 0;
-}
-
-static void free_message(struct commit_message *msg)
-{
- free(msg->parent_label);
- free(msg->reencoded_message);
-}
-
-static char *get_encoding(const char *message)
-{
- const char *p = message, *eol;
-
- while (*p && *p != '\n') {
- for (eol = p + 1; *eol && *eol != '\n'; eol++)
- ; /* do nothing */
- if (!prefixcmp(p, "encoding ")) {
- char *result = xmalloc(eol - 8 - p);
- strlcpy(result, p + 9, eol - 8 - p);
- return result;
- }
- p = eol;
- if (*p == '\n')
- p++;
- }
- return NULL;
-}
-
-static void write_cherry_pick_head(struct commit *commit)
-{
- int fd;
- struct strbuf buf = STRBUF_INIT;
-
- strbuf_addf(&buf, "%s\n", sha1_to_hex(commit->object.sha1));
-
- fd = open(git_path("CHERRY_PICK_HEAD"), O_WRONLY | O_CREAT, 0666);
- if (fd < 0)
- die_errno(_("Could not open '%s' for writing"),
- git_path("CHERRY_PICK_HEAD"));
- if (write_in_full(fd, buf.buf, buf.len) != buf.len || close(fd))
- die_errno(_("Could not write to '%s'"), git_path("CHERRY_PICK_HEAD"));
- strbuf_release(&buf);
-}
-
-static void print_advice(int show_hint)
-{
- char *msg = getenv("GIT_CHERRY_PICK_HELP");
-
- if (msg) {
- fprintf(stderr, "%s\n", msg);
- /*
- * A conflict has occured but the porcelain
- * (typically rebase --interactive) wants to take care
- * of the commit itself so remove CHERRY_PICK_HEAD
- */
- unlink(git_path("CHERRY_PICK_HEAD"));
- return;
- }
-
- if (show_hint) {
- advise("after resolving the conflicts, mark the corrected paths");
- advise("with 'git add <paths>' or 'git rm <paths>'");
- advise("and commit the result with 'git commit'");
- }
-}
-
-static void write_message(struct strbuf *msgbuf, const char *filename)
-{
- static struct lock_file msg_file;
-
- int msg_fd = hold_lock_file_for_update(&msg_file, filename,
- LOCK_DIE_ON_ERROR);
- if (write_in_full(msg_fd, msgbuf->buf, msgbuf->len) < 0)
- die_errno(_("Could not write to %s."), filename);
- strbuf_release(msgbuf);
- if (commit_lock_file(&msg_file) < 0)
- die(_("Error wrapping up %s"), filename);
-}
-
-static struct tree *empty_tree(void)
-{
- return lookup_tree((const unsigned char *)EMPTY_TREE_SHA1_BIN);
-}
-
-static int error_dirty_index(struct replay_opts *opts)
-{
- if (read_cache_unmerged())
- return error_resolve_conflict(action_name(opts));
-
- /* Different translation strings for cherry-pick and revert */
- if (opts->action == REPLAY_PICK)
- error(_("Your local changes would be overwritten by cherry-pick."));
- else
- error(_("Your local changes would be overwritten by revert."));
-
- if (advice_commit_before_merge)
- advise(_("Commit your changes or stash them to proceed."));
- return -1;
-}
-
-static int fast_forward_to(const unsigned char *to, const unsigned char *from)
-{
- struct ref_lock *ref_lock;
-
- read_cache();
- if (checkout_fast_forward(from, to))
- exit(1); /* the callee should have complained already */
- ref_lock = lock_any_ref_for_update("HEAD", from, 0);
- return write_ref_sha1(ref_lock, to, "cherry-pick");
-}
-
-static int do_recursive_merge(struct commit *base, struct commit *next,
- const char *base_label, const char *next_label,
- unsigned char *head, struct strbuf *msgbuf,
- struct replay_opts *opts)
-{
- struct merge_options o;
- struct tree *result, *next_tree, *base_tree, *head_tree;
- int clean, index_fd;
- const char **xopt;
- static struct lock_file index_lock;
-
- index_fd = hold_locked_index(&index_lock, 1);
-
- read_cache();
-
- init_merge_options(&o);
- o.ancestor = base ? base_label : "(empty tree)";
- o.branch1 = "HEAD";
- o.branch2 = next ? next_label : "(empty tree)";
-
- head_tree = parse_tree_indirect(head);
- next_tree = next ? next->tree : empty_tree();
- base_tree = base ? base->tree : empty_tree();
-
- for (xopt = opts->xopts; xopt != opts->xopts + opts->xopts_nr; xopt++)
- parse_merge_opt(&o, *xopt);
-
- clean = merge_trees(&o,
- head_tree,
- next_tree, base_tree, &result);
-
- if (active_cache_changed &&
- (write_cache(index_fd, active_cache, active_nr) ||
- commit_locked_index(&index_lock)))
- /* TRANSLATORS: %s will be "revert" or "cherry-pick" */
- die(_("%s: Unable to write new index file"), action_name(opts));
- rollback_lock_file(&index_lock);
-
- if (!clean) {
- int i;
- strbuf_addstr(msgbuf, "\nConflicts:\n\n");
- for (i = 0; i < active_nr;) {
- struct cache_entry *ce = active_cache[i++];
- if (ce_stage(ce)) {
- strbuf_addch(msgbuf, '\t');
- strbuf_addstr(msgbuf, ce->name);
- strbuf_addch(msgbuf, '\n');
- while (i < active_nr && !strcmp(ce->name,
- active_cache[i]->name))
- i++;
- }
- }
- }
-
- return !clean;
-}
-
-/*
- * If we are cherry-pick, and if the merge did not result in
- * hand-editing, we will hit this commit and inherit the original
- * author date and name.
- * If we are revert, or if our cherry-pick results in a hand merge,
- * we had better say that the current user is responsible for that.
- */
-static int run_git_commit(const char *defmsg, struct replay_opts *opts)
-{
- /* 6 is max possible length of our args array including NULL */
- const char *args[6];
- int i = 0;
-
- args[i++] = "commit";
- args[i++] = "-n";
- if (opts->signoff)
- args[i++] = "-s";
- if (!opts->edit) {
- args[i++] = "-F";
- args[i++] = defmsg;
- }
- args[i] = NULL;
-
- return run_command_v_opt(args, RUN_GIT_CMD);
-}
-
-static int do_pick_commit(struct commit *commit, enum replay_action action,
- struct replay_opts *opts)
-{
- unsigned char head[20];
- struct commit *base, *next, *parent;
- const char *base_label, *next_label;
- struct commit_message msg = { NULL, NULL, NULL, NULL, NULL };
- char *defmsg = NULL;
- struct strbuf msgbuf = STRBUF_INIT;
- int res;
-
- if (opts->no_commit) {
- /*
- * We do not intend to commit immediately. We just want to
- * merge the differences in, so let's compute the tree
- * that represents the "current" state for merge-recursive
- * to work on.
- */
- if (write_cache_as_tree(head, 0, NULL))
- die (_("Your index file is unmerged."));
- } else {
- if (get_sha1("HEAD", head))
- return error(_("You do not have a valid HEAD"));
- if (index_differs_from("HEAD", 0))
- return error_dirty_index(opts);
- }
- discard_cache();
-
- if (!commit->parents) {
- parent = NULL;
- }
- else if (commit->parents->next) {
- /* Reverting or cherry-picking a merge commit */
- int cnt;
- struct commit_list *p;
-
- if (!opts->mainline)
- return error(_("Commit %s is a merge but no -m option was given."),
- sha1_to_hex(commit->object.sha1));
-
- for (cnt = 1, p = commit->parents;
- cnt != opts->mainline && p;
- cnt++)
- p = p->next;
- if (cnt != opts->mainline || !p)
- return error(_("Commit %s does not have parent %d"),
- sha1_to_hex(commit->object.sha1), opts->mainline);
- parent = p->item;
- } else if (0 < opts->mainline)
- return error(_("Mainline was specified but commit %s is not a merge."),
- sha1_to_hex(commit->object.sha1));
- else
- parent = commit->parents->item;
-
- if (opts->allow_ff && parent && !hashcmp(parent->object.sha1, head))
- return fast_forward_to(commit->object.sha1, head);
-
- if (parent && parse_commit(parent) < 0)
- /* TRANSLATORS: The first %s will be "revert" or
- "cherry-pick", the second %s a SHA1 */
- return error(_("%s: cannot parse parent commit %s"),
- action_name(opts), sha1_to_hex(parent->object.sha1));
-
- if (get_message(commit, &msg) != 0)
- return error(_("Cannot get commit message for %s"),
- sha1_to_hex(commit->object.sha1));
-
- /*
- * "commit" is an existing commit. We would want to apply
- * the difference it introduces since its first parent "prev"
- * on top of the current HEAD if we are cherry-pick. Or the
- * reverse of it if we are revert.
- */
-
- defmsg = git_pathdup("MERGE_MSG");
-
- if (action == REPLAY_REVERT) {
- base = commit;
- base_label = msg.label;
- next = parent;
- next_label = msg.parent_label;
- strbuf_addstr(&msgbuf, "Revert \"");
- strbuf_addstr(&msgbuf, msg.subject);
- strbuf_addstr(&msgbuf, "\"\n\nThis reverts commit ");
- strbuf_addstr(&msgbuf, sha1_to_hex(commit->object.sha1));
-
- if (commit->parents && commit->parents->next) {
- strbuf_addstr(&msgbuf, ", reversing\nchanges made to ");
- strbuf_addstr(&msgbuf, sha1_to_hex(parent->object.sha1));
- }
- strbuf_addstr(&msgbuf, ".\n");
- } else {
- const char *p;
-
- base = parent;
- base_label = msg.parent_label;
- next = commit;
- next_label = msg.label;
-
- /*
- * Append the commit log message to msgbuf; it starts
- * after the tree, parent, author, committer
- * information followed by "\n\n".
- */
- p = strstr(msg.message, "\n\n");
- if (p) {
- p += 2;
- strbuf_addstr(&msgbuf, p);
- }
-
- if (opts->record_origin) {
- strbuf_addstr(&msgbuf, "(cherry picked from commit ");
- strbuf_addstr(&msgbuf, sha1_to_hex(commit->object.sha1));
- strbuf_addstr(&msgbuf, ")\n");
- }
- }
-
- if (!opts->strategy || !strcmp(opts->strategy, "recursive") || action == REPLAY_REVERT) {
- res = do_recursive_merge(base, next, base_label, next_label,
- head, &msgbuf, opts);
- write_message(&msgbuf, defmsg);
- } else {
- struct commit_list *common = NULL;
- struct commit_list *remotes = NULL;
-
- write_message(&msgbuf, defmsg);
-
- commit_list_insert(base, &common);
- commit_list_insert(next, &remotes);
- res = try_merge_command(opts->strategy, opts->xopts_nr, opts->xopts,
- common, sha1_to_hex(head), remotes);
- free_commit_list(common);
- free_commit_list(remotes);
- }
-
- /*
- * If the merge was clean or if it failed due to conflict, we write
- * CHERRY_PICK_HEAD for the subsequent invocation of commit to use.
- * However, if the merge did not even start, then we don't want to
- * write it at all.
- */
- if (opts->action == REPLAY_PICK && !opts->no_commit && (res == 0 || res == 1))
- write_cherry_pick_head(commit);
-
- if (res) {
- error(action == REPLAY_REVERT
- ? _("could not revert %s... %s")
- : _("could not apply %s... %s"),
- find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),
- msg.subject);
- print_advice(res == 1);
- rerere(opts->allow_rerere_auto);
- } else {
- if (!opts->no_commit)
- res = run_git_commit(defmsg, opts);
- }
-
- free_message(&msg);
- free(defmsg);
-
- return res;
-}
-
-static void prepare_revs(struct replay_opts *opts)
-{
- if (opts->action != REPLAY_REVERT)
- opts->revs->reverse ^= 1;
-
- if (prepare_revision_walk(opts->revs))
- die(_("revision walk setup failed"));
-
- if (!opts->revs->commits)
- die(_("empty commit set passed"));
-}
-
-static void read_and_refresh_cache(struct replay_opts *opts)
-{
- static struct lock_file index_lock;
- int index_fd = hold_locked_index(&index_lock, 0);
- if (read_index_preload(&the_index, NULL) < 0)
- die(_("git %s: failed to read the index"), action_name(opts));
- refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
- if (the_index.cache_changed) {
- if (write_index(&the_index, index_fd) ||
- commit_locked_index(&index_lock))
- die(_("git %s: failed to refresh the index"), action_name(opts));
- }
- rollback_lock_file(&index_lock);
-}
-
-/*
- * Append a commit to the end of the commit_list.
- *
- * next starts by pointing to the variable that holds the head of an
- * empty commit_list, and is updated to point to the "next" field of
- * the last item on the list as new commits are appended.
- *
- * Usage example:
- *
- * struct commit_list *list;
- * struct commit_list **next = &list;
- *
- * next = commit_list_append(c1, next);
- * next = commit_list_append(c2, next);
- * assert(commit_list_count(list) == 2);
- * return list;
- */
-static struct replay_insn_list **replay_insn_list_append(enum replay_action action,
- struct commit *operand,
- struct replay_insn_list **next)
-{
- struct replay_insn_list *new = xmalloc(sizeof(*new));
- new->action = action;
- new->operand = operand;
- *next = new;
- new->next = NULL;
- return &new->next;
-}
-
-static int format_todo(struct strbuf *buf, struct replay_insn_list *todo_list)
-{
- struct replay_insn_list *cur;
-
- for (cur = todo_list; cur; cur = cur->next) {
- const char *sha1_abbrev, *action_str, *subject;
- int subject_len;
-
- action_str = cur->action == REPLAY_REVERT ? "revert" : "pick";
- sha1_abbrev = find_unique_abbrev(cur->operand->object.sha1, DEFAULT_ABBREV);
- subject_len = find_commit_subject(cur->operand->buffer, &subject);
- strbuf_addf(buf, "%s %s %.*s\n", action_str, sha1_abbrev,
- subject_len, subject);
- }
- return 0;
-}
-
-static int parse_insn_line(char *bol, char *eol, struct replay_insn_list *item)
-{
- unsigned char commit_sha1[20];
- char *end_of_object_name;
- int saved, status;
-
- if (!prefixcmp(bol, "pick ")) {
- item->action = REPLAY_PICK;
- bol += strlen("pick ");
- } else if (!prefixcmp(bol, "revert ")) {
- item->action = REPLAY_REVERT;
- bol += strlen("revert ");
- } else {
- size_t len = strchrnul(bol, '\n') - bol;
- if (len > 255)
- len = 255;
- return error(_("Unrecognized action: %.*s"), (int)len, bol);
- }
-
- end_of_object_name = bol + strcspn(bol, " \n");
- saved = *end_of_object_name;
- *end_of_object_name = '\0';
- status = get_sha1(bol, commit_sha1);
- *end_of_object_name = saved;
-
- if (status < 0)
- return error(_("Malformed object name: %s"), bol);
-
- item->operand = lookup_commit_reference(commit_sha1);
- if (!item->operand)
- return error(_("Not a valid commit: %s"), bol);
-
- item->next = NULL;
- return 0;
-}
-
-static int parse_insn_buffer(char *buf, struct replay_insn_list **todo_list)
-{
- struct replay_insn_list **next = todo_list;
- struct replay_insn_list item = {0, NULL, NULL};
- char *p = buf;
- int i;
-
- for (i = 1; *p; i++) {
- char *eol = strchrnul(p, '\n');
- if (parse_insn_line(p, eol, &item) < 0)
- return error(_("on line %d."), i);
- next = replay_insn_list_append(item.action, item.operand, next);
- p = *eol ? eol + 1 : eol;
- }
- if (!*todo_list)
- return error(_("No commits parsed."));
- return 0;
-}
-
-static void read_populate_todo(struct replay_insn_list **todo_list)
-{
- const char *todo_file = git_path(SEQ_TODO_FILE);
- struct strbuf buf = STRBUF_INIT;
- int fd, res;
-
- fd = open(todo_file, O_RDONLY);
- if (fd < 0)
- die_errno(_("Could not open %s."), todo_file);
- if (strbuf_read(&buf, fd, 0) < 0) {
- close(fd);
- strbuf_release(&buf);
- die(_("Could not read %s."), todo_file);
- }
- close(fd);
-
- res = parse_insn_buffer(buf.buf, todo_list);
- strbuf_release(&buf);
- if (res)
- die(_("Unusable instruction sheet: %s"), todo_file);
-}
-
-static int populate_opts_cb(const char *key, const char *value, void *data)
-{
- struct replay_opts *opts = data;
- int error_flag = 1;
-
- if (!value)
- error_flag = 0;
- else if (!strcmp(key, "options.no-commit"))
- opts->no_commit = git_config_bool_or_int(key, value, &error_flag);
- else if (!strcmp(key, "options.edit"))
- opts->edit = git_config_bool_or_int(key, value, &error_flag);
- else if (!strcmp(key, "options.signoff"))
- opts->signoff = git_config_bool_or_int(key, value, &error_flag);
- else if (!strcmp(key, "options.record-origin"))
- opts->record_origin = git_config_bool_or_int(key, value, &error_flag);
- else if (!strcmp(key, "options.allow-ff"))
- opts->allow_ff = git_config_bool_or_int(key, value, &error_flag);
- else if (!strcmp(key, "options.mainline"))
- opts->mainline = git_config_int(key, value);
- else if (!strcmp(key, "options.strategy"))
- git_config_string(&opts->strategy, key, value);
- else if (!strcmp(key, "options.strategy-option")) {
- ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);
- opts->xopts[opts->xopts_nr++] = xstrdup(value);
- } else
- return error(_("Invalid key: %s"), key);
-
- if (!error_flag)
- return error(_("Invalid value for %s: %s"), key, value);
-
- return 0;
-}
-
-static void read_populate_opts(struct replay_opts **opts_ptr)
-{
- const char *opts_file = git_path(SEQ_OPTS_FILE);
-
- if (!file_exists(opts_file))
- return;
- if (git_config_from_file(populate_opts_cb, opts_file, *opts_ptr) < 0)
- die(_("Malformed options sheet: %s"), opts_file);
-}
-
-static void walk_revs_populate_todo(struct replay_insn_list **todo_list,
- struct replay_opts *opts)
-{
- struct commit *commit;
- struct replay_insn_list **next;
-
- prepare_revs(opts);
-
- next = todo_list;
- while ((commit = get_revision(opts->revs)))
- next = replay_insn_list_append(opts->action, commit, next);
-}
-
-static int create_seq_dir(void)
-{
- const char *seq_dir = git_path(SEQ_DIR);
-
- if (file_exists(seq_dir))
- return error(_("%s already exists."), seq_dir);
- else if (mkdir(seq_dir, 0777) < 0)
- die_errno(_("Could not create sequencer directory '%s'."), seq_dir);
- return 0;
-}
-
-static void save_head(const char *head)
-{
- const char *head_file = git_path(SEQ_HEAD_FILE);
- static struct lock_file head_lock;
- struct strbuf buf = STRBUF_INIT;
- int fd;
-
- fd = hold_lock_file_for_update(&head_lock, head_file, LOCK_DIE_ON_ERROR);
- strbuf_addf(&buf, "%s\n", head);
- if (write_in_full(fd, buf.buf, buf.len) < 0)
- die_errno(_("Could not write to %s."), head_file);
- if (commit_lock_file(&head_lock) < 0)
- die(_("Error wrapping up %s."), head_file);
-}
-
-static void save_todo(struct replay_insn_list *todo_list)
-{
- const char *todo_file = git_path(SEQ_TODO_FILE);
- static struct lock_file todo_lock;
- struct strbuf buf = STRBUF_INIT;
- int fd;
-
- fd = hold_lock_file_for_update(&todo_lock, todo_file, LOCK_DIE_ON_ERROR);
- if (format_todo(&buf, todo_list) < 0)
- die(_("Could not format %s."), todo_file);
- if (write_in_full(fd, buf.buf, buf.len) < 0) {
- strbuf_release(&buf);
- die_errno(_("Could not write to %s."), todo_file);
- }
- if (commit_lock_file(&todo_lock) < 0) {
- strbuf_release(&buf);
- die(_("Error wrapping up %s."), todo_file);
- }
- strbuf_release(&buf);
-}
-
-static void save_opts(struct replay_opts *opts)
-{
- const char *opts_file = git_path(SEQ_OPTS_FILE);
-
- if (opts->no_commit)
- git_config_set_in_file(opts_file, "options.no-commit", "true");
- if (opts->edit)
- git_config_set_in_file(opts_file, "options.edit", "true");
- if (opts->signoff)
- git_config_set_in_file(opts_file, "options.signoff", "true");
- if (opts->record_origin)
- git_config_set_in_file(opts_file, "options.record-origin", "true");
- if (opts->allow_ff)
- git_config_set_in_file(opts_file, "options.allow-ff", "true");
- if (opts->mainline) {
- struct strbuf buf = STRBUF_INIT;
- strbuf_addf(&buf, "%d", opts->mainline);
- git_config_set_in_file(opts_file, "options.mainline", buf.buf);
- strbuf_release(&buf);
- }
- if (opts->strategy)
- git_config_set_in_file(opts_file, "options.strategy", opts->strategy);
- if (opts->xopts) {
- int i;
- for (i = 0; i < opts->xopts_nr; i++)
- git_config_set_multivar_in_file(opts_file,
- "options.strategy-option",
- opts->xopts[i], "^$", 0);
- }
-}
-
-static int pick_commits(struct replay_insn_list *todo_list,
- struct replay_opts *opts)
-{
- struct replay_insn_list *cur;
- int res;
-
- setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
- if (opts->allow_ff)
- assert(!(opts->signoff || opts->no_commit ||
- opts->record_origin || opts->edit));
- read_and_refresh_cache(opts);
-
- for (cur = todo_list; cur; cur = cur->next) {
- save_todo(cur);
- res = do_pick_commit(cur->operand, cur->action, opts);
- if (res) {
- if (!cur->next)
- /*
- * An error was encountered while
- * picking the last commit; the
- * sequencer state is useless now --
- * the user simply needs to resolve
- * the conflict and commit
- */
- remove_sequencer_state(0);
- return res;
- }
- }
-
- /*
- * Sequence of picks finished successfully; cleanup by
- * removing the .git/sequencer directory
- */
- remove_sequencer_state(1);
- return 0;
-}
-
-static int pick_revisions(struct replay_opts *opts)
-{
- struct replay_insn_list *todo_list = NULL;
- unsigned char sha1[20];
-
- if (opts->subcommand == REPLAY_NONE)
- assert(opts->revs);
-
- read_and_refresh_cache(opts);
-
- /*
- * Decide what to do depending on the arguments; a fresh
- * cherry-pick should be handled differently from an existing
- * one that is being continued
- */
- if (opts->subcommand == REPLAY_RESET) {
- remove_sequencer_state(1);
- return 0;
- } else if (opts->subcommand == REPLAY_CONTINUE) {
- if (!file_exists(git_path(SEQ_TODO_FILE)))
- goto error;
- read_populate_opts(&opts);
- read_populate_todo(&todo_list);
-
- /* Verify that the conflict has been resolved */
- if (!index_differs_from("HEAD", 0))
- todo_list = todo_list->next;
- } else {
- /*
- * Start a new cherry-pick/ revert sequence; but
- * first, make sure that an existing one isn't in
- * progress
- */
-
- walk_revs_populate_todo(&todo_list, opts);
- if (create_seq_dir() < 0) {
- error(_("A cherry-pick or revert is in progress."));
- advise(_("Use --continue to continue the operation"));
- advise(_("or --reset to forget about it"));
- return -1;
- }
- if (get_sha1("HEAD", sha1)) {
- if (opts->action == REPLAY_REVERT)
- return error(_("Can't revert as initial commit"));
- return error(_("Can't cherry-pick into empty head"));
- }
- save_head(sha1_to_hex(sha1));
- save_opts(opts);
- }
- return pick_commits(todo_list, opts);
-error:
- return error(_("No %s in progress"), action_name(opts));
-}
-
int cmd_revert(int argc, const char **argv, const char *prefix)
{
struct replay_opts opts;
@@ -1011,7 +194,7 @@ int cmd_revert(int argc, const char **argv, const char *prefix)
opts.action = REPLAY_REVERT;
git_config(git_default_config, NULL);
parse_args(argc, argv, &opts);
- res = pick_revisions(&opts);
+ res = sequencer_pick_revisions(&opts);
if (res < 0)
die(_("revert failed"));
return res;
@@ -1026,7 +209,7 @@ int cmd_cherry_pick(int argc, const char **argv, const char *prefix)
opts.action = REPLAY_PICK;
git_config(git_default_config, NULL);
parse_args(argc, argv, &opts);
- res = pick_revisions(&opts);
+ res = sequencer_pick_revisions(&opts);
if (res < 0)
die(_("cherry-pick failed"));
return res;
diff --git a/sequencer.c b/sequencer.c
index bc2c046..87f146b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1,7 +1,27 @@
#include "cache.h"
-#include "sequencer.h"
-#include "strbuf.h"
+#include "object.h"
+#include "commit.h"
+#include "tag.h"
+#include "run-command.h"
+#include "exec_cmd.h"
+#include "utf8.h"
+#include "cache-tree.h"
+#include "diff.h"
+#include "revision.h"
+#include "rerere.h"
+#include "merge-recursive.h"
+#include "refs.h"
#include "dir.h"
+#include "sequencer.h"
+
+#define GIT_REFLOG_ACTION "GIT_REFLOG_ACTION"
+
+static const char *action_name(const struct replay_opts *opts)
+{
+ return opts->action == REPLAY_REVERT ? "revert" : "cherry-pick";
+}
+
+static char *get_encoding(const char *message);
void remove_sequencer_state(int aggressive)
{
@@ -17,3 +37,781 @@ void remove_sequencer_state(int aggressive)
strbuf_release(&seq_dir);
strbuf_release(&seq_old_dir);
}
+
+struct commit_message {
+ char *parent_label;
+ const char *label;
+ const char *subject;
+ char *reencoded_message;
+ const char *message;
+};
+
+static int get_message(struct commit *commit, struct commit_message *out)
+{
+ const char *encoding;
+ const char *abbrev, *subject;
+ int abbrev_len, subject_len;
+ char *q;
+
+ if (!commit->buffer)
+ return -1;
+ encoding = get_encoding(commit->buffer);
+ if (!encoding)
+ encoding = "UTF-8";
+ if (!git_commit_encoding)
+ git_commit_encoding = "UTF-8";
+
+ out->reencoded_message = NULL;
+ out->message = commit->buffer;
+ if (strcmp(encoding, git_commit_encoding))
+ out->reencoded_message = reencode_string(commit->buffer,
+ git_commit_encoding, encoding);
+ if (out->reencoded_message)
+ out->message = out->reencoded_message;
+
+ abbrev = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);
+ abbrev_len = strlen(abbrev);
+
+ subject_len = find_commit_subject(out->message, &subject);
+
+ out->parent_label = xmalloc(strlen("parent of ") + abbrev_len +
+ strlen("... ") + subject_len + 1);
+ q = out->parent_label;
+ q = mempcpy(q, "parent of ", strlen("parent of "));
+ out->label = q;
+ q = mempcpy(q, abbrev, abbrev_len);
+ q = mempcpy(q, "... ", strlen("... "));
+ out->subject = q;
+ q = mempcpy(q, subject, subject_len);
+ *q = '\0';
+ return 0;
+}
+
+static void free_message(struct commit_message *msg)
+{
+ free(msg->parent_label);
+ free(msg->reencoded_message);
+}
+
+static char *get_encoding(const char *message)
+{
+ const char *p = message, *eol;
+
+ while (*p && *p != '\n') {
+ for (eol = p + 1; *eol && *eol != '\n'; eol++)
+ ; /* do nothing */
+ if (!prefixcmp(p, "encoding ")) {
+ char *result = xmalloc(eol - 8 - p);
+ strlcpy(result, p + 9, eol - 8 - p);
+ return result;
+ }
+ p = eol;
+ if (*p == '\n')
+ p++;
+ }
+ return NULL;
+}
+
+static void write_cherry_pick_head(struct commit *commit)
+{
+ int fd;
+ struct strbuf buf = STRBUF_INIT;
+
+ strbuf_addf(&buf, "%s\n", sha1_to_hex(commit->object.sha1));
+
+ fd = open(git_path("CHERRY_PICK_HEAD"), O_WRONLY | O_CREAT, 0666);
+ if (fd < 0)
+ die_errno(_("Could not open '%s' for writing"),
+ git_path("CHERRY_PICK_HEAD"));
+ if (write_in_full(fd, buf.buf, buf.len) != buf.len || close(fd))
+ die_errno(_("Could not write to '%s'"), git_path("CHERRY_PICK_HEAD"));
+ strbuf_release(&buf);
+}
+
+static void print_advice(int show_hint)
+{
+ char *msg = getenv("GIT_CHERRY_PICK_HELP");
+
+ if (msg) {
+ fprintf(stderr, "%s\n", msg);
+ /*
+ * A conflict has occured but the porcelain
+ * (typically rebase --interactive) wants to take care
+ * of the commit itself so remove CHERRY_PICK_HEAD
+ */
+ unlink(git_path("CHERRY_PICK_HEAD"));
+ return;
+ }
+
+ if (show_hint) {
+ advise("after resolving the conflicts, mark the corrected paths");
+ advise("with 'git add <paths>' or 'git rm <paths>'");
+ advise("and commit the result with 'git commit'");
+ }
+}
+
+static void write_message(struct strbuf *msgbuf, const char *filename)
+{
+ static struct lock_file msg_file;
+
+ int msg_fd = hold_lock_file_for_update(&msg_file, filename,
+ LOCK_DIE_ON_ERROR);
+ if (write_in_full(msg_fd, msgbuf->buf, msgbuf->len) < 0)
+ die_errno(_("Could not write to %s."), filename);
+ strbuf_release(msgbuf);
+ if (commit_lock_file(&msg_file) < 0)
+ die(_("Error wrapping up %s"), filename);
+}
+
+static struct tree *empty_tree(void)
+{
+ return lookup_tree((const unsigned char *)EMPTY_TREE_SHA1_BIN);
+}
+
+static int error_dirty_index(struct replay_opts *opts)
+{
+ if (read_cache_unmerged())
+ return error_resolve_conflict(action_name(opts));
+
+ /* Different translation strings for cherry-pick and revert */
+ if (opts->action == REPLAY_PICK)
+ error(_("Your local changes would be overwritten by cherry-pick."));
+ else
+ error(_("Your local changes would be overwritten by revert."));
+
+ if (advice_commit_before_merge)
+ advise(_("Commit your changes or stash them to proceed."));
+ return -1;
+}
+
+static int fast_forward_to(const unsigned char *to, const unsigned char *from)
+{
+ struct ref_lock *ref_lock;
+
+ read_cache();
+ if (checkout_fast_forward(from, to))
+ exit(1); /* the callee should have complained already */
+ ref_lock = lock_any_ref_for_update("HEAD", from, 0);
+ return write_ref_sha1(ref_lock, to, "cherry-pick");
+}
+
+static int do_recursive_merge(struct commit *base, struct commit *next,
+ const char *base_label, const char *next_label,
+ unsigned char *head, struct strbuf *msgbuf,
+ struct replay_opts *opts)
+{
+ struct merge_options o;
+ struct tree *result, *next_tree, *base_tree, *head_tree;
+ int clean, index_fd;
+ const char **xopt;
+ static struct lock_file index_lock;
+
+ index_fd = hold_locked_index(&index_lock, 1);
+
+ read_cache();
+
+ init_merge_options(&o);
+ o.ancestor = base ? base_label : "(empty tree)";
+ o.branch1 = "HEAD";
+ o.branch2 = next ? next_label : "(empty tree)";
+
+ head_tree = parse_tree_indirect(head);
+ next_tree = next ? next->tree : empty_tree();
+ base_tree = base ? base->tree : empty_tree();
+
+ for (xopt = opts->xopts; xopt != opts->xopts + opts->xopts_nr; xopt++)
+ parse_merge_opt(&o, *xopt);
+
+ clean = merge_trees(&o,
+ head_tree,
+ next_tree, base_tree, &result);
+
+ if (active_cache_changed &&
+ (write_cache(index_fd, active_cache, active_nr) ||
+ commit_locked_index(&index_lock)))
+ /* TRANSLATORS: %s will be "revert" or "cherry-pick" */
+ die(_("%s: Unable to write new index file"), action_name(opts));
+ rollback_lock_file(&index_lock);
+
+ if (!clean) {
+ int i;
+ strbuf_addstr(msgbuf, "\nConflicts:\n\n");
+ for (i = 0; i < active_nr;) {
+ struct cache_entry *ce = active_cache[i++];
+ if (ce_stage(ce)) {
+ strbuf_addch(msgbuf, '\t');
+ strbuf_addstr(msgbuf, ce->name);
+ strbuf_addch(msgbuf, '\n');
+ while (i < active_nr && !strcmp(ce->name,
+ active_cache[i]->name))
+ i++;
+ }
+ }
+ }
+
+ return !clean;
+}
+
+/*
+ * If we are cherry-pick, and if the merge did not result in
+ * hand-editing, we will hit this commit and inherit the original
+ * author date and name.
+ * If we are revert, or if our cherry-pick results in a hand merge,
+ * we had better say that the current user is responsible for that.
+ */
+static int run_git_commit(const char *defmsg, struct replay_opts *opts)
+{
+ /* 6 is max possible length of our args array including NULL */
+ const char *args[6];
+ int i = 0;
+
+ args[i++] = "commit";
+ args[i++] = "-n";
+ if (opts->signoff)
+ args[i++] = "-s";
+ if (!opts->edit) {
+ args[i++] = "-F";
+ args[i++] = defmsg;
+ }
+ args[i] = NULL;
+
+ return run_command_v_opt(args, RUN_GIT_CMD);
+}
+
+static int do_pick_commit(struct commit *commit, enum replay_action action,
+ struct replay_opts *opts)
+{
+ unsigned char head[20];
+ struct commit *base, *next, *parent;
+ const char *base_label, *next_label;
+ struct commit_message msg = { NULL, NULL, NULL, NULL, NULL };
+ char *defmsg = NULL;
+ struct strbuf msgbuf = STRBUF_INIT;
+ int res;
+
+ if (opts->no_commit) {
+ /*
+ * We do not intend to commit immediately. We just want to
+ * merge the differences in, so let's compute the tree
+ * that represents the "current" state for merge-recursive
+ * to work on.
+ */
+ if (write_cache_as_tree(head, 0, NULL))
+ die (_("Your index file is unmerged."));
+ } else {
+ if (get_sha1("HEAD", head))
+ return error(_("You do not have a valid HEAD"));
+ if (index_differs_from("HEAD", 0))
+ return error_dirty_index(opts);
+ }
+ discard_cache();
+
+ if (!commit->parents) {
+ parent = NULL;
+ }
+ else if (commit->parents->next) {
+ /* Reverting or cherry-picking a merge commit */
+ int cnt;
+ struct commit_list *p;
+
+ if (!opts->mainline)
+ return error(_("Commit %s is a merge but no -m option was given."),
+ sha1_to_hex(commit->object.sha1));
+
+ for (cnt = 1, p = commit->parents;
+ cnt != opts->mainline && p;
+ cnt++)
+ p = p->next;
+ if (cnt != opts->mainline || !p)
+ return error(_("Commit %s does not have parent %d"),
+ sha1_to_hex(commit->object.sha1), opts->mainline);
+ parent = p->item;
+ } else if (0 < opts->mainline)
+ return error(_("Mainline was specified but commit %s is not a merge."),
+ sha1_to_hex(commit->object.sha1));
+ else
+ parent = commit->parents->item;
+
+ if (opts->allow_ff && parent && !hashcmp(parent->object.sha1, head))
+ return fast_forward_to(commit->object.sha1, head);
+
+ if (parent && parse_commit(parent) < 0)
+ /* TRANSLATORS: The first %s will be "revert" or
+ "cherry-pick", the second %s a SHA1 */
+ return error(_("%s: cannot parse parent commit %s"),
+ action_name(opts), sha1_to_hex(parent->object.sha1));
+
+ if (get_message(commit, &msg) != 0)
+ return error(_("Cannot get commit message for %s"),
+ sha1_to_hex(commit->object.sha1));
+
+ /*
+ * "commit" is an existing commit. We would want to apply
+ * the difference it introduces since its first parent "prev"
+ * on top of the current HEAD if we are cherry-pick. Or the
+ * reverse of it if we are revert.
+ */
+
+ defmsg = git_pathdup("MERGE_MSG");
+
+ if (action == REPLAY_REVERT) {
+ base = commit;
+ base_label = msg.label;
+ next = parent;
+ next_label = msg.parent_label;
+ strbuf_addstr(&msgbuf, "Revert \"");
+ strbuf_addstr(&msgbuf, msg.subject);
+ strbuf_addstr(&msgbuf, "\"\n\nThis reverts commit ");
+ strbuf_addstr(&msgbuf, sha1_to_hex(commit->object.sha1));
+
+ if (commit->parents && commit->parents->next) {
+ strbuf_addstr(&msgbuf, ", reversing\nchanges made to ");
+ strbuf_addstr(&msgbuf, sha1_to_hex(parent->object.sha1));
+ }
+ strbuf_addstr(&msgbuf, ".\n");
+ } else {
+ const char *p;
+
+ base = parent;
+ base_label = msg.parent_label;
+ next = commit;
+ next_label = msg.label;
+
+ /*
+ * Append the commit log message to msgbuf; it starts
+ * after the tree, parent, author, committer
+ * information followed by "\n\n".
+ */
+ p = strstr(msg.message, "\n\n");
+ if (p) {
+ p += 2;
+ strbuf_addstr(&msgbuf, p);
+ }
+
+ if (opts->record_origin) {
+ strbuf_addstr(&msgbuf, "(cherry picked from commit ");
+ strbuf_addstr(&msgbuf, sha1_to_hex(commit->object.sha1));
+ strbuf_addstr(&msgbuf, ")\n");
+ }
+ }
+
+ if (!opts->strategy || !strcmp(opts->strategy, "recursive") || action == REPLAY_REVERT) {
+ res = do_recursive_merge(base, next, base_label, next_label,
+ head, &msgbuf, opts);
+ write_message(&msgbuf, defmsg);
+ } else {
+ struct commit_list *common = NULL;
+ struct commit_list *remotes = NULL;
+
+ write_message(&msgbuf, defmsg);
+
+ commit_list_insert(base, &common);
+ commit_list_insert(next, &remotes);
+ res = try_merge_command(opts->strategy, opts->xopts_nr, opts->xopts,
+ common, sha1_to_hex(head), remotes);
+ free_commit_list(common);
+ free_commit_list(remotes);
+ }
+
+ /*
+ * If the merge was clean or if it failed due to conflict, we write
+ * CHERRY_PICK_HEAD for the subsequent invocation of commit to use.
+ * However, if the merge did not even start, then we don't want to
+ * write it at all.
+ */
+ if (opts->action == REPLAY_PICK && !opts->no_commit && (res == 0 || res == 1))
+ write_cherry_pick_head(commit);
+
+ if (res) {
+ error(action == REPLAY_REVERT
+ ? _("could not revert %s... %s")
+ : _("could not apply %s... %s"),
+ find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),
+ msg.subject);
+ print_advice(res == 1);
+ rerere(opts->allow_rerere_auto);
+ } else {
+ if (!opts->no_commit)
+ res = run_git_commit(defmsg, opts);
+ }
+
+ free_message(&msg);
+ free(defmsg);
+
+ return res;
+}
+
+static void prepare_revs(struct replay_opts *opts)
+{
+ if (opts->action != REPLAY_REVERT)
+ opts->revs->reverse ^= 1;
+
+ if (prepare_revision_walk(opts->revs))
+ die(_("revision walk setup failed"));
+
+ if (!opts->revs->commits)
+ die(_("empty commit set passed"));
+}
+
+static void read_and_refresh_cache(struct replay_opts *opts)
+{
+ static struct lock_file index_lock;
+ int index_fd = hold_locked_index(&index_lock, 0);
+ if (read_index_preload(&the_index, NULL) < 0)
+ die(_("git %s: failed to read the index"), action_name(opts));
+ refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
+ if (the_index.cache_changed) {
+ if (write_index(&the_index, index_fd) ||
+ commit_locked_index(&index_lock))
+ die(_("git %s: failed to refresh the index"), action_name(opts));
+ }
+ rollback_lock_file(&index_lock);
+}
+
+/*
+ * Append a commit to the end of the commit_list.
+ *
+ * next starts by pointing to the variable that holds the head of an
+ * empty commit_list, and is updated to point to the "next" field of
+ * the last item on the list as new commits are appended.
+ *
+ * Usage example:
+ *
+ * struct commit_list *list;
+ * struct commit_list **next = &list;
+ *
+ * next = commit_list_append(c1, next);
+ * next = commit_list_append(c2, next);
+ * assert(commit_list_count(list) == 2);
+ * return list;
+ */
+static struct replay_insn_list **replay_insn_list_append(enum replay_action action,
+ struct commit *operand,
+ struct replay_insn_list **next)
+{
+ struct replay_insn_list *new = xmalloc(sizeof(*new));
+ new->action = action;
+ new->operand = operand;
+ *next = new;
+ new->next = NULL;
+ return &new->next;
+}
+
+static int format_todo(struct strbuf *buf, struct replay_insn_list *todo_list)
+{
+ struct replay_insn_list *cur;
+
+ for (cur = todo_list; cur; cur = cur->next) {
+ const char *sha1_abbrev, *action_str, *subject;
+ int subject_len;
+
+ action_str = cur->action == REPLAY_REVERT ? "revert" : "pick";
+ sha1_abbrev = find_unique_abbrev(cur->operand->object.sha1, DEFAULT_ABBREV);
+ subject_len = find_commit_subject(cur->operand->buffer, &subject);
+ strbuf_addf(buf, "%s %s %.*s\n", action_str, sha1_abbrev,
+ subject_len, subject);
+ }
+ return 0;
+}
+
+static int parse_insn_line(char *bol, char *eol, struct replay_insn_list *item)
+{
+ unsigned char commit_sha1[20];
+ char *end_of_object_name;
+ int saved, status;
+
+ if (!prefixcmp(bol, "pick ")) {
+ item->action = REPLAY_PICK;
+ bol += strlen("pick ");
+ } else if (!prefixcmp(bol, "revert ")) {
+ item->action = REPLAY_REVERT;
+ bol += strlen("revert ");
+ } else {
+ size_t len = strchrnul(bol, '\n') - bol;
+ if (len > 255)
+ len = 255;
+ return error(_("Unrecognized action: %.*s"), (int)len, bol);
+ }
+
+ end_of_object_name = bol + strcspn(bol, " \n");
+ saved = *end_of_object_name;
+ *end_of_object_name = '\0';
+ status = get_sha1(bol, commit_sha1);
+ *end_of_object_name = saved;
+
+ if (status < 0)
+ return error(_("Malformed object name: %s"), bol);
+
+ item->operand = lookup_commit_reference(commit_sha1);
+ if (!item->operand)
+ return error(_("Not a valid commit: %s"), bol);
+
+ item->next = NULL;
+ return 0;
+}
+
+static int parse_insn_buffer(char *buf, struct replay_insn_list **todo_list)
+{
+ struct replay_insn_list **next = todo_list;
+ struct replay_insn_list item = {0, NULL, NULL};
+ char *p = buf;
+ int i;
+
+ for (i = 1; *p; i++) {
+ char *eol = strchrnul(p, '\n');
+ if (parse_insn_line(p, eol, &item) < 0)
+ return error(_("on line %d."), i);
+ next = replay_insn_list_append(item.action, item.operand, next);
+ p = *eol ? eol + 1 : eol;
+ }
+ if (!*todo_list)
+ return error(_("No commits parsed."));
+ return 0;
+}
+
+static void read_populate_todo(struct replay_insn_list **todo_list)
+{
+ const char *todo_file = git_path(SEQ_TODO_FILE);
+ struct strbuf buf = STRBUF_INIT;
+ int fd, res;
+
+ fd = open(todo_file, O_RDONLY);
+ if (fd < 0)
+ die_errno(_("Could not open %s."), todo_file);
+ if (strbuf_read(&buf, fd, 0) < 0) {
+ close(fd);
+ strbuf_release(&buf);
+ die(_("Could not read %s."), todo_file);
+ }
+ close(fd);
+
+ res = parse_insn_buffer(buf.buf, todo_list);
+ strbuf_release(&buf);
+ if (res)
+ die(_("Unusable instruction sheet: %s"), todo_file);
+}
+
+static int populate_opts_cb(const char *key, const char *value, void *data)
+{
+ struct replay_opts *opts = data;
+ int error_flag = 1;
+
+ if (!value)
+ error_flag = 0;
+ else if (!strcmp(key, "options.no-commit"))
+ opts->no_commit = git_config_bool_or_int(key, value, &error_flag);
+ else if (!strcmp(key, "options.edit"))
+ opts->edit = git_config_bool_or_int(key, value, &error_flag);
+ else if (!strcmp(key, "options.signoff"))
+ opts->signoff = git_config_bool_or_int(key, value, &error_flag);
+ else if (!strcmp(key, "options.record-origin"))
+ opts->record_origin = git_config_bool_or_int(key, value, &error_flag);
+ else if (!strcmp(key, "options.allow-ff"))
+ opts->allow_ff = git_config_bool_or_int(key, value, &error_flag);
+ else if (!strcmp(key, "options.mainline"))
+ opts->mainline = git_config_int(key, value);
+ else if (!strcmp(key, "options.strategy"))
+ git_config_string(&opts->strategy, key, value);
+ else if (!strcmp(key, "options.strategy-option")) {
+ ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);
+ opts->xopts[opts->xopts_nr++] = xstrdup(value);
+ } else
+ return error(_("Invalid key: %s"), key);
+
+ if (!error_flag)
+ return error(_("Invalid value for %s: %s"), key, value);
+
+ return 0;
+}
+
+static void read_populate_opts(struct replay_opts **opts_ptr)
+{
+ const char *opts_file = git_path(SEQ_OPTS_FILE);
+
+ if (!file_exists(opts_file))
+ return;
+ if (git_config_from_file(populate_opts_cb, opts_file, *opts_ptr) < 0)
+ die(_("Malformed options sheet: %s"), opts_file);
+}
+
+static void walk_revs_populate_todo(struct replay_insn_list **todo_list,
+ struct replay_opts *opts)
+{
+ struct commit *commit;
+ struct replay_insn_list **next;
+
+ prepare_revs(opts);
+
+ next = todo_list;
+ while ((commit = get_revision(opts->revs)))
+ next = replay_insn_list_append(opts->action, commit, next);
+}
+
+static int create_seq_dir(void)
+{
+ const char *seq_dir = git_path(SEQ_DIR);
+
+ if (file_exists(seq_dir))
+ return error(_("%s already exists."), seq_dir);
+ else if (mkdir(seq_dir, 0777) < 0)
+ die_errno(_("Could not create sequencer directory '%s'."), seq_dir);
+ return 0;
+}
+
+static void save_head(const char *head)
+{
+ const char *head_file = git_path(SEQ_HEAD_FILE);
+ static struct lock_file head_lock;
+ struct strbuf buf = STRBUF_INIT;
+ int fd;
+
+ fd = hold_lock_file_for_update(&head_lock, head_file, LOCK_DIE_ON_ERROR);
+ strbuf_addf(&buf, "%s\n", head);
+ if (write_in_full(fd, buf.buf, buf.len) < 0)
+ die_errno(_("Could not write to %s."), head_file);
+ if (commit_lock_file(&head_lock) < 0)
+ die(_("Error wrapping up %s."), head_file);
+}
+
+static void save_todo(struct replay_insn_list *todo_list)
+{
+ const char *todo_file = git_path(SEQ_TODO_FILE);
+ static struct lock_file todo_lock;
+ struct strbuf buf = STRBUF_INIT;
+ int fd;
+
+ fd = hold_lock_file_for_update(&todo_lock, todo_file, LOCK_DIE_ON_ERROR);
+ if (format_todo(&buf, todo_list) < 0)
+ die(_("Could not format %s."), todo_file);
+ if (write_in_full(fd, buf.buf, buf.len) < 0) {
+ strbuf_release(&buf);
+ die_errno(_("Could not write to %s."), todo_file);
+ }
+ if (commit_lock_file(&todo_lock) < 0) {
+ strbuf_release(&buf);
+ die(_("Error wrapping up %s."), todo_file);
+ }
+ strbuf_release(&buf);
+}
+
+static void save_opts(struct replay_opts *opts)
+{
+ const char *opts_file = git_path(SEQ_OPTS_FILE);
+
+ if (opts->no_commit)
+ git_config_set_in_file(opts_file, "options.no-commit", "true");
+ if (opts->edit)
+ git_config_set_in_file(opts_file, "options.edit", "true");
+ if (opts->signoff)
+ git_config_set_in_file(opts_file, "options.signoff", "true");
+ if (opts->record_origin)
+ git_config_set_in_file(opts_file, "options.record-origin", "true");
+ if (opts->allow_ff)
+ git_config_set_in_file(opts_file, "options.allow-ff", "true");
+ if (opts->mainline) {
+ struct strbuf buf = STRBUF_INIT;
+ strbuf_addf(&buf, "%d", opts->mainline);
+ git_config_set_in_file(opts_file, "options.mainline", buf.buf);
+ strbuf_release(&buf);
+ }
+ if (opts->strategy)
+ git_config_set_in_file(opts_file, "options.strategy", opts->strategy);
+ if (opts->xopts) {
+ int i;
+ for (i = 0; i < opts->xopts_nr; i++)
+ git_config_set_multivar_in_file(opts_file,
+ "options.strategy-option",
+ opts->xopts[i], "^$", 0);
+ }
+}
+
+static int pick_commits(struct replay_insn_list *todo_list,
+ struct replay_opts *opts)
+{
+ struct replay_insn_list *cur;
+ int res;
+
+ setenv(GIT_REFLOG_ACTION, action_name(opts), 0);
+ if (opts->allow_ff)
+ assert(!(opts->signoff || opts->no_commit ||
+ opts->record_origin || opts->edit));
+ read_and_refresh_cache(opts);
+
+ for (cur = todo_list; cur; cur = cur->next) {
+ save_todo(cur);
+ res = do_pick_commit(cur->operand, cur->action, opts);
+ if (res) {
+ if (!cur->next)
+ /*
+ * An error was encountered while
+ * picking the last commit; the
+ * sequencer state is useless now --
+ * the user simply needs to resolve
+ * the conflict and commit
+ */
+ remove_sequencer_state(0);
+ return res;
+ }
+ }
+
+ /*
+ * Sequence of picks finished successfully; cleanup by
+ * removing the .git/sequencer directory
+ */
+ remove_sequencer_state(1);
+ return 0;
+}
+
+int sequencer_pick_revisions(struct replay_opts *opts)
+{
+ struct replay_insn_list *todo_list = NULL;
+ unsigned char sha1[20];
+
+ if (opts->subcommand == REPLAY_NONE)
+ assert(opts->revs);
+
+ read_and_refresh_cache(opts);
+
+ /*
+ * Decide what to do depending on the arguments; a fresh
+ * cherry-pick should be handled differently from an existing
+ * one that is being continued
+ */
+ if (opts->subcommand == REPLAY_RESET) {
+ remove_sequencer_state(1);
+ return 0;
+ } else if (opts->subcommand == REPLAY_CONTINUE) {
+ if (!file_exists(git_path(SEQ_TODO_FILE)))
+ goto error;
+ read_populate_opts(&opts);
+ read_populate_todo(&todo_list);
+
+ /* Verify that the conflict has been resolved */
+ if (!index_differs_from("HEAD", 0))
+ todo_list = todo_list->next;
+ } else {
+ /*
+ * Start a new cherry-pick/ revert sequence; but
+ * first, make sure that an existing one isn't in
+ * progress
+ */
+
+ walk_revs_populate_todo(&todo_list, opts);
+ if (create_seq_dir() < 0) {
+ error(_("A cherry-pick or revert is in progress."));
+ advise(_("Use --continue to continue the operation"));
+ advise(_("or --reset to forget about it"));
+ return -1;
+ }
+ if (get_sha1("HEAD", sha1)) {
+ if (opts->action == REPLAY_REVERT)
+ return error(_("Can't revert as initial commit"));
+ return error(_("Can't cherry-pick into empty head"));
+ }
+ save_head(sha1_to_hex(sha1));
+ save_opts(opts);
+ }
+ return pick_commits(todo_list, opts);
+error:
+ return error(_("No %s in progress"), action_name(opts));
+}
diff --git a/sequencer.h b/sequencer.h
index f4db257..92b2d63 100644
--- a/sequencer.h
+++ b/sequencer.h
@@ -8,6 +8,30 @@
#define SEQ_OPTS_FILE "sequencer/opts"
enum replay_action { REPLAY_REVERT, REPLAY_PICK };
+enum replay_subcommand { REPLAY_NONE, REPLAY_RESET, REPLAY_CONTINUE };
+
+struct replay_opts {
+ enum replay_action action;
+ enum replay_subcommand subcommand;
+
+ /* Boolean options */
+ int edit;
+ int record_origin;
+ int no_commit;
+ int signoff;
+ int allow_ff;
+ int allow_rerere_auto;
+
+ int mainline;
+
+ /* Merge strategy */
+ const char *strategy;
+ const char **xopts;
+ size_t xopts_nr, xopts_alloc;
+
+ /* Only used by REPLAY_NONE */
+ struct rev_info *revs;
+};
struct replay_insn_list {
enum replay_action action;
@@ -25,4 +49,6 @@ struct replay_insn_list {
*/
void remove_sequencer_state(int aggressive);
+int sequencer_pick_revisions(struct replay_opts *opts);
+
#endif
--
1.7.6.351.gb35ac.dirty
^ permalink raw reply related
* [PATCH] DaVinci: only poll EPCPR on DM644x and DM355
From: Nori, Sekhar @ 2011-10-23 11:10 UTC (permalink / raw)
To: linux-arm-kernel
In-Reply-To: <201109151829.49256.sshtylyov@ru.mvista.com>
Hi Sergei,
On Thu, Sep 15, 2011 at 19:59:48, Sergei Shtylyov wrote:
> EPCPR register and PDCTL.EPCGOOD bit exist only on DaVinci DM644x and DM35x,
> so do not try to poll EPCPR and set PDCTL.EPCGOOD on the other SoCs -- it would
> lead to lock up if some power domain hasn't been powered up by this time (which
> hasn't happened yet on any board, it seems).
>
> Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Firstly, sorry about feedback this late. I was involved in
the bring-up of a new TI SoC which took much more of my
time than I anticipated.
So, I looked at power domain support for each of the 6
DaVinci SoCs we support (don't have the specifications
for tnetv107x; and code does not have evidence of a separate
DSP power domain).
It looks like none of the SoCs except DM6446 actually support
powering down the DSP power domain.
DM6467, DM355, DM365 all have a single "Always ON" power
domain. DM355 specification actually talks about EPCPR
and EPCGOOD but that's probably due to copy paste from
DM644x specification than anything else.
OMAP-L137 and OMAP-L138 have additional power domains for DSP
and Shared RAM, but do not support powering them down.
So, looks like the only SoC where PDSTAT might indicate a powered
down domain is DM644x and existing code to looks alright for
that SoC.
At this time, it would be better to leave the code as-is and
revisit it if/when a new SoC with programmable power domain
support comes along.
Thanks,
Sekhar
^ permalink raw reply
* Re: [PULL] drm-intel-next
From: Martin @ 2011-10-23 11:10 UTC (permalink / raw)
To: linux-kernel
Keith Packard wrote:
>
> Here's a pile of new code for the 3.2 series.
[...]
> drm/i915: close PM interrupt masking races in the irq handler
> drm/i915: close PM interrupt masking races in the rps work func
I always get my hopes high when I read something like this. Maybe my Clarkdale
based workstation will eventually get fully stable and I can close my ancient
bugzilla entries.
Martin
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
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.