All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH v7 02/17] ref-filter: include reference to 'used_atom' within 'atom_value'
From: Jacob Keller @ 2016-11-08 23:16 UTC (permalink / raw)
  To: Karthik Nayak; +Cc: Git mailing list
In-Reply-To: <20161108201211.25213-3-Karthik.188@gmail.com>

On Tue, Nov 8, 2016 at 12:11 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
> From: Karthik Nayak <karthik.188@gmail.com>
>
> Ensure that each 'atom_value' has a reference to its corresponding
> 'used_atom'. This let's us use values within 'used_atom' in the
> 'handler' function.
>
> Hence we can get the %(align) atom's parameters directly from the
> 'used_atom' therefore removing the necessity of passing %(align) atom's
> parameters to 'atom_value'.
>
> This also acts as a preparatory patch for the upcoming patch where we
> introduce %(if:equals=) and %(if:notequals=).
>

Makes sense.

> Signed-off-by: Karthik Nayak <Karthik.188@gmail.com>
> ---
>  ref-filter.c | 8 +++-----
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/ref-filter.c b/ref-filter.c
> index 8c183a0..8392303 100644
> --- a/ref-filter.c
> +++ b/ref-filter.c
> @@ -230,11 +230,9 @@ struct ref_formatting_state {
>
>  struct atom_value {
>         const char *s;
> -       union {
> -               struct align align;
> -       } u;
>         void (*handler)(struct atom_value *atomv, struct ref_formatting_state *state);
>         unsigned long ul; /* used for sorting when not FIELD_STR */
> +       struct used_atom *atom;
>  };
>
>  /*
> @@ -370,7 +368,7 @@ static void align_atom_handler(struct atom_value *atomv, struct ref_formatting_s
>         push_stack_element(&state->stack);
>         new = state->stack;
>         new->at_end = end_align_handler;
> -       new->at_end_data = &atomv->u.align;
> +       new->at_end_data = &atomv->atom->u.align;

At first, this confused me. I was like "we dropped the union, why are
we still referencing it. But I realized that the "used_atom" struct
actually contains the same union and we were copying it.

Ok, so this looks good.

Thanks,
Jake

>  }
>
>  static void if_then_else_handler(struct ref_formatting_stack **stack)
> @@ -1069,6 +1067,7 @@ static void populate_value(struct ref_array_item *ref)
>                 struct branch *branch = NULL;
>
>                 v->handler = append_atom;
> +               v->atom = atom;
>
>                 if (*name == '*') {
>                         deref = 1;
> @@ -1133,7 +1132,6 @@ static void populate_value(struct ref_array_item *ref)
>                                 v->s = " ";
>                         continue;
>                 } else if (starts_with(name, "align")) {
> -                       v->u.align = atom->u.align;
>                         v->handler = align_atom_handler;
>                         continue;
>                 } else if (!strcmp(name, "end")) {
> --
> 2.10.2
>

^ permalink raw reply

* Re: [PATCH 0/4] musb fixes for v4.9-rc cycle
From: Tony Lindgren @ 2016-11-08 23:16 UTC (permalink / raw)
  To: Ladislav Michl
  Cc: Bin Liu, Boris Brezillon, Greg Kroah-Hartman, Andreas Kemnade,
	Felipe Balbi, George Cherian, Kishon Vijay Abraham I,
	Ivaylo Dimitrov, Johan Hovold, Laurent Pinchart, Sergei Shtylyov,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-omap-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <20161108225206.GA14049-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>

* Ladislav Michl <ladis-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org> [161108 15:52]:
> On Tue, Nov 08, 2016 at 03:05:30PM -0700, Tony Lindgren wrote:
> > OK. The patch below still works for me with musb_core.c
> > autosuspend_delay set to 100. Also works with it set to 10.
> > 
> > Note that we had two timeouts without this.. Can you try
> > playing with the timeout in musb_core.c and see if that
> > helps?
> 
> 
> This patch works for me, also with autosuspend_delay set to 10.

Oh so to confirm, the $subject series patches + this one only fixes
your issue? So no more revert needed?

I think the musb_core timeout had to be 500 to idle the 2430 glue
layer phy also, but I need to recheck that. That should be a
separate patch and can be done later.

Regards,

Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: Could receive allow updating an existing subvolume?
From: Ian Kelling @ 2016-11-08 23:15 UTC (permalink / raw)
  To: Hugo Mills; +Cc: linux-btrfs
In-Reply-To: <20161108230057.GQ16645@carfax.org.uk>

On Tue, Nov 8, 2016, at 03:00 PM, Hugo Mills wrote:
> On Tue, Nov 08, 2016 at 02:48:56PM -0800, Ian Kelling wrote:
> > It seems to be an artificially imposed limitation which hurts which
> > hurts its usefulness. Let me know if this makes sense. If so, perhaps it
> > can be implemented eventually. It seems a bit obvious but I couldn't
> > find any existing discussion of it.
> 
>    It's not artificial -- it's ensuring safety of operation.

No, it doesn't ensure the subvolume is not modified, so it IS
artificial. I can still set the subvolume to rw before or probably
during the send and modify a file and mess things up.

> 
>    If the sender sends an incremental stream, that assumes an *exact*
> subvol state on the receiving side. If the subvol on the receiving
> side is modified, then the receive can fail.

No. The reading program never needs to have access to rw files if it's
reading from a read-only mountpoint while the subvolume is rw and
mounted as such elsewhere. And a reading program does not magically risk
writes.

> 
>    So, the assumption is that the reference subvol on the receiving
> side (equivalent to the -p subvol on the sending side) hasn't been
> changed since it was received. The same assumption applies to the -p
> subvol on the sending side.
> 
>    Now, receive is a fully userspace tool, so it would have to set the
> subvol to RW, then update it, then set it to RO. The subvol risks
> being modified by other processes during that window -- *particularly*
> if it's actively being read by those other processes.

No. The reading program never needs to have access to rw files if it's
reading from a read-only mountpoint while the subvolume is rw and
mounted as such elsewhere. And a reading program does not magically risk
writes.

> 
>    Note that this is still an issue with the current situation, but
> the expectation is that nothing's going to be actively reading that
> location at the time the receive is running. But, if something does go
> wrong with the receive, it's possible to abort and restart the
> process. If you're modifying an existing subvol, there's no
> recoverability if something goes wrong halfway through.

No. You could recover using the snapshot that I mentioned.

>    Hugo.

So my question still stands.

^ permalink raw reply

* Re: [REGRESSION] 4.9-rc4+ doesn't boot on my test box
From: Martin K. Petersen @ 2016-11-08 23:15 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-scsi, Kashyap Desai, Martin K. Petersen
In-Reply-To: <f0fa381c-e224-b660-27c4-dede4a5b543e@kernel.dk>

>>>>> "Jens" == Jens Axboe <axboe@kernel.dk> writes:

Jens> I wasted half a day on this, thinking it was something in my
Jens> 4.10 branches. But it turns out it is not, the regression is in
Jens> mainline.

Kashyap, have you tested the stable fix without the remainder of the
driver update in place?

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply

* Re: [PATCH v6 05/14] mmc: sdhci-msm: Update DLL reset sequence
From: Arnd Bergmann @ 2016-11-08 23:14 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Ritesh Harjani, ulf.hansson, linux-mmc, adrian.hunter, shawn.lin,
	devicetree, linux-clk, david.brown, andy.gross, linux-arm-msm,
	georgi.djakov, alex.lemberg, mateusz.nowak, Yuliy.Izrailov,
	asutoshd, kdorfman, david.griego, stummala, venkatg, rnayak,
	pramod.gurav
In-Reply-To: <20161108230622.GN16026@codeaurora.org>

On Tuesday, November 8, 2016 3:06:22 PM CET Stephen Boyd wrote:
> > +
> > +             config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG_2);
> > +             config &= ~(0xFF << 10);
> > +             config |= mclk_freq << 10;
> > +
> > +             writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG_2);
> > +             /* wait for 5us before enabling DLL clock */
> 
> Usually there's a barrier between writel_relaxed() and delay
> because we don't know when the writel will be posted out and the
> delay is there to wait for the operation to happen. Probably
> should change this to be a writel() instead.
> 

The barrier in writel() is not for posted writes, it is to synchronize
with memory accesses *before* the write.

In general, if you want to ensure that a write has made it to the
device, you need to read back from the same address (the specific
behavior may depend on the bus).

While in general, using the non-relaxed accessors should be the
default (and there should be a comment for each *_relaxed access),
but I don't think using writel() would let you skip the delay here.

	Arnd

^ permalink raw reply

* Re: [PATCH V5 2/3] ARM64 LPC: Add missing range exception for special ISA
From: Benjamin Herrenschmidt @ 2016-11-08 23:12 UTC (permalink / raw)
  To: Mark Rutland, zhichang.yuan
  Cc: catalin.marinas, will.deacon, robh+dt, bhelgaas, olof, arnd,
	linux-arm-kernel, lorenzo.pieralisi, linux-kernel, linuxarm,
	devicetree, linux-pci, linux-serial, minyard, liviu.dudau,
	zourongrong, john.garry, gabriele.paoloni, zhichang.yuan02,
	kantyzc, xuwei5, marc.zyngier
In-Reply-To: <20161108114953.GB15297@leverpostej>

On Tue, 2016-11-08 at 11:49 +0000, Mark Rutland wrote:
> 
> My understanding of ISA (which may be flawed) is that it's not part of
> the PCI host bridge, but rather on x86 it happens to share the IO space
> with PCI.

Sort-of. On some systems it actually goes through PCI and there's a
PCI->ISA bridge that uses substractive decoding to the legacy devices.

> So, how about this becomes:
> 
>   Hisilicon Hip06 SoCs implement a Low Pin Count (LPC) controller, which
>   provides access to some legacy ISA devices.
> 
> I believe that we could theoretically have multiple independent LPC/ISA
> busses, as is possible with PCI on !x86 systems. If the current ISA code
> assumes a singleton bus, I think that's something that needs to be fixed
> up more generically.
> 
> I don't see why we should need any architecture-specific code here. Why
> can we not fix up the ISA bus code in drivers/of/address.c such that it
> handles multiple ISA bus instances, and translates all sub-device
> addresses relative to the specific bus instance?

What in that code prevents that today ?

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH v7 01/17] ref-filter: implement %(if), %(then), and %(else) atoms
From: Jacob Keller @ 2016-11-08 23:13 UTC (permalink / raw)
  To: Karthik Nayak; +Cc: Git mailing list
In-Reply-To: <20161108201211.25213-2-Karthik.188@gmail.com>

On Tue, Nov 8, 2016 at 12:11 PM, Karthik Nayak <karthik.188@gmail.com> wrote:
> From: Karthik Nayak <karthik.188@gmail.com>
>
> Implement %(if), %(then) and %(else) atoms. Used as
> %(if)...%(then)...%(end) or %(if)...%(then)...%(else)...%(end). If the
> format string between %(if) and %(then) expands to an empty string, or
> to only whitespaces, then the whole %(if)...%(end) expands to the string
> following %(then). Otherwise, it expands to the string following
> %(else), if any. Nesting of this construct is possible.
>
> This is in preparation for porting over `git branch -l` to use
> ref-filter APIs for printing.
>
> Add Documentation and tests regarding the same.
>

Ok, so I have only one minor nit, but otherwise this looks quite good
to me. A few comments explaining my understanding, but only one
suggested
change which is really a minor nit and not worth re-rolling just for it.

Thanks,
Jake

> Mentored-by: Christian Couder <christian.couder@gmail.com>
> Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
> Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
> ---
>  Documentation/git-for-each-ref.txt |  40 +++++++++++
>  ref-filter.c                       | 133 +++++++++++++++++++++++++++++++++++--
>  t/t6302-for-each-ref-filter.sh     |  76 +++++++++++++++++++++
>  3 files changed, 242 insertions(+), 7 deletions(-)
>
> diff --git a/Documentation/git-for-each-ref.txt b/Documentation/git-for-each-ref.txt
> index f57e69b..fed8126 100644
> --- a/Documentation/git-for-each-ref.txt
> +++ b/Documentation/git-for-each-ref.txt
> @@ -146,6 +146,16 @@ align::
>         quoted, but if nested then only the topmost level performs
>         quoting.
>
> +if::
> +       Used as %(if)...%(then)...(%end) or
> +       %(if)...%(then)...%(else)...%(end).  If there is an atom with
> +       value or string literal after the %(if) then everything after
> +       the %(then) is printed, else if the %(else) atom is used, then
> +       everything after %(else) is printed. We ignore space when
> +       evaluating the string before %(then), this is useful when we
> +       use the %(HEAD) atom which prints either "*" or " " and we
> +       want to apply the 'if' condition only on the 'HEAD' ref.
> +
>  In addition to the above, for commit and tag objects, the header
>  field names (`tree`, `parent`, `object`, `type`, and `tag`) can
>  be used to specify the value in the header field.
> @@ -181,6 +191,20 @@ As a special case for the date-type fields, you may specify a format for
>  the date by adding `:` followed by date format name (see the
>  values the `--date` option to linkgit:git-rev-list[1] takes).
>
> +Some atoms like %(align) and %(if) always require a matching %(end).
> +We call them "opening atoms" and sometimes denote them as %($open).
> +
> +When a scripting language specific quoting is in effect (i.e. one of
> +`--shell`, `--perl`, `--python`, `--tcl` is used), except for opening
> +atoms, replacement from every %(atom) is quoted when and only when it
> +appears at the top-level (that is, when it appears outside
> +%($open)...%(end)).
> +
> +When a scripting language specific quoting is in effect, everything
> +between a top-level opening atom and its matching %(end) is evaluated
> +according to the semantics of the opening atom and its result is
> +quoted.
> +
>

Nice, I like the explanation above.

>  EXAMPLES
>  --------
> @@ -268,6 +292,22 @@ eval=`git for-each-ref --shell --format="$fmt" \
>  eval "$eval"
>  ------------
>
> +
> +An example to show the usage of %(if)...%(then)...%(else)...%(end).
> +This prefixes the current branch with a star.
> +
> +------------
> +git for-each-ref --format="%(if)%(HEAD)%(then)* %(else)  %(end)%(refname:short)" refs/heads/
> +------------
> +
> +
> +An example to show the usage of %(if)...%(then)...%(end).
> +This prints the authorname, if present.
> +
> +------------
> +git for-each-ref --format="%(refname)%(if)%(authorname)%(then) %(color:red)Authored by: %(authorname)%(end)"
> +------------
> +
>  SEE ALSO
>  --------
>  linkgit:git-show-ref[1]
> diff --git a/ref-filter.c b/ref-filter.c
> index d4c2931..8c183a0 100644
> --- a/ref-filter.c
> +++ b/ref-filter.c
> @@ -21,6 +21,12 @@ struct align {
>         unsigned int width;
>  };
>
> +struct if_then_else {
> +       unsigned int then_atom_seen : 1,
> +               else_atom_seen : 1,
> +               condition_satisfied : 1;
> +};
> +
>  /*
>   * An atom is a valid field atom listed below, possibly prefixed with
>   * a "*" to denote deref_tag().
> @@ -203,6 +209,9 @@ static struct {
>         { "color", FIELD_STR, color_atom_parser },
>         { "align", FIELD_STR, align_atom_parser },
>         { "end" },
> +       { "if" },
> +       { "then" },
> +       { "else" },
>  };
>
>  #define REF_FORMATTING_STATE_INIT  { 0, NULL }
> @@ -210,7 +219,7 @@ static struct {
>  struct ref_formatting_stack {
>         struct ref_formatting_stack *prev;
>         struct strbuf output;
> -       void (*at_end)(struct ref_formatting_stack *stack);
> +       void (*at_end)(struct ref_formatting_stack **stack);
>         void *at_end_data;
>  };
>
> @@ -343,13 +352,14 @@ static void pop_stack_element(struct ref_formatting_stack **stack)
>         *stack = prev;
>  }
>
> -static void end_align_handler(struct ref_formatting_stack *stack)
> +static void end_align_handler(struct ref_formatting_stack **stack)
>  {

So we now have to pass an array of stacks to the end_align_handler
instead? Ok. But for align this is simple since it just expects a
singleton.

> -       struct align *align = (struct align *)stack->at_end_data;
> +       struct ref_formatting_stack *cur = *stack;
> +       struct align *align = (struct align *)cur->at_end_data;
>         struct strbuf s = STRBUF_INIT;
>
> -       strbuf_utf8_align(&s, align->position, align->width, stack->output.buf);
> -       strbuf_swap(&stack->output, &s);
> +       strbuf_utf8_align(&s, align->position, align->width, cur->output.buf);
> +       strbuf_swap(&cur->output, &s);
>         strbuf_release(&s);
>  }
>
> @@ -363,6 +373,103 @@ static void align_atom_handler(struct atom_value *atomv, struct ref_formatting_s
>         new->at_end_data = &atomv->u.align;
>  }
>
> +static void if_then_else_handler(struct ref_formatting_stack **stack)
> +{
> +       struct ref_formatting_stack *cur = *stack;
> +       struct ref_formatting_stack *prev = cur->prev;
> +       struct if_then_else *if_then_else = (struct if_then_else *)cur->at_end_data;
> +
> +       if (!if_then_else->then_atom_seen)
> +               die(_("format: %%(if) atom used without a %%(then) atom"));
> +
> +       if (if_then_else->else_atom_seen) {
> +               /*
> +                * There is an %(else) atom: we need to drop one state from the
> +                * stack, either the %(else) branch if the condition is satisfied, or
> +                * the %(then) branch if it isn't.
> +                */
> +               if (if_then_else->condition_satisfied) {
> +                       strbuf_reset(&cur->output);
> +                       pop_stack_element(&cur);

So here, once we have a satisfied condition, we just drop the "else"
element entirely.

> +               } else {
> +                       strbuf_swap(&cur->output, &prev->output);
> +                       strbuf_reset(&cur->output);
> +                       pop_stack_element(&cur);

Otherwise, we swap our current value into the value of the previous
element, and then drop the current. This is a bit tricky, but it
works.

> +               }
> +       } else if (!if_then_else->condition_satisfied)

Minor nit. I'm not sure what standard we use here at Git, but
traditionally, I prefer to see { } blocks on all sections even if only
one of them needs it. (That is, only drop the braces when every
section is one line.) It also looks weird with a comment since it
appears as multiple lines to the reader. I think the braces improve
readability.

I don't know whether that's Git's code base standard or not, however.
It's not really worth a re-roll unless something else would need to
change.

> +               /*
> +                * No %(else) atom: just drop the %(then) branch if the
> +                * condition is not satisfied.
> +                */
> +               strbuf_reset(&cur->output);

Finally, if no else element, then we just reset the current pointer.

> +
> +       *stack = cur;
> +       free(if_then_else);
> +}
> +
> +static void if_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)
> +{
> +       struct ref_formatting_stack *new;
> +       struct if_then_else *if_then_else = xcalloc(sizeof(struct if_then_else), 1);
> +
> +       push_stack_element(&state->stack);
> +       new = state->stack;
> +       new->at_end = if_then_else_handler;
> +       new->at_end_data = if_then_else;
> +}
> +

Ok, so the new method is that to handle "if"s we push the sets onto
the stack and check their values. I like this, it makes things pretty
straight forward and simple. Allows for quite a bit of expression.

> +static int is_empty(const char *s)
> +{
> +       while (*s != '\0') {
> +               if (!isspace(*s))
> +                       return 0;
> +               s++;
> +       }
> +       return 1;
> +}
> +
> +static void then_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)
> +{
> +       struct ref_formatting_stack *cur = state->stack;
> +       struct if_then_else *if_then_else = NULL;
> +
> +       if (cur->at_end == if_then_else_handler)
> +               if_then_else = (struct if_then_else *)cur->at_end_data;
> +       if (!if_then_else)
> +               die(_("format: %%(then) atom used without an %%(if) atom"));
> +       if (if_then_else->then_atom_seen)
> +               die(_("format: %%(then) atom used more than once"));
> +       if (if_then_else->else_atom_seen)
> +               die(_("format: %%(then) atom used after %%(else)"));
> +       if_then_else->then_atom_seen = 1;
> +       /*
> +        * If there exists non-empty string between the 'if' and
> +        * 'then' atom then the 'if' condition is satisfied.
> +        */
> +       if (cur->output.len && !is_empty(cur->output.buf))
> +               if_then_else->condition_satisfied = 1;
> +       strbuf_reset(&cur->output);
> +}

So once we have a "%(then)" atom, we reset all the accumulated string
data we've gotten so far. Simple.

> +
> +static void else_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)
> +{
> +       struct ref_formatting_stack *prev = state->stack;
> +       struct if_then_else *if_then_else = NULL;
> +
> +       if (prev->at_end == if_then_else_handler)
> +               if_then_else = (struct if_then_else *)prev->at_end_data;
> +       if (!if_then_else)
> +               die(_("format: %%(else) atom used without an %%(if) atom"));
> +       if (!if_then_else->then_atom_seen)
> +               die(_("format: %%(else) atom used without a %%(then) atom"));
> +       if (if_then_else->else_atom_seen)
> +               die(_("format: %%(else) atom used more than once"));
> +       if_then_else->else_atom_seen = 1;
> +       push_stack_element(&state->stack);
> +       state->stack->at_end_data = prev->at_end_data;
> +       state->stack->at_end = prev->at_end;
> +}

So for an else atom, we basically create another stack element on top
of the current one. Nice.

> +
>  static void end_atom_handler(struct atom_value *atomv, struct ref_formatting_state *state)
>  {
>         struct ref_formatting_stack *current = state->stack;
> @@ -370,14 +477,17 @@ static void end_atom_handler(struct atom_value *atomv, struct ref_formatting_sta
>
>         if (!current->at_end)
>                 die(_("format: %%(end) atom used without corresponding atom"));
> -       current->at_end(current);
> +       current->at_end(&state->stack);
> +
> +       /*  Stack may have been popped within at_end(), hence reset the current pointer */
> +       current = state->stack;
>
>         /*
>          * Perform quote formatting when the stack element is that of
>          * a supporting atom. If nested then perform quote formatting
>          * only on the topmost supporting atom.
>          */
> -       if (!state->stack->prev->prev) {
> +       if (!current->prev->prev) {
>                 quote_formatting(&s, current->output.buf, state->quote_style);
>                 strbuf_swap(&current->output, &s);
>         }
> @@ -1029,6 +1139,15 @@ static void populate_value(struct ref_array_item *ref)
>                 } else if (!strcmp(name, "end")) {
>                         v->handler = end_atom_handler;
>                         continue;
> +               } else if (!strcmp(name, "if")) {
> +                       v->handler = if_atom_handler;
> +                       continue;
> +               } else if (!strcmp(name, "then")) {
> +                       v->handler = then_atom_handler;
> +                       continue;
> +               } else if (!strcmp(name, "else")) {
> +                       v->handler = else_atom_handler;
> +                       continue;
>                 } else
>                         continue;
>
> diff --git a/t/t6302-for-each-ref-filter.sh b/t/t6302-for-each-ref-filter.sh
> index d0ab09f..fed3013 100755
> --- a/t/t6302-for-each-ref-filter.sh
> +++ b/t/t6302-for-each-ref-filter.sh
> @@ -327,4 +327,80 @@ test_expect_success 'reverse version sort' '
>         test_cmp expect actual
>  '
>
> +test_expect_success 'improper usage of %(if), %(then), %(else) and %(end) atoms' '
> +       test_must_fail git for-each-ref --format="%(if)" &&
> +       test_must_fail git for-each-ref --format="%(then) %(end)" &&
> +       test_must_fail git for-each-ref --format="%(else) %(end)" &&
> +       test_must_fail git for-each-ref --format="%(if) %(else) %(end)" &&
> +       test_must_fail git for-each-ref --format="%(if) %(then) %(then) %(end)" &&
> +       test_must_fail git for-each-ref --format="%(then) %(else) %(end)" &&
> +       test_must_fail git for-each-ref --format="%(if) %(else) %(end)" &&
> +       test_must_fail git for-each-ref --format="%(if) %(then) %(else)" &&
> +       test_must_fail git for-each-ref --format="%(if) %(else) %(then) %(end)" &&
> +       test_must_fail git for-each-ref --format="%(if) %(then) %(else) %(else) %(end)" &&
> +       test_must_fail git for-each-ref --format="%(if) %(end)"
> +'
> +
> +test_expect_success 'check %(if)...%(then)...%(end) atoms' '
> +       git for-each-ref --format="%(refname)%(if)%(authorname)%(then) Author: %(authorname)%(end)" >actual &&
> +       cat >expect <<-\EOF &&
> +       refs/heads/master Author: A U Thor
> +       refs/heads/side Author: A U Thor
> +       refs/odd/spot Author: A U Thor
> +       refs/tags/annotated-tag
> +       refs/tags/doubly-annotated-tag
> +       refs/tags/doubly-signed-tag
> +       refs/tags/foo1.10 Author: A U Thor
> +       refs/tags/foo1.3 Author: A U Thor
> +       refs/tags/foo1.6 Author: A U Thor
> +       refs/tags/four Author: A U Thor
> +       refs/tags/one Author: A U Thor
> +       refs/tags/signed-tag
> +       refs/tags/three Author: A U Thor
> +       refs/tags/two Author: A U Thor
> +       EOF
> +       test_cmp expect actual
> +'
> +
> +test_expect_success 'check %(if)...%(then)...%(else)...%(end) atoms' '
> +       git for-each-ref --format="%(if)%(authorname)%(then)%(authorname)%(else)No author%(end): %(refname)" >actual &&
> +       cat >expect <<-\EOF &&
> +       A U Thor: refs/heads/master
> +       A U Thor: refs/heads/side
> +       A U Thor: refs/odd/spot
> +       No author: refs/tags/annotated-tag
> +       No author: refs/tags/doubly-annotated-tag
> +       No author: refs/tags/doubly-signed-tag
> +       A U Thor: refs/tags/foo1.10
> +       A U Thor: refs/tags/foo1.3
> +       A U Thor: refs/tags/foo1.6
> +       A U Thor: refs/tags/four
> +       A U Thor: refs/tags/one
> +       No author: refs/tags/signed-tag
> +       A U Thor: refs/tags/three
> +       A U Thor: refs/tags/two
> +       EOF
> +       test_cmp expect actual
> +'
> +test_expect_success 'ignore spaces in %(if) atom usage' '
> +       git for-each-ref --format="%(refname:short): %(if)%(HEAD)%(then)Head ref%(else)Not Head ref%(end)" >actual &&
> +       cat >expect <<-\EOF &&
> +       master: Head ref
> +       side: Not Head ref
> +       odd/spot: Not Head ref
> +       annotated-tag: Not Head ref
> +       doubly-annotated-tag: Not Head ref
> +       doubly-signed-tag: Not Head ref
> +       foo1.10: Not Head ref
> +       foo1.3: Not Head ref
> +       foo1.6: Not Head ref
> +       four: Not Head ref
> +       one: Not Head ref
> +       signed-tag: Not Head ref
> +       three: Not Head ref
> +       two: Not Head ref
> +       EOF
> +       test_cmp expect actual
> +'
> +
>  test_done
> --
> 2.10.2
>

^ permalink raw reply

* Re: [PATCH v6 05/14] mmc: sdhci-msm: Update DLL reset sequence
From: Arnd Bergmann @ 2016-11-08 23:14 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Ritesh Harjani, ulf.hansson-QSEj5FYQhm4dnm+yROfE0A,
	linux-mmc-u79uwXL29TY76Z2rM5mHXA,
	adrian.hunter-ral2JQCrhuEAvxtiuMwx3w,
	shawn.lin-TNX95d0MmH7DzftRWevZcw,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-clk-u79uwXL29TY76Z2rM5mHXA,
	david.brown-QSEj5FYQhm4dnm+yROfE0A,
	andy.gross-QSEj5FYQhm4dnm+yROfE0A,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA,
	georgi.djakov-QSEj5FYQhm4dnm+yROfE0A,
	alex.lemberg-XdAiOPVOjttBDgjK7y7TUQ,
	mateusz.nowak-ral2JQCrhuEAvxtiuMwx3w,
	Yuliy.Izrailov-XdAiOPVOjttBDgjK7y7TUQ,
	asutoshd-sgV2jX0FEOL9JmXXK+q4OQ, kdorfman-sgV2jX0FEOL9JmXXK+q4OQ,
	david.griego-QSEj5FYQhm4dnm+yROfE0A,
	stummala-sgV2jX0FEOL9JmXXK+q4OQ, venkatg-sgV2jX0FEOL9JmXXK+q4OQ,
	rnayak-sgV2jX0FEOL9JmXXK+q4OQ,
	pramod.gurav-QSEj5FYQhm4dnm+yROfE0A
In-Reply-To: <20161108230622.GN16026-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

On Tuesday, November 8, 2016 3:06:22 PM CET Stephen Boyd wrote:
> > +
> > +             config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG_2);
> > +             config &= ~(0xFF << 10);
> > +             config |= mclk_freq << 10;
> > +
> > +             writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG_2);
> > +             /* wait for 5us before enabling DLL clock */
> 
> Usually there's a barrier between writel_relaxed() and delay
> because we don't know when the writel will be posted out and the
> delay is there to wait for the operation to happen. Probably
> should change this to be a writel() instead.
> 

The barrier in writel() is not for posted writes, it is to synchronize
with memory accesses *before* the write.

In general, if you want to ensure that a write has made it to the
device, you need to read back from the same address (the specific
behavior may depend on the bus).

While in general, using the non-relaxed accessors should be the
default (and there should be a comment for each *_relaxed access),
but I don't think using writel() would let you skip the delay here.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH] net/netfilter: Fix use uninitialized warn in nft_range_eval()
From: Pablo Neira Ayuso @ 2016-11-08 23:13 UTC (permalink / raw)
  To: Shuah Khan
  Cc: kaber, kadlec, davem, netfilter-devel, coreteam, netdev,
	linux-kernel
In-Reply-To: <20161107154114.26803-4-shuahkh@osg.samsung.com>

On Mon, Nov 07, 2016 at 08:41:14AM -0700, Shuah Khan wrote:
> Fix the following warn:
> 
>    CC [M]  net/netfilter/nft_range.o
> 8601,8605c9105
>  net/netfilter/nft_range.c: In function ‘nft_range_eval’:
>  net/netfilter/nft_range.c:45:5: warning: ‘mismatch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
>    if (mismatch)
>       ^

You probably using an old tree snapshot? This was already fixed by:

commit d2e4d593516e877f1f6fb40031eb495f36606e16
Author: Arnd Bergmann <arnd@arndb.de>
Date:   Tue Oct 18 00:05:30 2016 +0200

    netfilter: nf_tables: avoid uninitialized variable warning

    The newly added nft_range_eval() function handles the two possible
    nft range operations, but as the compiler warning points out,
    any unexpected value would lead to the 'mismatch' variable being
    used without being initialized:


^ permalink raw reply

* [PATCH V5 2/3] ARM64 LPC: Add missing range exception for special ISA
From: Benjamin Herrenschmidt @ 2016-11-08 23:12 UTC (permalink / raw)
  To: linux-arm-kernel
In-Reply-To: <20161108114953.GB15297@leverpostej>

On Tue, 2016-11-08 at 11:49 +0000, Mark Rutland wrote:
> 
> My understanding of ISA (which may be flawed) is that it's not part of
> the PCI host bridge, but rather on x86 it happens to share the IO space
> with PCI.

Sort-of. On some systems it actually goes through PCI and there's a
PCI->ISA bridge that uses substractive decoding to the legacy devices.

> So, how about this becomes:
> 
> ? Hisilicon Hip06 SoCs implement a Low Pin Count (LPC) controller, which
> ? provides access to some legacy ISA devices.
> 
> I believe that we could theoretically have multiple independent LPC/ISA
> busses, as is possible with PCI on !x86 systems. If the current ISA code
> assumes a singleton bus, I think that's something that needs to be fixed
> up more generically.
> 
> I don't see why we should need any architecture-specific code here. Why
> can we not fix up the ISA bus code in drivers/of/address.c such that it
> handles multiple ISA bus instances, and translates all sub-device
> addresses relative to the specific bus instance?

What in that code prevents that today ?

Cheers,
Ben.

^ permalink raw reply

* Re: [PATCH V5 2/3] ARM64 LPC: Add missing range exception for special ISA
From: Benjamin Herrenschmidt @ 2016-11-08 23:12 UTC (permalink / raw)
  To: Mark Rutland, zhichang.yuan
  Cc: catalin.marinas-5wv7dgnIgG8, will.deacon-5wv7dgnIgG8,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A, bhelgaas-hpIqsD4AKlfQT0dZR+AlfA,
	olof-nZhT3qVonbNeoWH0uzbU5w, arnd-r2nGTMty4D4,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	lorenzo.pieralisi-5wv7dgnIgG8,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linuxarm-hv44wF8Li93QT0dZR+AlfA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-pci-u79uwXL29TY76Z2rM5mHXA,
	linux-serial-u79uwXL29TY76Z2rM5mHXA, minyard-HInyCGIudOg,
	liviu.dudau-5wv7dgnIgG8, zourongrong-Re5JQEeQqe8AvxtiuMwx3w,
	john.garry-hv44wF8Li93QT0dZR+AlfA,
	gabriele.paoloni-hv44wF8Li93QT0dZR+AlfA,
	zhichang.yuan02-Re5JQEeQqe8AvxtiuMwx3w, kantyzc-9Onoh4P/yGk,
	xuwei5-C8/M+/jPZTeaMJb+Lgu22Q, marc.zyngier-5wv7dgnIgG8
In-Reply-To: <20161108114953.GB15297@leverpostej>

On Tue, 2016-11-08 at 11:49 +0000, Mark Rutland wrote:
> 
> My understanding of ISA (which may be flawed) is that it's not part of
> the PCI host bridge, but rather on x86 it happens to share the IO space
> with PCI.

Sort-of. On some systems it actually goes through PCI and there's a
PCI->ISA bridge that uses substractive decoding to the legacy devices.

> So, how about this becomes:
> 
>   Hisilicon Hip06 SoCs implement a Low Pin Count (LPC) controller, which
>   provides access to some legacy ISA devices.
> 
> I believe that we could theoretically have multiple independent LPC/ISA
> busses, as is possible with PCI on !x86 systems. If the current ISA code
> assumes a singleton bus, I think that's something that needs to be fixed
> up more generically.
> 
> I don't see why we should need any architecture-specific code here. Why
> can we not fix up the ISA bus code in drivers/of/address.c such that it
> handles multiple ISA bus instances, and translates all sub-device
> addresses relative to the specific bus instance?

What in that code prevents that today ?

Cheers,
Ben.

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Re: [PATCH V5 2/3] ARM64 LPC: Add missing range exception for special ISA
From: Benjamin Herrenschmidt @ 2016-11-08 23:12 UTC (permalink / raw)
  To: Mark Rutland, zhichang.yuan
  Cc: gabriele.paoloni, catalin.marinas, will.deacon, linuxarm,
	lorenzo.pieralisi, arnd, xuwei5, linux-serial, linux-pci,
	devicetree, minyard, marc.zyngier, liviu.dudau, john.garry,
	zourongrong, robh+dt, bhelgaas, kantyzc, zhichang.yuan02,
	linux-arm-kernel, linux-kernel, olof
In-Reply-To: <20161108114953.GB15297@leverpostej>

T24gVHVlLCAyMDE2LTExLTA4IGF0IDExOjQ5ICswMDAwLCBNYXJrIFJ1dGxhbmQgd3JvdGU6Cj4g
Cj4gTXkgdW5kZXJzdGFuZGluZyBvZiBJU0EgKHdoaWNoIG1heSBiZSBmbGF3ZWQpIGlzIHRoYXQg
aXQncyBub3QgcGFydCBvZgo+IHRoZSBQQ0kgaG9zdCBicmlkZ2UsIGJ1dCByYXRoZXIgb24geDg2
IGl0IGhhcHBlbnMgdG8gc2hhcmUgdGhlIElPIHNwYWNlCj4gd2l0aCBQQ0kuCgpTb3J0LW9mLiBP
biBzb21lIHN5c3RlbXMgaXQgYWN0dWFsbHkgZ29lcyB0aHJvdWdoIFBDSSBhbmQgdGhlcmUncyBh
ClBDSS0+SVNBIGJyaWRnZSB0aGF0IHVzZXMgc3Vic3RyYWN0aXZlIGRlY29kaW5nIHRvIHRoZSBs
ZWdhY3kgZGV2aWNlcy4KCj4gU28sIGhvdyBhYm91dCB0aGlzIGJlY29tZXM6Cj4gCj4gwqAgSGlz
aWxpY29uIEhpcDA2IFNvQ3MgaW1wbGVtZW50IGEgTG93IFBpbiBDb3VudCAoTFBDKSBjb250cm9s
bGVyLCB3aGljaAo+IMKgIHByb3ZpZGVzIGFjY2VzcyB0byBzb21lIGxlZ2FjeSBJU0EgZGV2aWNl
cy4KPiAKPiBJIGJlbGlldmUgdGhhdCB3ZSBjb3VsZCB0aGVvcmV0aWNhbGx5IGhhdmUgbXVsdGlw
bGUgaW5kZXBlbmRlbnQgTFBDL0lTQQo+IGJ1c3NlcywgYXMgaXMgcG9zc2libGUgd2l0aCBQQ0kg
b24gIXg4NiBzeXN0ZW1zLiBJZiB0aGUgY3VycmVudCBJU0EgY29kZQo+IGFzc3VtZXMgYSBzaW5n
bGV0b24gYnVzLCBJIHRoaW5rIHRoYXQncyBzb21ldGhpbmcgdGhhdCBuZWVkcyB0byBiZSBmaXhl
ZAo+IHVwIG1vcmUgZ2VuZXJpY2FsbHkuCj4gCj4gSSBkb24ndCBzZWUgd2h5IHdlIHNob3VsZCBu
ZWVkIGFueSBhcmNoaXRlY3R1cmUtc3BlY2lmaWMgY29kZSBoZXJlLiBXaHkKPiBjYW4gd2Ugbm90
IGZpeCB1cCB0aGUgSVNBIGJ1cyBjb2RlIGluIGRyaXZlcnMvb2YvYWRkcmVzcy5jIHN1Y2ggdGhh
dCBpdAo+IGhhbmRsZXMgbXVsdGlwbGUgSVNBIGJ1cyBpbnN0YW5jZXMsIGFuZCB0cmFuc2xhdGVz
IGFsbCBzdWItZGV2aWNlCj4gYWRkcmVzc2VzIHJlbGF0aXZlIHRvIHRoZSBzcGVjaWZpYyBidXMg
aW5zdGFuY2U/CgpXaGF0IGluIHRoYXQgY29kZSBwcmV2ZW50cyB0aGF0IHRvZGF5ID8KCkNoZWVy
cywKQmVuLgoKCl9fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19f
CmxpbnV4LWFybS1rZXJuZWwgbWFpbGluZyBsaXN0CmxpbnV4LWFybS1rZXJuZWxAbGlzdHMuaW5m
cmFkZWFkLm9yZwpodHRwOi8vbGlzdHMuaW5mcmFkZWFkLm9yZy9tYWlsbWFuL2xpc3RpbmZvL2xp
bnV4LWFybS1rZXJuZWwK

^ permalink raw reply

* Re: [PATCH] checkpatch: fix uninitialized var when run with --no-tree
From: Andrew Morton @ 2016-11-08 23:10 UTC (permalink / raw)
  To: Brian Norris
  Cc: Andy Whitcroft, Joe Perches, linux-kernel, Linus Torvalds,
	SF Markus Elfring, Jerome Forissier
In-Reply-To: <20161029023609.GA48401@google.com>

On Fri, 28 Oct 2016 19:36:09 -0700 Brian Norris <computersforpeace@gmail.com> wrote:

> On Fri, Oct 28, 2016 at 07:26:31PM -0700, Brian Norris wrote:
> > From: Brian Norris <computersforpeace@gmail.com>
> > 
> > If checkpatch.pl gets copied out of the tree, --no-tree shouldn't start
> > complaining:
> > 
> >   Use of uninitialized value $root in concatenation (.) or string at
> >   /path/to/checkpatch.pl line 764.
> > 
> > Let's just give the safe answer instead -- don't warn about "obsolete"
> > files.
> > 
> > Fixes: 85b0ee18bbf8 ("checkpatch: see if modified files are marked obsolete in MAINTAINERS")
> > Signed-off-by: Brian Norris <computersforpeace@gmail.com>
> > ---
> > This is a 4.9-rc1 regression
> > 
> >  scripts/checkpatch.pl | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> > index a8368d1c4348..c8cd643dbc6f 100755
> > --- a/scripts/checkpatch.pl
> > +++ b/scripts/checkpatch.pl
> > @@ -761,6 +761,8 @@ sub seed_camelcase_file {
> >  sub is_maintained_obsolete {
> >  	my ($filename) = @_;
> >  
> > +	return 0 if (!$tree);
> 
> Actually, I'm torn on this. It looks really odd to check for !$tree
> here, but it's the only supported case where $root shouldn't be defined.
> Maybe (!defined $root) is a better test? (Sorry, I did a double-take on
> this after I sent it.)
> 
> Both would be equally correct, but I suppose the latter would be
> clearer. I'll send v2.

I already have the below.  Good enough?

From: Jerome Forissier <jerome.forissier@linaro.org>
Subject: checkpatch: don't try to get maintained status when --no-tree is given

Fixes the following warning:
Use of uninitialized value $root in concatenation (.) or string at /path/to/checkpatch.pl line 764.

Link: http://lkml.kernel.org/r/1476719709-16668-1-git-send-email-jerome.forissier@linaro.org
Signed-off-by: Jerome Forissier <jerome.forissier@linaro.org>
Acked-by: Joe Perches <joe@perches.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 scripts/checkpatch.pl |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN scripts/checkpatch.pl~checkpatch-dont-try-to-get-maintained-status-when-no-tree-is-given scripts/checkpatch.pl
--- a/scripts/checkpatch.pl~checkpatch-dont-try-to-get-maintained-status-when-no-tree-is-given
+++ a/scripts/checkpatch.pl
@@ -761,7 +761,7 @@ sub seed_camelcase_file {
 sub is_maintained_obsolete {
 	my ($filename) = @_;
 
-	return 0 if (!(-e "$root/scripts/get_maintainer.pl"));
+	return 0 if (!$tree || !(-e "$root/scripts/get_maintainer.pl"));
 
 	my $status = `perl $root/scripts/get_maintainer.pl --status --nom --nol --nogit --nogit-fallback -f $filename 2>&1`;
 
_

^ permalink raw reply

* [Buildroot] [PATCH] DEVELOPERS: add Cyril Bur to PowerPC
From: Cyril Bur @ 2016-11-08 23:09 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Cyril Bur <cyrilbur@gmail.com>
---
 DEVELOPERS | 1 +
 1 file changed, 1 insertion(+)

diff --git a/DEVELOPERS b/DEVELOPERS
index bade9f4..9035d22 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -338,6 +338,7 @@ N:	C?dric Ch?pied <cedric.chepied@gmail.com>
 F:	package/znc/
 
 N:	Cyril Bur <cyrilbur@gmail.com>
+F:	arch/Config.in.powerpc
 F:	package/kvm-unit-tests
 
 N:	Dagg Stompler <daggs@gmx.com>
-- 
2.10.2

^ permalink raw reply related

* Re: [PATCH nf] netfilter: conntrack: fix CT target for UNSPEC helpers
From: Pablo Neira Ayuso @ 2016-11-08 23:07 UTC (permalink / raw)
  To: Florian Westphal; +Cc: netfilter-devel, twoerner
In-Reply-To: <1478180682-3776-1-git-send-email-fw@strlen.de>

On Thu, Nov 03, 2016 at 02:44:42PM +0100, Florian Westphal wrote:
> Thomas reports its not possible to attach the H.245 helper:
> 
> iptables -t raw -A PREROUTING -p udp -j CT --helper H.245
> iptables: No chain/target/match by that name.
> xt_CT: No such helper "H.245"
> 
> This is because H.245 registers as NFPROTO_UNSPEC, but the CT target
> passes NFPROTO_IPV4/IPV6 to nf_conntrack_helper_try_module_get.
> 
> We should treat UNSPEC as wildcard and ignore the l3num instead.

Also applied, thanks.

^ permalink raw reply

* Re: [PATCH v6 04/14] mmc: sdhci-msm: Change poor style writel/readl of registers
From: Stephen Boyd @ 2016-11-08 23:07 UTC (permalink / raw)
  To: Ritesh Harjani
  Cc: ulf.hansson, linux-mmc, adrian.hunter, shawn.lin, devicetree,
	linux-clk, david.brown, andy.gross, linux-arm-msm, georgi.djakov,
	alex.lemberg, mateusz.nowak, Yuliy.Izrailov, asutoshd, kdorfman,
	david.griego, stummala, venkatg, rnayak, pramod.gurav
In-Reply-To: <1478517877-23733-5-git-send-email-riteshh@codeaurora.org>

On 11/07, Ritesh Harjani wrote:
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 8ef44a2a..42f42aa 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -137,8 +137,9 @@ static int msm_config_cm_dll_phase(struct sdhci_host *host, u8 phase)
>  	writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG);
>  
>  	/* Set CK_OUT_EN bit of DLL_CONFIG register to 1. */
> -	writel_relaxed((readl_relaxed(host->ioaddr + CORE_DLL_CONFIG)
> -			| CORE_CK_OUT_EN), host->ioaddr + CORE_DLL_CONFIG);
> +	config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG);
> +	config |= CORE_CK_OUT_EN;
> +	writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG);
>  
>  	/* Wait until CK_OUT_EN bit of DLL_CONFIG register becomes '1' */
>  	rc = msm_dll_poll_ck_out_en(host, 1);
> @@ -305,6 +306,7 @@ static int msm_init_cm_dll(struct sdhci_host *host)
>  	struct mmc_host *mmc = host->mmc;
>  	int wait_cnt = 50;
>  	unsigned long flags;
> +	u32 config = 0;

It needs to be initialized?

>  
>  	spin_lock_irqsave(&host->lock, flags);
>  
> @@ -313,33 +315,40 @@ static int msm_init_cm_dll(struct sdhci_host *host)
>  	 * tuning is in progress. Keeping PWRSAVE ON may
>  	 * turn off the clock.
>  	 */
> -	writel_relaxed((readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC)
> -			& ~CORE_CLK_PWRSAVE), host->ioaddr + CORE_VENDOR_SPEC);
> +	config = readl_relaxed(host->ioaddr + CORE_VENDOR_SPEC);

It's written here unconditionally though?

> +	config &= ~CORE_CLK_PWRSAVE;

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply

* + coredump-clarify-unsafe-core_pattern-warning.patch added to -mm tree
From: akpm @ 2016-11-08 23:07 UTC (permalink / raw)
  To: adobriyan, keescook, mm-commits


The patch titled
     Subject: coredump: clarify "unsafe core_pattern" warning
has been added to the -mm tree.  Its filename is
     coredump-clarify-unsafe-core_pattern-warning.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/coredump-clarify-unsafe-core_pattern-warning.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/coredump-clarify-unsafe-core_pattern-warning.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Alexey Dobriyan <adobriyan@gmail.com>
Subject: coredump: clarify "unsafe core_pattern" warning

I was amused to find "unsafe core_pattern" warning having these lines in
/etc/sysctl.conf:

	fs.suid_dumpable=2
	kernel.core_pattern=/core/core-%e-%p-%E
	kernel.core_uses_pid=0

Turns out kernel is formally right.  Default core_pattern is just "core",
which doesn't qualify for secure path while setting suid.dumpable.

Hint admins about solution, clarify sysctl names, delete unnecessary '\'
characters (string literals are concatenated regardless) and reformat for
easier grepping.

Link: http://lkml.kernel.org/r/20161029152124.GA1258@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Acked-by: Kees Cook <keescook@chromium.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 kernel/sysctl.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff -puN kernel/sysctl.c~coredump-clarify-unsafe-core_pattern-warning kernel/sysctl.c
--- a/kernel/sysctl.c~coredump-clarify-unsafe-core_pattern-warning
+++ a/kernel/sysctl.c
@@ -2403,9 +2403,11 @@ static void validate_coredump_safety(voi
 #ifdef CONFIG_COREDUMP
 	if (suid_dumpable == SUID_DUMP_ROOT &&
 	    core_pattern[0] != '/' && core_pattern[0] != '|') {
-		printk(KERN_WARNING "Unsafe core_pattern used with "\
-			"suid_dumpable=2. Pipe handler or fully qualified "\
-			"core dump path required.\n");
+		printk(KERN_WARNING
+"Unsafe core_pattern used with fs.suid_dumpable=2.\n"
+"Pipe handler or fully qualified core dump path required.\n"
+"Set kernel.core_pattern before fs.suid_dumpable.\n"
+		);
 	}
 #endif
 }
_

Patches currently in -mm which might be from adobriyan@gmail.com are

scripts-bloat-o-meter-fix-sigpipe.patch
kbuild-simpler-generation-of-assembly-constants.patch
proc-make-struct-pid_entry-len-unsigned.patch
proc-make-struct-struct-map_files_info-len-unsigned-int.patch
proc-just-list_del-struct-pde_opener.patch
proc-fix-type-of-struct-pde_opener-closing-field.patch
proc-kmalloc-struct-pde_opener.patch
proc-tweak-comments-about-2-stage-open-and-everything.patch
coredump-clarify-unsafe-core_pattern-warning.patch


^ permalink raw reply

* [patch] mm, slab: faster active and free stats
From: David Rientjes @ 2016-11-08 23:06 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Greg Thelen, Aruna Ramakrishna, Christoph Lameter, Joonsoo Kim,
	linux-kernel, linux-mm

From: Greg Thelen <gthelen@google.com>

Reading /proc/slabinfo or monitoring slabtop(1) can become very expensive
if there are many slab caches and if there are very lengthy per-node
partial and/or free lists.

Commit 07a63c41fa1f ("mm/slab: improve performance of gathering slabinfo
stats") addressed the per-node full lists which showed a significant
improvement when no objects were freed.  This patch has the same
motivation and optimizes the remainder of the usecases where there are
very lengthy partial and free lists.

This patch maintains per-node active_slabs (full and partial) and
free_slabs rather than iterating the lists at runtime when reading
/proc/slabinfo.

[rientjes@google.com: changelog]
Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 mm/slab.c | 117 +++++++++++++++++++++++++-------------------------------------
 mm/slab.h |   3 +-
 2 files changed, 49 insertions(+), 71 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -227,13 +227,14 @@ static void kmem_cache_node_init(struct kmem_cache_node *parent)
 	INIT_LIST_HEAD(&parent->slabs_full);
 	INIT_LIST_HEAD(&parent->slabs_partial);
 	INIT_LIST_HEAD(&parent->slabs_free);
+	parent->active_slabs = 0;
+	parent->free_slabs = 0;
 	parent->shared = NULL;
 	parent->alien = NULL;
 	parent->colour_next = 0;
 	spin_lock_init(&parent->list_lock);
 	parent->free_objects = 0;
 	parent->free_touched = 0;
-	parent->num_slabs = 0;
 }
 
 #define MAKE_LIST(cachep, listp, slab, nodeid)				\
@@ -1366,7 +1367,6 @@ slab_out_of_memory(struct kmem_cache *cachep, gfp_t gfpflags, int nodeid)
 {
 #if DEBUG
 	struct kmem_cache_node *n;
-	struct page *page;
 	unsigned long flags;
 	int node;
 	static DEFINE_RATELIMIT_STATE(slab_oom_rs, DEFAULT_RATELIMIT_INTERVAL,
@@ -1381,32 +1381,20 @@ slab_out_of_memory(struct kmem_cache *cachep, gfp_t gfpflags, int nodeid)
 		cachep->name, cachep->size, cachep->gfporder);
 
 	for_each_kmem_cache_node(cachep, node, n) {
-		unsigned long active_objs = 0, num_objs = 0, free_objects = 0;
-		unsigned long active_slabs = 0, num_slabs = 0;
-		unsigned long num_slabs_partial = 0, num_slabs_free = 0;
-		unsigned long num_slabs_full;
+		unsigned long active_objs = 0, free_objs = 0;
+		unsigned long active_slabs, num_slabs;
 
 		spin_lock_irqsave(&n->list_lock, flags);
-		num_slabs = n->num_slabs;
-		list_for_each_entry(page, &n->slabs_partial, lru) {
-			active_objs += page->active;
-			num_slabs_partial++;
-		}
-		list_for_each_entry(page, &n->slabs_free, lru)
-			num_slabs_free++;
+		active_slabs = n->active_slabs;
+		num_slabs = active_slabs + n->free_slabs;
 
-		free_objects += n->free_objects;
+		active_objs += (num_slabs * cachep->num) - n->free_objects;
+		free_objs += n->free_objects;
 		spin_unlock_irqrestore(&n->list_lock, flags);
 
-		num_objs = num_slabs * cachep->num;
-		active_slabs = num_slabs - num_slabs_free;
-		num_slabs_full = num_slabs -
-			(num_slabs_partial + num_slabs_free);
-		active_objs += (num_slabs_full * cachep->num);
-
 		pr_warn("  node %d: slabs: %ld/%ld, objs: %ld/%ld, free: %ld\n",
-			node, active_slabs, num_slabs, active_objs, num_objs,
-			free_objects);
+			node, active_slabs, num_slabs, active_objs,
+			num_slabs * cachep->num, free_objs);
 	}
 #endif
 }
@@ -2318,7 +2306,7 @@ static int drain_freelist(struct kmem_cache *cache,
 
 		page = list_entry(p, struct page, lru);
 		list_del(&page->lru);
-		n->num_slabs--;
+		n->free_slabs--;
 		/*
 		 * Safe to drop the lock. The slab is no longer linked
 		 * to the cache.
@@ -2753,12 +2741,14 @@ static void cache_grow_end(struct kmem_cache *cachep, struct page *page)
 	n = get_node(cachep, page_to_nid(page));
 
 	spin_lock(&n->list_lock);
-	if (!page->active)
+	if (!page->active) {
 		list_add_tail(&page->lru, &(n->slabs_free));
-	else
+		n->free_slabs++;
+	} else {
 		fixup_slab_list(cachep, n, page, &list);
+		n->active_slabs++;
+	}
 
-	n->num_slabs++;
 	STATS_INC_GROWN(cachep);
 	n->free_objects += cachep->num - page->active;
 	spin_unlock(&n->list_lock);
@@ -2884,7 +2874,7 @@ static inline void fixup_slab_list(struct kmem_cache *cachep,
 
 /* Try to find non-pfmemalloc slab if needed */
 static noinline struct page *get_valid_first_slab(struct kmem_cache_node *n,
-					struct page *page, bool pfmemalloc)
+			struct page *page, bool *page_is_free, bool pfmemalloc)
 {
 	if (!page)
 		return NULL;
@@ -2903,9 +2893,11 @@ static noinline struct page *get_valid_first_slab(struct kmem_cache_node *n,
 
 	/* Move pfmemalloc slab to the end of list to speed up next search */
 	list_del(&page->lru);
-	if (!page->active)
+	if (*page_is_free) {
+		WARN_ON(page->active);
 		list_add_tail(&page->lru, &n->slabs_free);
-	else
+		*page_is_free = false;
+	} else
 		list_add_tail(&page->lru, &n->slabs_partial);
 
 	list_for_each_entry(page, &n->slabs_partial, lru) {
@@ -2913,9 +2905,12 @@ static noinline struct page *get_valid_first_slab(struct kmem_cache_node *n,
 			return page;
 	}
 
+	n->free_touched = 1;
 	list_for_each_entry(page, &n->slabs_free, lru) {
-		if (!PageSlabPfmemalloc(page))
+		if (!PageSlabPfmemalloc(page)) {
+			*page_is_free = true;
 			return page;
+		}
 	}
 
 	return NULL;
@@ -2924,17 +2919,26 @@ static noinline struct page *get_valid_first_slab(struct kmem_cache_node *n,
 static struct page *get_first_slab(struct kmem_cache_node *n, bool pfmemalloc)
 {
 	struct page *page;
+	bool page_is_free = false;
 
+	assert_spin_locked(&n->list_lock);
 	page = list_first_entry_or_null(&n->slabs_partial,
 			struct page, lru);
 	if (!page) {
 		n->free_touched = 1;
 		page = list_first_entry_or_null(&n->slabs_free,
 				struct page, lru);
+		if (page)
+			page_is_free = true;
 	}
 
 	if (sk_memalloc_socks())
-		return get_valid_first_slab(n, page, pfmemalloc);
+		page = get_valid_first_slab(n, page, &page_is_free, pfmemalloc);
+
+	if (page && page_is_free) {
+		n->active_slabs++;
+		n->free_slabs--;
+	}
 
 	return page;
 }
@@ -3434,9 +3438,11 @@ static void free_block(struct kmem_cache *cachep, void **objpp,
 		STATS_DEC_ACTIVE(cachep);
 
 		/* fixup slab chains */
-		if (page->active == 0)
+		if (page->active == 0) {
 			list_add(&page->lru, &n->slabs_free);
-		else {
+			n->free_slabs++;
+			n->active_slabs--;
+		} else {
 			/* Unconditionally move a slab to the end of the
 			 * partial list on free - maximum time for the
 			 * other objects to be freed, too.
@@ -3450,7 +3456,7 @@ static void free_block(struct kmem_cache *cachep, void **objpp,
 
 		page = list_last_entry(&n->slabs_free, struct page, lru);
 		list_move(&page->lru, list);
-		n->num_slabs--;
+		n->free_slabs--;
 	}
 }
 
@@ -4102,43 +4108,21 @@ static void cache_reap(struct work_struct *w)
 #ifdef CONFIG_SLABINFO
 void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo)
 {
-	struct page *page;
-	unsigned long active_objs;
-	unsigned long num_objs;
-	unsigned long active_slabs = 0;
-	unsigned long num_slabs, free_objects = 0, shared_avail = 0;
-	unsigned long num_slabs_partial = 0, num_slabs_free = 0;
-	unsigned long num_slabs_full = 0;
-	const char *name;
-	char *error = NULL;
+	unsigned long active_objs, num_objs, active_slabs;
+	unsigned long num_slabs = 0, free_objs = 0, shared_avail = 0;
+	unsigned long num_slabs_free = 0;
 	int node;
 	struct kmem_cache_node *n;
 
-	active_objs = 0;
-	num_slabs = 0;
 	for_each_kmem_cache_node(cachep, node, n) {
-
 		check_irq_on();
 		spin_lock_irq(&n->list_lock);
 
-		num_slabs += n->num_slabs;
+		num_slabs += n->active_slabs + n->free_slabs;
+		num_slabs_free += n->free_slabs;
 
-		list_for_each_entry(page, &n->slabs_partial, lru) {
-			if (page->active == cachep->num && !error)
-				error = "slabs_partial accounting error";
-			if (!page->active && !error)
-				error = "slabs_partial accounting error";
-			active_objs += page->active;
-			num_slabs_partial++;
-		}
+		free_objs += n->free_objects;
 
-		list_for_each_entry(page, &n->slabs_free, lru) {
-			if (page->active && !error)
-				error = "slabs_free accounting error";
-			num_slabs_free++;
-		}
-
-		free_objects += n->free_objects;
 		if (n->shared)
 			shared_avail += n->shared->avail;
 
@@ -4146,15 +4130,8 @@ void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo)
 	}
 	num_objs = num_slabs * cachep->num;
 	active_slabs = num_slabs - num_slabs_free;
-	num_slabs_full = num_slabs - (num_slabs_partial + num_slabs_free);
-	active_objs += (num_slabs_full * cachep->num);
 
-	if (num_objs - active_objs != free_objects && !error)
-		error = "free_objects accounting error";
-
-	name = cachep->name;
-	if (error)
-		pr_err("slab: cache %s error: %s\n", name, error);
+	active_objs = num_objs - free_objs;
 
 	sinfo->active_objs = active_objs;
 	sinfo->num_objs = num_objs;
diff --git a/mm/slab.h b/mm/slab.h
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -432,7 +432,8 @@ struct kmem_cache_node {
 	struct list_head slabs_partial;	/* partial list first, better asm code */
 	struct list_head slabs_full;
 	struct list_head slabs_free;
-	unsigned long num_slabs;
+	unsigned long active_slabs;	/* length of slabs_partial+slabs_full */
+	unsigned long free_slabs;	/* length of slabs_free */
 	unsigned long free_objects;
 	unsigned int free_limit;
 	unsigned int colour_next;	/* Per-node cache coloring */

^ permalink raw reply

* [patch] mm, slab: faster active and free stats
From: David Rientjes @ 2016-11-08 23:06 UTC (permalink / raw)
  To: Andrew Morton
  Cc: Greg Thelen, Aruna Ramakrishna, Christoph Lameter, Joonsoo Kim,
	linux-kernel, linux-mm

From: Greg Thelen <gthelen@google.com>

Reading /proc/slabinfo or monitoring slabtop(1) can become very expensive
if there are many slab caches and if there are very lengthy per-node
partial and/or free lists.

Commit 07a63c41fa1f ("mm/slab: improve performance of gathering slabinfo
stats") addressed the per-node full lists which showed a significant
improvement when no objects were freed.  This patch has the same
motivation and optimizes the remainder of the usecases where there are
very lengthy partial and free lists.

This patch maintains per-node active_slabs (full and partial) and
free_slabs rather than iterating the lists at runtime when reading
/proc/slabinfo.

[rientjes@google.com: changelog]
Signed-off-by: Greg Thelen <gthelen@google.com>
Signed-off-by: David Rientjes <rientjes@google.com>
---
 mm/slab.c | 117 +++++++++++++++++++++++++-------------------------------------
 mm/slab.h |   3 +-
 2 files changed, 49 insertions(+), 71 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -227,13 +227,14 @@ static void kmem_cache_node_init(struct kmem_cache_node *parent)
 	INIT_LIST_HEAD(&parent->slabs_full);
 	INIT_LIST_HEAD(&parent->slabs_partial);
 	INIT_LIST_HEAD(&parent->slabs_free);
+	parent->active_slabs = 0;
+	parent->free_slabs = 0;
 	parent->shared = NULL;
 	parent->alien = NULL;
 	parent->colour_next = 0;
 	spin_lock_init(&parent->list_lock);
 	parent->free_objects = 0;
 	parent->free_touched = 0;
-	parent->num_slabs = 0;
 }
 
 #define MAKE_LIST(cachep, listp, slab, nodeid)				\
@@ -1366,7 +1367,6 @@ slab_out_of_memory(struct kmem_cache *cachep, gfp_t gfpflags, int nodeid)
 {
 #if DEBUG
 	struct kmem_cache_node *n;
-	struct page *page;
 	unsigned long flags;
 	int node;
 	static DEFINE_RATELIMIT_STATE(slab_oom_rs, DEFAULT_RATELIMIT_INTERVAL,
@@ -1381,32 +1381,20 @@ slab_out_of_memory(struct kmem_cache *cachep, gfp_t gfpflags, int nodeid)
 		cachep->name, cachep->size, cachep->gfporder);
 
 	for_each_kmem_cache_node(cachep, node, n) {
-		unsigned long active_objs = 0, num_objs = 0, free_objects = 0;
-		unsigned long active_slabs = 0, num_slabs = 0;
-		unsigned long num_slabs_partial = 0, num_slabs_free = 0;
-		unsigned long num_slabs_full;
+		unsigned long active_objs = 0, free_objs = 0;
+		unsigned long active_slabs, num_slabs;
 
 		spin_lock_irqsave(&n->list_lock, flags);
-		num_slabs = n->num_slabs;
-		list_for_each_entry(page, &n->slabs_partial, lru) {
-			active_objs += page->active;
-			num_slabs_partial++;
-		}
-		list_for_each_entry(page, &n->slabs_free, lru)
-			num_slabs_free++;
+		active_slabs = n->active_slabs;
+		num_slabs = active_slabs + n->free_slabs;
 
-		free_objects += n->free_objects;
+		active_objs += (num_slabs * cachep->num) - n->free_objects;
+		free_objs += n->free_objects;
 		spin_unlock_irqrestore(&n->list_lock, flags);
 
-		num_objs = num_slabs * cachep->num;
-		active_slabs = num_slabs - num_slabs_free;
-		num_slabs_full = num_slabs -
-			(num_slabs_partial + num_slabs_free);
-		active_objs += (num_slabs_full * cachep->num);
-
 		pr_warn("  node %d: slabs: %ld/%ld, objs: %ld/%ld, free: %ld\n",
-			node, active_slabs, num_slabs, active_objs, num_objs,
-			free_objects);
+			node, active_slabs, num_slabs, active_objs,
+			num_slabs * cachep->num, free_objs);
 	}
 #endif
 }
@@ -2318,7 +2306,7 @@ static int drain_freelist(struct kmem_cache *cache,
 
 		page = list_entry(p, struct page, lru);
 		list_del(&page->lru);
-		n->num_slabs--;
+		n->free_slabs--;
 		/*
 		 * Safe to drop the lock. The slab is no longer linked
 		 * to the cache.
@@ -2753,12 +2741,14 @@ static void cache_grow_end(struct kmem_cache *cachep, struct page *page)
 	n = get_node(cachep, page_to_nid(page));
 
 	spin_lock(&n->list_lock);
-	if (!page->active)
+	if (!page->active) {
 		list_add_tail(&page->lru, &(n->slabs_free));
-	else
+		n->free_slabs++;
+	} else {
 		fixup_slab_list(cachep, n, page, &list);
+		n->active_slabs++;
+	}
 
-	n->num_slabs++;
 	STATS_INC_GROWN(cachep);
 	n->free_objects += cachep->num - page->active;
 	spin_unlock(&n->list_lock);
@@ -2884,7 +2874,7 @@ static inline void fixup_slab_list(struct kmem_cache *cachep,
 
 /* Try to find non-pfmemalloc slab if needed */
 static noinline struct page *get_valid_first_slab(struct kmem_cache_node *n,
-					struct page *page, bool pfmemalloc)
+			struct page *page, bool *page_is_free, bool pfmemalloc)
 {
 	if (!page)
 		return NULL;
@@ -2903,9 +2893,11 @@ static noinline struct page *get_valid_first_slab(struct kmem_cache_node *n,
 
 	/* Move pfmemalloc slab to the end of list to speed up next search */
 	list_del(&page->lru);
-	if (!page->active)
+	if (*page_is_free) {
+		WARN_ON(page->active);
 		list_add_tail(&page->lru, &n->slabs_free);
-	else
+		*page_is_free = false;
+	} else
 		list_add_tail(&page->lru, &n->slabs_partial);
 
 	list_for_each_entry(page, &n->slabs_partial, lru) {
@@ -2913,9 +2905,12 @@ static noinline struct page *get_valid_first_slab(struct kmem_cache_node *n,
 			return page;
 	}
 
+	n->free_touched = 1;
 	list_for_each_entry(page, &n->slabs_free, lru) {
-		if (!PageSlabPfmemalloc(page))
+		if (!PageSlabPfmemalloc(page)) {
+			*page_is_free = true;
 			return page;
+		}
 	}
 
 	return NULL;
@@ -2924,17 +2919,26 @@ static noinline struct page *get_valid_first_slab(struct kmem_cache_node *n,
 static struct page *get_first_slab(struct kmem_cache_node *n, bool pfmemalloc)
 {
 	struct page *page;
+	bool page_is_free = false;
 
+	assert_spin_locked(&n->list_lock);
 	page = list_first_entry_or_null(&n->slabs_partial,
 			struct page, lru);
 	if (!page) {
 		n->free_touched = 1;
 		page = list_first_entry_or_null(&n->slabs_free,
 				struct page, lru);
+		if (page)
+			page_is_free = true;
 	}
 
 	if (sk_memalloc_socks())
-		return get_valid_first_slab(n, page, pfmemalloc);
+		page = get_valid_first_slab(n, page, &page_is_free, pfmemalloc);
+
+	if (page && page_is_free) {
+		n->active_slabs++;
+		n->free_slabs--;
+	}
 
 	return page;
 }
@@ -3434,9 +3438,11 @@ static void free_block(struct kmem_cache *cachep, void **objpp,
 		STATS_DEC_ACTIVE(cachep);
 
 		/* fixup slab chains */
-		if (page->active == 0)
+		if (page->active == 0) {
 			list_add(&page->lru, &n->slabs_free);
-		else {
+			n->free_slabs++;
+			n->active_slabs--;
+		} else {
 			/* Unconditionally move a slab to the end of the
 			 * partial list on free - maximum time for the
 			 * other objects to be freed, too.
@@ -3450,7 +3456,7 @@ static void free_block(struct kmem_cache *cachep, void **objpp,
 
 		page = list_last_entry(&n->slabs_free, struct page, lru);
 		list_move(&page->lru, list);
-		n->num_slabs--;
+		n->free_slabs--;
 	}
 }
 
@@ -4102,43 +4108,21 @@ static void cache_reap(struct work_struct *w)
 #ifdef CONFIG_SLABINFO
 void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo)
 {
-	struct page *page;
-	unsigned long active_objs;
-	unsigned long num_objs;
-	unsigned long active_slabs = 0;
-	unsigned long num_slabs, free_objects = 0, shared_avail = 0;
-	unsigned long num_slabs_partial = 0, num_slabs_free = 0;
-	unsigned long num_slabs_full = 0;
-	const char *name;
-	char *error = NULL;
+	unsigned long active_objs, num_objs, active_slabs;
+	unsigned long num_slabs = 0, free_objs = 0, shared_avail = 0;
+	unsigned long num_slabs_free = 0;
 	int node;
 	struct kmem_cache_node *n;
 
-	active_objs = 0;
-	num_slabs = 0;
 	for_each_kmem_cache_node(cachep, node, n) {
-
 		check_irq_on();
 		spin_lock_irq(&n->list_lock);
 
-		num_slabs += n->num_slabs;
+		num_slabs += n->active_slabs + n->free_slabs;
+		num_slabs_free += n->free_slabs;
 
-		list_for_each_entry(page, &n->slabs_partial, lru) {
-			if (page->active == cachep->num && !error)
-				error = "slabs_partial accounting error";
-			if (!page->active && !error)
-				error = "slabs_partial accounting error";
-			active_objs += page->active;
-			num_slabs_partial++;
-		}
+		free_objs += n->free_objects;
 
-		list_for_each_entry(page, &n->slabs_free, lru) {
-			if (page->active && !error)
-				error = "slabs_free accounting error";
-			num_slabs_free++;
-		}
-
-		free_objects += n->free_objects;
 		if (n->shared)
 			shared_avail += n->shared->avail;
 
@@ -4146,15 +4130,8 @@ void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo)
 	}
 	num_objs = num_slabs * cachep->num;
 	active_slabs = num_slabs - num_slabs_free;
-	num_slabs_full = num_slabs - (num_slabs_partial + num_slabs_free);
-	active_objs += (num_slabs_full * cachep->num);
 
-	if (num_objs - active_objs != free_objects && !error)
-		error = "free_objects accounting error";
-
-	name = cachep->name;
-	if (error)
-		pr_err("slab: cache %s error: %s\n", name, error);
+	active_objs = num_objs - free_objs;
 
 	sinfo->active_objs = active_objs;
 	sinfo->num_objs = num_objs;
diff --git a/mm/slab.h b/mm/slab.h
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -432,7 +432,8 @@ struct kmem_cache_node {
 	struct list_head slabs_partial;	/* partial list first, better asm code */
 	struct list_head slabs_full;
 	struct list_head slabs_free;
-	unsigned long num_slabs;
+	unsigned long active_slabs;	/* length of slabs_partial+slabs_full */
+	unsigned long free_slabs;	/* length of slabs_free */
 	unsigned long free_objects;
 	unsigned int free_limit;
 	unsigned int colour_next;	/* Per-node cache coloring */

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply

* Re: gcc-4.6.3, was Re: Debian on mac68k
From: Finn Thain @ 2016-11-08 23:06 UTC (permalink / raw)
  To: John Paul Adrian Glaubitz; +Cc: Angelo Dureghello, debian-68k, linux-m68k
In-Reply-To: <ea450097-fdfc-800a-a28f-79b086ba7eac@physik.fu-berlin.de>


On Tue, 8 Nov 2016, John Paul Adrian Glaubitz wrote:

> On 11/08/2016 10:01 AM, Finn Thain wrote:
> > The only problem is that my fast Linux host is i686 and your compiler 
> > runs on x86_64. But it is a convenient way to get hold of a gcc-5.2 
> > compiler to target m68k/coldfire.
> 
> Installing Debian testing and running
> 
> 	apt install gcc-5-m68k-linux-gnu
> 
> is not an option?

As a way to get a compiler, it's more difficult than untarring the one 
from kernel.org, which was the effort I've been willing to invest so far.

I would consider installing the Debian Testing compiler in the form of a 
container, if one was available.

Or I could just update my cross-compiler build scripts again, but that 
solution doesn't get the upstream project much closer to the ideal 
solution, i.e. a convenient, reliable "reference" compiler.

That would require supported compiler and distro releases. Certainly 
Debian's gcc-5-m68k-linux-gnu or gcc-6-m68k-linux-gnu packages are good 
candidates for building a container, and time permitting, I would 
willingly test them and isolate and report any bugs I found.

-- 

> 
> Adrian
> 
> 

^ permalink raw reply

* Re: [PATCH kernel v4 0/4] powerpc/spapr/vfio: Put pages on VFIO container shutdown
From: Alex Williamson @ 2016-11-08 23:06 UTC (permalink / raw)
  To: Michael Ellerman
  Cc: Alexey Kardashevskiy, linuxppc-dev, Paul Mackerras,
	Nicholas Piggin, David Gibson
In-Reply-To: <871syml83v.fsf@concordia.ellerman.id.au>

On Tue, 08 Nov 2016 18:54:28 +1100
Michael Ellerman <mpe@ellerman.id.au> wrote:

> Alexey Kardashevskiy <aik@ozlabs.ru> writes:
> > These patches are to fix a bug when pages stay pinned hours
> > after QEMU which requested pinning exited.
> >
> > Please comment. Thanks.
> >
> > Alexey Kardashevskiy (4):
> >   powerpc/iommu: Pass mm_struct to init/cleanup helpers
> >   powerpc/iommu: Stop using @current in mm_iommu_xxx
> >   vfio/spapr: Reference mm in tce_container
> >   powerpc/mm/iommu, vfio/spapr: Put pages on VFIO container shutdown
> >
> >  arch/powerpc/include/asm/mmu_context.h |  20 ++--
> >  arch/powerpc/kernel/setup-common.c     |   2 +-
> >  arch/powerpc/mm/mmu_context_book3s64.c |   6 +-
> >  arch/powerpc/mm/mmu_context_iommu.c    |  60 ++++-------
> >  drivers/vfio/vfio_iommu_spapr_tce.c    | 181 ++++++++++++++++++++++-----------
> >  5 files changed, 154 insertions(+), 115 deletions(-)  
> 
> 
> Alex, given the diffstat how do you want to merge this? (for 4.10)
> 
> Should I merge it, you merge it, or I can put it in a topic branch?

I have an outstanding question on one patch, but otherwise I'd prefer
you merge it, I'm not expecting to have anything that would conflict
with vfio_iommu_spapr_tce.c and this code is tied pretty tightly with
arch code.  I'll provide acks depending on how we resolve my question.
Thanks,

Alex

^ permalink raw reply

* Re: [PATCH v5 00/12] ufs-qcom: phy/hcd: Clean up qcom-ufs phy and ufs-qcom hcd
From: Martin K. Petersen @ 2016-11-08 23:06 UTC (permalink / raw)
  To: Vivek Gautam
  Cc: kishon, jejb, vinholikatti, martin.petersen, sboyd, subhashj,
	ygardi, linux-scsi, linux-arm-msm
In-Reply-To: <1478599671-13071-1-git-send-email-vivek.gautam@codeaurora.org>

>>>>> "Vivek" == Vivek Gautam <vivek.gautam@codeaurora.org> writes:

Vivek> Here's the rebased version of patches based on 4.10/scsi-queue
Vivek> branch as requested.  The patches can now be applied and
Vivek> pulled-in.

Thanks! Applied to 4.10/scsi-queue.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply

* Re: [PATCH v6 05/14] mmc: sdhci-msm: Update DLL reset sequence
From: Stephen Boyd @ 2016-11-08 23:06 UTC (permalink / raw)
  To: Ritesh Harjani
  Cc: ulf.hansson, linux-mmc, adrian.hunter, shawn.lin, devicetree,
	linux-clk, david.brown, andy.gross, linux-arm-msm, georgi.djakov,
	alex.lemberg, mateusz.nowak, Yuliy.Izrailov, asutoshd, kdorfman,
	david.griego, stummala, venkatg, rnayak, pramod.gurav
In-Reply-To: <1478517877-23733-6-git-send-email-riteshh@codeaurora.org>

On 11/07, Ritesh Harjani wrote:
> 
> diff --git a/drivers/mmc/host/sdhci-msm.c b/drivers/mmc/host/sdhci-msm.c
> index 42f42aa..32b0b79 100644
> --- a/drivers/mmc/host/sdhci-msm.c
> +++ b/drivers/mmc/host/sdhci-msm.c
> @@ -58,11 +58,17 @@
>  #define CORE_DLL_CONFIG		0x100
>  #define CORE_DLL_STATUS		0x108
>  
> +#define CORE_DLL_CONFIG_2	0x1b4
> +#define CORE_FLL_CYCLE_CNT	BIT(18)
> +#define CORE_DLL_CLOCK_DISABLE	BIT(21)
> +
>  #define CORE_VENDOR_SPEC	0x10c
>  #define CORE_CLK_PWRSAVE	BIT(1)
>  
>  #define CORE_VENDOR_SPEC_CAPABILITIES0	0x11c
>  
> +#define TCXO_FREQ		19200000

TCXO_FREQ could change based on the board. For example, IPQ has
it as 25 MHz.

> +
>  #define CDR_SELEXT_SHIFT	20
>  #define CDR_SELEXT_MASK		(0xf << CDR_SELEXT_SHIFT)
>  #define CMUX_SHIFT_PHASE_SHIFT	24
> @@ -330,6 +349,24 @@ static int msm_init_cm_dll(struct sdhci_host *host)
>  	writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG);
>  	msm_cm_dll_set_freq(host);
>  
> +	if (msm_host->use_14lpp_dll_reset) {
> +		u32 mclk_freq = 0;
> +
> +		if ((readl_relaxed(host->ioaddr + CORE_DLL_CONFIG_2)
> +					& CORE_FLL_CYCLE_CNT))

I suggest you grow a local variable.

> +			mclk_freq = (u32)((host->clock / TCXO_FREQ) * 8);

Is the cast necessary?

> +		else
> +			mclk_freq = (u32)((host->clock / TCXO_FREQ) * 4);

Ditto

> +
> +		config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG_2);
> +		config &= ~(0xFF << 10);
> +		config |= mclk_freq << 10;
> +
> +		writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG_2);
> +		/* wait for 5us before enabling DLL clock */

Usually there's a barrier between writel_relaxed() and delay
because we don't know when the writel will be posted out and the
delay is there to wait for the operation to happen. Probably
should change this to be a writel() instead.

> +		udelay(5);
> +	}
> +
>  	/* Write 0 to DLL_RST bit of DLL_CONFIG register */
>  	config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG);
>  	config &= ~CORE_DLL_RST;
> @@ -340,6 +377,14 @@ static int msm_init_cm_dll(struct sdhci_host *host)
>  	config &= ~CORE_DLL_PDN;
>  	writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG);
>  
> +	if (msm_host->use_14lpp_dll_reset) {
> +		msm_cm_dll_set_freq(host);
> +		/* Enable the DLL clock */
> +		config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG_2);
> +		config &= ~CORE_DLL_CLOCK_DISABLE;
> +		writel_relaxed(config, host->ioaddr + CORE_DLL_CONFIG_2);
> +	}
> +
>  	/* Set DLL_EN bit to 1. */
>  	config = readl_relaxed(host->ioaddr + CORE_DLL_CONFIG);
>  	config |= CORE_DLL_EN;
> @@ -641,6 +686,9 @@ static int sdhci_msm_probe(struct platform_device *pdev)
>  	dev_dbg(&pdev->dev, "MCI Version: 0x%08x, major: 0x%04x, minor: 0x%02x\n",
>  		core_version, core_major, core_minor);
>  
> +	if ((core_major == 1) && (core_minor >= 0x42))

Why so many parenthesis?

> +		msm_host->use_14lpp_dll_reset = true;
> +
>  	/*

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply

* [PATCH] libpvrdma: Fix up for ABI file
From: Adit Ranadive @ 2016-11-08 23:06 UTC (permalink / raw)
  To: linux-rdma-u79uwXL29TY76Z2rM5mHXA; +Cc: Adit Ranadive

Reverted the ABI file to the kernel version. I added a new file that
includes this ABI file and duplicates only the required structures
for the library. This should be temporary until the UAPI is fixed
properly within libibverbs and the kernel.

Signed-off-by: Adit Ranadive <aditr-pghWNbHTmq7QT0dZR+AlfA@public.gmane.org>
---
 buildlib/fixup-include/rdma-pvrdma-abi.h | 56 ++++++++++-------------
 providers/pvrdma/cq.c                    | 10 ++---
 providers/pvrdma/pvrdma-abi-fix.h        | 76 ++++++++++++++++++++++++++++++++
 providers/pvrdma/pvrdma.h                |  2 +-
 providers/pvrdma/pvrdma_main.c           |  4 +-
 providers/pvrdma/qp.c                    | 12 ++---
 providers/pvrdma/verbs.c                 |  4 +-
 7 files changed, 116 insertions(+), 48 deletions(-)
 create mode 100644 providers/pvrdma/pvrdma-abi-fix.h

diff --git a/buildlib/fixup-include/rdma-pvrdma-abi.h b/buildlib/fixup-include/rdma-pvrdma-abi.h
index c7a38c5..5ca0e91 100644
--- a/buildlib/fixup-include/rdma-pvrdma-abi.h
+++ b/buildlib/fixup-include/rdma-pvrdma-abi.h
@@ -46,14 +46,14 @@
 #ifndef __PVRDMA_ABI_H__
 #define __PVRDMA_ABI_H__
 
-#include <infiniband/kern-abi.h>
+#include <linux/types.h>
 
-#define PVRDMA_UVERBS_ABI_VERSION	3
+#define PVRDMA_UVERBS_ABI_VERSION	3		/* ABI Version. */
 #define PVRDMA_UAR_HANDLE_MASK		0x00FFFFFF	/* Bottom 24 bits. */
-#define PVRDMA_UAR_QP_OFFSET		0		/* QP doorbell offset. */
+#define PVRDMA_UAR_QP_OFFSET		0		/* QP doorbell. */
 #define PVRDMA_UAR_QP_SEND		BIT(30)		/* Send bit. */
 #define PVRDMA_UAR_QP_RECV		BIT(31)		/* Recv bit. */
-#define PVRDMA_UAR_CQ_OFFSET		4		/* CQ doorbell offset. */
+#define PVRDMA_UAR_CQ_OFFSET		4		/* CQ doorbell. */
 #define PVRDMA_UAR_CQ_ARM_SOL		BIT(29)		/* Arm solicited bit. */
 #define PVRDMA_UAR_CQ_ARM		BIT(30)		/* Arm bit. */
 #define PVRDMA_UAR_CQ_POLL		BIT(31)		/* Poll bit. */
@@ -129,55 +129,47 @@ enum pvrdma_wc_flags {
 };
 
 struct pvrdma_alloc_ucontext_resp {
-	struct ibv_get_context_resp	ibv_resp;
-	__u32				qp_tab_size;
-	__u32				reserved;
+	__u32 qp_tab_size;
+	__u32 reserved;
 };
 
 struct pvrdma_alloc_pd_resp {
-	struct ibv_alloc_pd_resp	ibv_resp;
-	__u32				pdn;
-	__u32				reserved;
+	__u32 pdn;
+	__u32 reserved;
 };
 
 struct pvrdma_create_cq {
-	struct ibv_create_cq		ibv_cmd;
-	__u64				buf_addr;
-	__u32				buf_size;
-	__u32				reserved;
+	__u64 buf_addr;
+	__u32 buf_size;
+	__u32 reserved;
 };
 
 struct pvrdma_create_cq_resp {
-	struct ibv_create_cq_resp	ibv_resp;
-	__u32				cqn;
-	__u32				reserved;
+	__u32 cqn;
+	__u32 reserved;
 };
 
 struct pvrdma_resize_cq {
-	struct ibv_resize_cq		ibv_cmd;
-	__u64				buf_addr;
-	__u32				buf_size;
-	__u32				reserved;
+	__u64 buf_addr;
+	__u32 buf_size;
+	__u32 reserved;
 };
 
 struct pvrdma_create_srq {
-	struct ibv_create_srq		ibv_cmd;
-	__u64				buf_addr;
+	__u64 buf_addr;
 };
 
 struct pvrdma_create_srq_resp {
-	struct ibv_create_srq_resp	ibv_resp;
-	__u32				srqn;
-	__u32				reserved;
+	__u32 srqn;
+	__u32 reserved;
 };
 
 struct pvrdma_create_qp {
-	struct ibv_create_qp		ibv_cmd;
-	__u64				rbuf_addr;
-	__u64				sbuf_addr;
-	__u32				rbuf_size;
-	__u32				sbuf_size;
-	__u64				qp_addr;
+	__u64 rbuf_addr;
+	__u64 sbuf_addr;
+	__u32 rbuf_size;
+	__u32 sbuf_size;
+	__u64 qp_addr;
 };
 
 /* PVRDMA masked atomic compare and swap */
diff --git a/providers/pvrdma/cq.c b/providers/pvrdma/cq.c
index bb4d1f7..0c7dcf6 100644
--- a/providers/pvrdma/cq.c
+++ b/providers/pvrdma/cq.c
@@ -214,8 +214,8 @@ struct ibv_cq *pvrdma_create_cq(struct ibv_context *context, int cqe,
 				int comp_vector)
 {
 	struct pvrdma_device *dev = to_vdev(context->device);
-	struct pvrdma_create_cq cmd;
-	struct pvrdma_create_cq_resp resp;
+	struct user_pvrdma_create_cq cmd;
+	struct user_pvrdma_create_cq_resp resp;
 	struct pvrdma_cq *cq;
 	int ret;
 
@@ -239,15 +239,15 @@ struct ibv_cq *pvrdma_create_cq(struct ibv_context *context, int cqe,
 
 	cq->ring_state = cq->buf.buf;
 
-	cmd.buf_addr = (uintptr_t) cq->buf.buf;
-	cmd.buf_size = cq->buf.length;
+	cmd.udata.buf_addr = (uintptr_t) cq->buf.buf;
+	cmd.udata.buf_size = cq->buf.length;
 	ret = ibv_cmd_create_cq(context, cqe, channel, comp_vector,
 				&cq->ibv_cq, &cmd.ibv_cmd, sizeof(cmd),
 				&resp.ibv_resp, sizeof(resp));
 	if (ret)
 		goto err_buf;
 
-	cq->cqn = resp.cqn;
+	cq->cqn = resp.udata.cqn;
 	cq->cqe_cnt = cq->ibv_cq.cqe;
 
 	return &cq->ibv_cq;
diff --git a/providers/pvrdma/pvrdma-abi-fix.h b/providers/pvrdma/pvrdma-abi-fix.h
new file mode 100644
index 0000000..3d49aca
--- /dev/null
+++ b/providers/pvrdma/pvrdma-abi-fix.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012-2016 VMware, Inc.  All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of EITHER the GNU General Public License
+ * version 2 as published by the Free Software Foundation or the BSD
+ * 2-Clause License. This program is distributed in the hope that it
+ * will be useful, but WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License version 2 for more details at
+ * http://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program available in the file COPYING in the main
+ * directory of this source tree.
+ *
+ * The BSD 2-Clause License
+ *
+ *     Redistribution and use in source and binary forms, with or
+ *     without modification, are permitted provided that the following
+ *     conditions are met:
+ *
+ *      - Redistributions of source code must retain the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer.
+ *
+ *      - Redistributions in binary form must reproduce the above
+ *        copyright notice, this list of conditions and the following
+ *        disclaimer in the documentation and/or other materials
+ *        provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+ * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef __PVRDMA_ABI_FIX_H__
+#define __PVRDMA_ABI_FIX_H__
+
+#include <rdma/pvrdma-abi.h>
+
+struct user_pvrdma_alloc_ucontext_resp {
+	struct ibv_get_context_resp		ibv_resp;
+	struct pvrdma_alloc_ucontext_resp	udata;
+};
+
+struct user_pvrdma_alloc_pd_resp {
+	struct ibv_alloc_pd_resp	ibv_resp;
+	struct pvrdma_alloc_pd_resp	udata;
+};
+
+struct user_pvrdma_create_cq {
+	struct ibv_create_cq		ibv_cmd;
+	struct pvrdma_create_cq		udata;
+};
+
+struct user_pvrdma_create_cq_resp {
+	struct ibv_create_cq_resp	ibv_resp;
+	struct pvrdma_create_cq_resp	udata;
+};
+
+struct user_pvrdma_create_qp {
+	struct ibv_create_qp		ibv_cmd;
+	struct pvrdma_create_qp		udata;
+};
+
+#endif /* __PVRDMA_ABI_FIX_H__ */
diff --git a/providers/pvrdma/pvrdma.h b/providers/pvrdma/pvrdma.h
index 1c9f9f7..29c9991 100644
--- a/providers/pvrdma/pvrdma.h
+++ b/providers/pvrdma/pvrdma.h
@@ -55,11 +55,11 @@
 #include <netinet/in.h>
 #include <sys/mman.h>
 #include <infiniband/driver.h>
-#include <rdma/pvrdma-abi.h>
 #include <ccan/minmax.h>
 
 #define BIT(nr) (1UL << (nr))
 
+#include "pvrdma-abi-fix.h"
 #include "pvrdma_ring.h"
 
 #ifndef likely
diff --git a/providers/pvrdma/pvrdma_main.c b/providers/pvrdma/pvrdma_main.c
index 909cf1e..9a7e07b 100644
--- a/providers/pvrdma/pvrdma_main.c
+++ b/providers/pvrdma/pvrdma_main.c
@@ -97,14 +97,14 @@ static int pvrdma_init_context_shared(struct pvrdma_context *context,
 				      int cmd_fd)
 {
 	struct ibv_get_context cmd;
-	struct pvrdma_alloc_ucontext_resp resp;
+	struct user_pvrdma_alloc_ucontext_resp resp;
 
 	context->ibv_ctx.cmd_fd = cmd_fd;
 	if (ibv_cmd_get_context(&context->ibv_ctx, &cmd, sizeof(cmd),
 				&resp.ibv_resp, sizeof(resp)))
 		return errno;
 
-	context->qp_tbl = calloc(resp.qp_tab_size & 0xFFFF,
+	context->qp_tbl = calloc(resp.udata.qp_tab_size & 0xFFFF,
 				 sizeof(struct pvrdma_qp *));
 	if (!context->qp_tbl)
 		return -ENOMEM;
diff --git a/providers/pvrdma/qp.c b/providers/pvrdma/qp.c
index 8a37b7f..8b7c5a7 100644
--- a/providers/pvrdma/qp.c
+++ b/providers/pvrdma/qp.c
@@ -100,7 +100,7 @@ struct ibv_qp *pvrdma_create_qp(struct ibv_pd *pd,
 				struct ibv_qp_init_attr *attr)
 {
 	struct pvrdma_device *dev = to_vdev(pd->context->device);
-	struct pvrdma_create_qp cmd;
+	struct user_pvrdma_create_qp cmd;
 	struct ibv_create_qp_resp resp;
 	struct pvrdma_qp *qp;
 	int ret;
@@ -152,11 +152,11 @@ struct ibv_qp *pvrdma_create_qp(struct ibv_pd *pd,
 		goto err_free;
 
 	memset(&cmd, 0, sizeof(cmd));
-	cmd.rbuf_addr = (uintptr_t)qp->rbuf.buf;
-	cmd.rbuf_size = qp->rbuf.length;
-	cmd.sbuf_addr = (uintptr_t)qp->sbuf.buf;
-	cmd.sbuf_size = qp->sbuf.length;
-	cmd.qp_addr = (uintptr_t) qp;
+	cmd.udata.rbuf_addr = (uintptr_t)qp->rbuf.buf;
+	cmd.udata.rbuf_size = qp->rbuf.length;
+	cmd.udata.sbuf_addr = (uintptr_t)qp->sbuf.buf;
+	cmd.udata.sbuf_size = qp->sbuf.length;
+	cmd.udata.qp_addr = (uintptr_t) qp;
 
 	ret = ibv_cmd_create_qp(pd, &qp->ibv_qp, attr,
 				&cmd.ibv_cmd, sizeof(cmd),
diff --git a/providers/pvrdma/verbs.c b/providers/pvrdma/verbs.c
index f20ea6c..7dc9c83 100644
--- a/providers/pvrdma/verbs.c
+++ b/providers/pvrdma/verbs.c
@@ -79,7 +79,7 @@ int pvrdma_query_port(struct ibv_context *context, uint8_t port,
 struct ibv_pd *pvrdma_alloc_pd(struct ibv_context *context)
 {
 	struct ibv_alloc_pd cmd;
-	struct pvrdma_alloc_pd_resp resp;
+	struct user_pvrdma_alloc_pd_resp resp;
 	struct pvrdma_pd *pd;
 
 	pd = malloc(sizeof(*pd));
@@ -92,7 +92,7 @@ struct ibv_pd *pvrdma_alloc_pd(struct ibv_context *context)
 		return NULL;
 	}
 
-	pd->pdn = resp.pdn;
+	pd->pdn = resp.udata.pdn;
 
 	return &pd->ibv_pd;
 }
-- 
1.8.5.6

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related

* + proc-tweak-comments-about-2-stage-open-and-everything.patch added to -mm tree
From: akpm @ 2016-11-08 23:06 UTC (permalink / raw)
  To: adobriyan, mm-commits


The patch titled
     Subject: proc: tweak comments about 2 stage open and everything
has been added to the -mm tree.  Its filename is
     proc-tweak-comments-about-2-stage-open-and-everything.patch

This patch should soon appear at
    http://ozlabs.org/~akpm/mmots/broken-out/proc-tweak-comments-about-2-stage-open-and-everything.patch
and later at
    http://ozlabs.org/~akpm/mmotm/broken-out/proc-tweak-comments-about-2-stage-open-and-everything.patch

Before you just go and hit "reply", please:
   a) Consider who else should be cc'ed
   b) Prefer to cc a suitable mailing list as well
   c) Ideally: find the original patch on the mailing list and do a
      reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated
there every 3-4 working days

------------------------------------------------------
From: Alexey Dobriyan <adobriyan@gmail.com>
Subject: proc: tweak comments about 2 stage open and everything

Some comments were obsoleted since 05c0ae21c034a6f ("try a saner locking
for pde_opener...").

Some new comments added.

Some confusing comments replaced with equally confusing ones.

Link: http://lkml.kernel.org/r/20161029160231.GD1246@avx2
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 fs/proc/inode.c |   29 +++++++++++++++++++++--------
 1 file changed, 21 insertions(+), 8 deletions(-)

diff -puN fs/proc/inode.c~proc-tweak-comments-about-2-stage-open-and-everything fs/proc/inode.c
--- a/fs/proc/inode.c~proc-tweak-comments-about-2-stage-open-and-everything
+++ a/fs/proc/inode.c
@@ -138,6 +138,16 @@ static void unuse_pde(struct proc_dir_en
 /* pde is locked */
 static void close_pdeo(struct proc_dir_entry *pde, struct pde_opener *pdeo)
 {
+	/*
+	 * close() (proc_reg_release()) can't delete an entry and proceed:
+	 * ->release hook needs to be available at the right moment.
+	 *
+	 * rmmod (remove_proc_entry() et al) can't delete an entry and proceed:
+	 * "struct file" needs to be available at the right moment.
+	 *
+	 * Therefore, first process to enter this function does ->release() and
+	 * signals its completion to the other process which does nothing.
+	 */
 	if (pdeo->closing) {
 		/* somebody else is doing that, just wait */
 		DECLARE_COMPLETION_ONSTACK(c);
@@ -152,6 +162,7 @@ static void close_pdeo(struct proc_dir_e
 		file = pdeo->file;
 		pde->proc_fops->release(file_inode(file), file);
 		spin_lock(&pde->pde_unload_lock);
+		/* After ->release. */
 		list_del(&pdeo->lh);
 		if (pdeo->c)
 			complete(pdeo->c);
@@ -167,6 +178,8 @@ void proc_entry_rundown(struct proc_dir_
 	if (atomic_add_return(BIAS, &de->in_use) != BIAS)
 		wait_for_completion(&c);
 
+	/* ->pde_openers list can't grow from now on. */
+
 	spin_lock(&de->pde_unload_lock);
 	while (!list_empty(&de->pde_openers)) {
 		struct pde_opener *pdeo;
@@ -312,14 +325,15 @@ static int proc_reg_open(struct inode *i
 	struct pde_opener *pdeo;
 
 	/*
-	 * What for, you ask? Well, we can have open, rmmod, remove_proc_entry
-	 * sequence. ->release won't be called because ->proc_fops will be
-	 * cleared. Depending on complexity of ->release, consequences vary.
+	 * Ensure that
+	 * 1) PDE's ->release hook will be called no matter what
+	 *    either normally by close()/->release, or forcefully by
+	 *    rmmod/remove_proc_entry.
+	 *
+	 * 2) rmmod isn't blocked by opening file in /proc and sitting on
+	 *    the descriptor (including "rmmod foo </proc/foo" scenario).
 	 *
-	 * We can't wait for mercy when close will be done for real, it's
-	 * deadlockable: rmmod foo </proc/foo . So, we're going to do ->release
-	 * by hand in remove_proc_entry(). For this, save opener's credentials
-	 * for later.
+	 * Save every "struct file" with custom ->release hook.
 	 */
 	pdeo = kmalloc(sizeof(struct pde_opener), GFP_KERNEL);
 	if (!pdeo)
@@ -340,7 +354,6 @@ static int proc_reg_open(struct inode *i
 		pdeo->file = file;
 		pdeo->closing = false;
 		pdeo->c = NULL;
-		/* Strictly for "too late" ->release in proc_reg_release(). */
 		spin_lock(&pde->pde_unload_lock);
 		list_add(&pdeo->lh, &pde->pde_openers);
 		spin_unlock(&pde->pde_unload_lock);
_

Patches currently in -mm which might be from adobriyan@gmail.com are

scripts-bloat-o-meter-fix-sigpipe.patch
kbuild-simpler-generation-of-assembly-constants.patch
proc-make-struct-pid_entry-len-unsigned.patch
proc-make-struct-struct-map_files_info-len-unsigned-int.patch
proc-just-list_del-struct-pde_opener.patch
proc-fix-type-of-struct-pde_opener-closing-field.patch
proc-kmalloc-struct-pde_opener.patch
proc-tweak-comments-about-2-stage-open-and-everything.patch


^ permalink raw reply


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.