Merge tag 'v3.12.8' into 3.12/master

This is the 3.12.8 stable release

Conflicts:
	Makefile
Merge tag 'v3.12.9' into 3.12/master

This is the 3.12.9 stable release

Conflicts:
	Makefile
block: Switch from BFQ-v6r2 for 3.12.0 to BFQ-v7 for 3.12.0 - first part

Improvements:

- IMPROVEMENT: In the presence of weight-raised queues and if the
  device is NCQ-enabled, device idling is now disabled for non-raised
  readers, i.e., for their associated sync queues. Hence a sync queue
  is expired immediately if it becomes empty, and a new queue is
  served.  As explained in detail in the papers about BFQ, not idling
  the device for sync queues when the latter become empty causes BFQ to
  assign higher timestamps to these queues when they get backlogged
  again, and hence to serve these queues less frequently. This fact,
  plus to the fact that, because of the immediate expiration itself,
  these queues get less service while they are granted access to the
  disk, reduces the relative rate at which the processes associated to
  these queues ask for requests from the I/O request pool. If the pool
  is saturated, as it happens, in the presence of write hogs, reducing
  the above relative rate increases the probability that a request is
  available (soon) in the pool when a weight-raised process needs it.
  This change does seem to mitigate the typical starvation problems
  that occur in the presence of write hogs and NCQ, and hence to
  guarantee a higher application and system responsiveness in these
  hostile scenarios.
- IMPROVEMENT/BUGFIX: Introduced a new classification rule to the soft
  real-time heuristic, which takes into account also the isochronous
  nature of such applications. The computation of next_start has been
  fixed as well. Now it is correctly done from the time of the last
  transition from idle to backlogged; the next_start is therefore
  computed from the service received by the queue from its last
  transition from idle to backlogged. Finally, the code which
  preserved weight-raising for a soft real-time queue even with no
  idle->backlogged transition has been removed.
- IMPROVEMENT/BUGFIX: Keep disk idling also for NCQ-provided
  rotational devices, which boosts the throughput on NCQ-enabled
  rotational devices.
- BUGFIX: The budget-timeout condition in the bfq_rq_enqueued() function
  was checked only if the request is large enough to provoke an unplug. As
  a consequence, for a process always issuing small I/O requests the
  budget timeout was never checked. The queue associated to the process
  therefore expired only when its budget was exhausted, even if the
  queue had already incurred a budget timeout from a while.
  This fix lets a queue be checked for budget timeout at each request
  enqueue, and, if needed, expires the queue accordingly even if the
  request is small.
- BUGFIX: Make sure that weight-raising is resumed for a split queue,
  if it was merged when already weight-raised.
- MINOR BUGFIX: Let bfq_end_raising_async() correctly end weight-raising
  also for the queues belonging to the root group.
- IMPROVEMENT: Get rid of the some_coop_idle flag, which in its turn
  was used to decide whether to disable idling for an in-service
  shared queue whose seek mean decreased. In fact, disabling idling
  for such a queue turned out to be useless.
- CODE IMPROVEMENT: The bfq_bfqq_must_idle() function and the
  bfq_select_queue() function may not change the current in-service
  queue in various cases. We have cleaned up the involved conditions,
  by factoring out the common parts and getting rid of the useless
  ones.
- MINOR CODE IMPROVEMENT: The idle_for_long_time condition in the
  bfq_add_rq_rb() function should be evaluated only on an
  idle->backlogged transition. Now the condition is set to false
  by default, evaluating it only if the queue was not busy on a
  request insertion.
- MINOR CODE IMPROVEMENT: Added a comment describing the rationale
  behind the condition evalutated in the function
  bfq_bfqq_must_not_expire().

Signed-off-by: Paolo Valente <paolo.valente@unimore.it>
Tested-by: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
block: Switch from BFQ-v6r2 for 3.12.0 to BFQ-v7 for 3.12.0 - second part

Improvements:

- An application must be non-greedy to be deemed as soft real-time (it is
  one of the conditions to meet). The condition is checked by controlling
  whether a long-enough time interval, by default HZ/125 seconds, elapsed
  from when the queue associated to the application became idle, to when
  the queue becomes backlogged again. Elapsed time is measured in
  jiffies.
  This control easily generates false positives in the following two
  cases (especially if both cases occur):
  1) If HZ is so low that the duration of a jiffie is comparable to or
     higher than the above reference time interval. This happens, e.g.,
     on slow devices with HZ=100.
  2) If jiffies, instead of increasing at a constant rate, may stop
     increasing for some time, then suddenly 'jump' by several units to
     recover the lost increments. This seems to happen, e.g., in virtual
     machines.
  This commit adds a few jiffies to the above reference time interval.
  We found the number of jiffies to add experimentally. In particular,
  according to our experiments, the number of jiffies added by this
  commit seems to make the filter quite precise also in embedded systems
  and KVM/QEMU virtual machines.

Signed-off-by: Paolo Valente <p.valente@virtualopensystems.com>
Signed-off-by: Alexander Spyridakis <a.spyridakis@virtualopensystems.com>
Signed-off-by: Arianna Avanzini <avanzini.arianna@gmail.com>
Merge branch '3.12/bfq' into 3.12/master
BFQv7 from zen-kernel merged.