Re: [PATCH] commit: Add -f, --fixes option to add Fixes: line

2013-10-27 Thread Jim Hill

On 10/26/13 18:34, Josh Triplett wrote:

Linux Kernel ... "Fixes:" line ... containing an abbreviated commit hash




This helps people (or automated tools) determine how far to backport


I beg pardon if I'm rehearsing an old debate, but it seems to me it 
would be better and worthwhile to bring more of git to bear by adding 
`reference` links as follows from considering this proposed sequence:


#  ...G---B---...history-with-bug-at-B

Gprime=`git commit-tree --reference G`
Bprime=`git commit-tree --reference B -p $Gprime`

#   ...G---B---...   history-with-bug-at-B
#  :   : # <-- `:`'s are `reference` links
#  G'--B'$Bprime is a mergeable cherry-pick for B

`reference` links have no enforced semantics. Teach all current logic to 
ignore them (fetch doesn't fetch through them, fsck doesn't care, etc.). 
 Elaborating some of the good parts:


* If the author and committer data are left untouched when 
`commit-tree`'s tree and message arguments are defaulted, as above, to 
the referenced commit's tree and message, the resulting commit is unique.


* Bullet-proof cherry-pick creation becomes easy and idempotent:

git-make-cherry-pick() {
local picked=$1
set -- `git rev-list --parents $picked^!`
shift
local parents
local parent
local p2
for parent; do
p2="$p2 -p `git commit-tree --reference $parent`"
done
git commit-tree --reference $picked $parents`
}

* Which makes the created commit id a fully-implemented _change-id_ for 
the referenced commit:


git merge $(git-make-cherry-pick $B)

can be done from anywhere, merge won't have to rely on patch-id's 
to detect cherry-picks done this way.


* A bugged commit gets fixed by fixing its reference commit and merging 
normally, worry-free:


...G---B ... -F   Merge fix X for a bug in B
   :   : /
   G'--B'---X X's commit message is the `Fixes:` equivalent

   Bugfix commit X can be safely merged anywhere.  Worst case, `git 
merge -s ours --no-commit X` and do whatever you would have done otherwise.


`merge` might usefully be updated to warn about merging from a commit 
with only a reference parent, I think merging from `G'` would probably 
be a mistake.


---
So, this is as far as I've gotten with this, is there reason to think it 
should or shouldn't be pursued?

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] commit: Add -f, --fixes commit option to add Fixes: line

2013-10-27 Thread Jim Hill

On 10/26/13 18:34, Josh Triplett wrote:

Linux Kernel ... Fixes: line ... containing an abbreviated commit hash


!-- --

This helps people (or automated tools) determine how far to backport


I beg pardon if I'm rehearsing an old debate, but it seems to me it 
would be better and worthwhile to bring more of git to bear by adding 
`reference` links as follows from considering this proposed sequence:


#  ...G---B---...history-with-bug-at-B

Gprime=`git commit-tree --reference G`
Bprime=`git commit-tree --reference B -p $Gprime`

#   ...G---B---...   history-with-bug-at-B
#  :   : # -- `:`'s are `reference` links
#  G'--B'$Bprime is a mergeable cherry-pick for B

`reference` links have no enforced semantics. Teach all current logic to 
ignore them (fetch doesn't fetch through them, fsck doesn't care, etc.). 
 Elaborating some of the good parts:


* If the author and committer data are left untouched when 
`commit-tree`'s tree and message arguments are defaulted, as above, to 
the referenced commit's tree and message, the resulting commit is unique.


* Bullet-proof cherry-pick creation becomes easy and idempotent:

git-make-cherry-pick() {
local picked=$1
set -- `git rev-list --parents $picked^!`
shift
local parents
local parent
local p2
for parent; do
p2=$p2 -p `git commit-tree --reference $parent`
done
git commit-tree --reference $picked $parents`
}

* Which makes the created commit id a fully-implemented _change-id_ for 
the referenced commit:


git merge $(git-make-cherry-pick $B)

can be done from anywhere, merge won't have to rely on patch-id's 
to detect cherry-picks done this way.


* A bugged commit gets fixed by fixing its reference commit and merging 
normally, worry-free:


...G---B ... -F   Merge fix X for a bug in B
   :   : /
   G'--B'---X X's commit message is the `Fixes:` equivalent

   Bugfix commit X can be safely merged anywhere.  Worst case, `git 
merge -s ours --no-commit X` and do whatever you would have done otherwise.


`merge` might usefully be updated to warn about merging from a commit 
with only a reference parent, I think merging from `G'` would probably 
be a mistake.


---
So, this is as far as I've gotten with this, is there reason to think it 
should or shouldn't be pursued?

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v2] psmouse: mitigate failing-mouse symptoms

2012-10-02 Thread Jim Hill
On 09/30/2012 11:02 AM, Alessandro Rubini wrote:
>> I think this would be less controversial if the run-time default were
>> to disable the feature.
>
> Yes, that's the common sensible path

Fixed, there's no way I can test it well enough for anything more widespread.

> Then, I think it would be good to have a specific sub-structure for
> this stuff.

I don't care much either way, though I think I'm missing the point of subbing
in a memset -- only reason I can think of is efficiency which doesn't make
sense to me here.  Ask and I'll add one or both.

> I also think it would make it clearer what these are:

I did de-jargonize the names some,  "interval_start" for "base" makes it
clearer which as you say it could use.

I encountered one other person with this problem and he ran it for a long while
and was happy to have it.  I'm appending the latest version, which is a good
bit improved and what I've been running for the last year amended with the name
and default-filter changes above.

But of course I upgraded a month ago to a box with no PS/2 mouse port, so at
this point all I can do is hope someone finds it helpful.  The reorg'd code 
kinda highlights how incomplete it is, there's lots of mouse models out there.

So if it looks good or almost-good to you and there's anything else I can do,
tell me and I'll be glad to do it.

Thanks,
Jim

>From 2681957a610191cb5d7b7f65be11ea2be06df00f Mon Sep 17 00:00:00 2001
From: Jim Hill 
Date: Mon, 28 Mar 2011 13:10:36 -0700
Subject: [PATCH] Input: psmouse - further improve error handling for
 basic protocols

  Keep a failing PS/2 mouse usable until it's convenient to replace it.
  Filter incoming packets: drop invalid ones and attempt to correct for
  dropped bytes.
 
  New parameter 'filter' makes filtering and logging selectable, leave at 0
  to shut off all effects, 3 to work silently.
--
 drivers/input/mouse/psmouse-base.c | 197 +
 drivers/input/mouse/psmouse.h  |   7 ++
 2 files changed, 204 insertions(+)

diff --git a/drivers/input/mouse/psmouse-base.c 
b/drivers/input/mous/psmouse-base.c
index 22fe254..4a3a95f 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -72,6 +72,25 @@ static unsigned int psmouse_resync_time;
 module_param_named(resync_time, psmouse_resync_time, uint, 0644);
 MODULE_PARM_DESC(resync_time, "How long can mouse stay idle before forcing 
resync (in seconds, 0 = never).");

+enum {
+   DROP_BAD_PACKET = 1,
+   ATTEMPT_SYNC = 2,
+   LOG_SUMMARIES = 4,
+   LOG_MALFORMED = 8,
+   LOG_ALL  = 16,
+   REPORT_SYNC_FAILURE = 32,
+
+   DEFAULT_FILTER = 0
+};
+static int psmouse_filter = DEFAULT_FILTER;
+module_param_named(filter, psmouse_filter, int, 0644);
+MODULE_PARM_DESC(filter, "1 = drop invalid or hotio packets"
+   ", +2 = attempt-sync"
+   ", +4 = summary logs"
+   ", +8 = log-malformed"
+   ",+16 = log-all"
+   ",+32 = use hard resets");
+
 PSMOUSE_DEFINE_ATTR(protocol, S_IWUSR | S_IRUGO,
NULL,
psmouse_attr_show_protocol, psmouse_attr_set_protocol);
@@ -123,6 +142,169 @@ struct psmouse_protocol {
 };

 /*
+ * psmouse_filter_*: diagnose bad data, recover what we can, drop the rest, log
+ * selected events. See input_report_*()s in psmouse_process_byte below, and
+ * <http://www.computer-engineering.org/ps2mouse/>
+ */
+
+static int psmouse_filter_header_byte(enum psmouse_type type, int byte)
+{
+   int todo = 0;
+   if ((byte & 0xc0) &&
+   type != PSMOUSE_THINKPS &&
+   type != PSMOUSE_GENPS)
+   todo |= DROP_BAD_PACKET+ATTEMPT_SYNC;
+   if ((byte & 0x08) == 0 &&
+   type != PSMOUSE_THINKPS &&
+   type != PSMOUSE_CORTRON)
+   todo |= DROP_BAD_PACKET+ATTEMPT_SYNC;
+   return todo;
+}
+
+static int psmouse_filter_wheel_byte(enum psmouse_type type, int byte)
+{
+   int todo = 0;
+   if (type == PSMOUSE_IMPS || type == PSMOUSE_GENPS)
+   if (abs(byte) > 3)
+   todo = DROP_BAD_PACKET+ATTEMPT_SYNC;
+   if (type == PSMOUSE_IMEX)
+   if (((byte&0xC0) == 0) || ((byte&0XC0) == 0xC0))
+   if (abs((byte&0x08)-(byte&0x07)) > 3)
+   todo = DROP_BAD_PACKET+ATTEMPT_SYNC;
+   return todo;
+}
+
+static int psmouse_filter_motion(struct psmouse *m)
+{  /*
+* Hunt for implausible accelerations here if it ever seems necessary.
+* Header/wheel sniffing seems to detect everything recoverable so far.
+*/
+   return 0;
+}
+
+static int psmouse_filter_hotio(struct psmouse *m)
+{
+   int ret = 0;
+  

Re: [PATCH v2] psmouse: mitigate failing-mouse symptoms

2012-10-02 Thread Jim Hill
On 09/30/2012 11:02 AM, Alessandro Rubini wrote:
 I think this would be less controversial if the run-time default were
 to disable the feature.

 Yes, that's the common sensible path

Fixed, there's no way I can test it well enough for anything more widespread.

 Then, I think it would be good to have a specific sub-structure for
 this stuff.

I don't care much either way, though I think I'm missing the point of subbing
in a memset -- only reason I can think of is efficiency which doesn't make
sense to me here.  Ask and I'll add one or both.

 I also think it would make it clearer what these are:

I did de-jargonize the names some,  interval_start for base makes it
clearer which as you say it could use.

I encountered one other person with this problem and he ran it for a long while
and was happy to have it.  I'm appending the latest version, which is a good
bit improved and what I've been running for the last year amended with the name
and default-filter changes above.

But of course I upgraded a month ago to a box with no PS/2 mouse port, so at
this point all I can do is hope someone finds it helpful.  The reorg'd code 
kinda highlights how incomplete it is, there's lots of mouse models out there.

So if it looks good or almost-good to you and there's anything else I can do,
tell me and I'll be glad to do it.

Thanks,
Jim

From 2681957a610191cb5d7b7f65be11ea2be06df00f Mon Sep 17 00:00:00 2001
From: Jim Hill gjth...@gmail.com
Date: Mon, 28 Mar 2011 13:10:36 -0700
Subject: [PATCH] Input: psmouse - further improve error handling for
 basic protocols

  Keep a failing PS/2 mouse usable until it's convenient to replace it.
  Filter incoming packets: drop invalid ones and attempt to correct for
  dropped bytes.
 
  New parameter 'filter' makes filtering and logging selectable, leave at 0
  to shut off all effects, 3 to work silently.
--
 drivers/input/mouse/psmouse-base.c | 197 +
 drivers/input/mouse/psmouse.h  |   7 ++
 2 files changed, 204 insertions(+)

diff --git a/drivers/input/mouse/psmouse-base.c 
b/drivers/input/mous/psmouse-base.c
index 22fe254..4a3a95f 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -72,6 +72,25 @@ static unsigned int psmouse_resync_time;
 module_param_named(resync_time, psmouse_resync_time, uint, 0644);
 MODULE_PARM_DESC(resync_time, How long can mouse stay idle before forcing 
resync (in seconds, 0 = never).);

+enum {
+   DROP_BAD_PACKET = 1,
+   ATTEMPT_SYNC = 2,
+   LOG_SUMMARIES = 4,
+   LOG_MALFORMED = 8,
+   LOG_ALL  = 16,
+   REPORT_SYNC_FAILURE = 32,
+
+   DEFAULT_FILTER = 0
+};
+static int psmouse_filter = DEFAULT_FILTER;
+module_param_named(filter, psmouse_filter, int, 0644);
+MODULE_PARM_DESC(filter, 1 = drop invalid or hotio packets
+   , +2 = attempt-sync
+   , +4 = summary logs
+   , +8 = log-malformed
+   ,+16 = log-all
+   ,+32 = use hard resets);
+
 PSMOUSE_DEFINE_ATTR(protocol, S_IWUSR | S_IRUGO,
NULL,
psmouse_attr_show_protocol, psmouse_attr_set_protocol);
@@ -123,6 +142,169 @@ struct psmouse_protocol {
 };

 /*
+ * psmouse_filter_*: diagnose bad data, recover what we can, drop the rest, log
+ * selected events. See input_report_*()s in psmouse_process_byte below, and
+ * http://www.computer-engineering.org/ps2mouse/
+ */
+
+static int psmouse_filter_header_byte(enum psmouse_type type, int byte)
+{
+   int todo = 0;
+   if ((byte  0xc0) 
+   type != PSMOUSE_THINKPS 
+   type != PSMOUSE_GENPS)
+   todo |= DROP_BAD_PACKET+ATTEMPT_SYNC;
+   if ((byte  0x08) == 0 
+   type != PSMOUSE_THINKPS 
+   type != PSMOUSE_CORTRON)
+   todo |= DROP_BAD_PACKET+ATTEMPT_SYNC;
+   return todo;
+}
+
+static int psmouse_filter_wheel_byte(enum psmouse_type type, int byte)
+{
+   int todo = 0;
+   if (type == PSMOUSE_IMPS || type == PSMOUSE_GENPS)
+   if (abs(byte)  3)
+   todo = DROP_BAD_PACKET+ATTEMPT_SYNC;
+   if (type == PSMOUSE_IMEX)
+   if (((byte0xC0) == 0) || ((byte0XC0) == 0xC0))
+   if (abs((byte0x08)-(byte0x07))  3)
+   todo = DROP_BAD_PACKET+ATTEMPT_SYNC;
+   return todo;
+}
+
+static int psmouse_filter_motion(struct psmouse *m)
+{  /*
+* Hunt for implausible accelerations here if it ever seems necessary.
+* Header/wheel sniffing seems to detect everything recoverable so far.
+*/
+   return 0;
+}
+
+static int psmouse_filter_hotio(struct psmouse *m)
+{
+   int ret = 0;
+   if (time_after(m-last, m-hotio_interval_start + HZ/m-rate)) {
+   m-hotio_interval_pkts = 0;
+   m-hotio_interval_start = m-last;
+   }
+   if (m-hotio_interval_pkts++  m-rate/HZ + 1