* Bad magic number and
From: Prashant Shah @ 2012-12-28 5:38 UTC (permalink / raw)
To: kernelnewbies
In-Reply-To: <CAE0An6f5LkjoZU-F6OtNXVo_jWz3XWhS+Zk06vAKZH4aRYDApQ@mail.gmail.com>
Hi,
On Fri, Dec 28, 2012 at 10:57 AM, Manish Katiyar <mkatiyar@gmail.com> wrote:
>
>
> On Thu, Dec 27, 2012 at 8:29 PM, sham pavman <shampavman.cg@gmail.com>
> wrote:
>>
>> I've tried that as well.. and the result is the same.
>> I've little idea on how to start debugging.
>> If you can provide some info it would be great.
Check your mkfs and mount commands. You have specified the whole disk
instead of partition. It should be...
mkfs -t ext4 /dev/sdb1
mount -t ext4 /dev/sdb1 /mnt/test
Regards.
^ permalink raw reply
* Re: [PATCH 01/19] netfilter: move nf_conntrack initialize out of pernet operations
From: canqun zhang @ 2012-12-28 5:32 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Gao feng, netfilter-devel, netdev@vger.kernel.org,
Patrick McHardy, pablo
In-Reply-To: <87ip7mlr2r.fsf@xmission.com>
yes,Network namespaces in general can be cleaned up in any order,but
when doing /etc/ini.d/iptables restart, the system need cleaning up
all net namespace,and init_net should be cleanup lastly.init_net is
the first namespace,other net namespace is copied for it ,and it is
diuty for Initializing resources,so It in itself is special.
2012/12/28 Eric W. Biederman <ebiederm@xmission.com>:
> canqun zhang <canqunzhang@gmail.com> writes:
>
>> Hi all
>> As discussed above,if the host machine create several linux
>> containers, there will be several net namespaces.Resources with "nf
>> conntrack" are registered or unregistered on the first net
>> namespace(init_net),But init_net is not unregistered lastly,so
>> cleanuping other net namespaces will triger painic.
>> If net namespaces are created with the order of 1,2,...n,they should
>> be cleaned with the order of n,...2,1,so in this case init_net will be
>> unregistered lastly.
>
> No. Network namespaces in general can be cleaned up in any order.
>
> In particular you should never ever expect to see the order
> n,n-1,n-2,...,2,1.
>
> It may make sense to special case init_net in the cleanup order
> but I would really rather not.
>
> Now init_net is special and really should never be cleaned up
> for non-modular code. So it almost makes sense to special
> case init_net.
>
> Does anyone know why Alexy decided to do this only for init_net?
>
> My inclination is that Gao Feng is on the rigt path by just removing
> the strange init_net special case and performing the work once
> per module load, and once per module unload.
>
>> I fixed it up (see below). I have taken a lot of test!
>
> Thank you.
>
> It is nice to see that we have exposed this mis-assumption.
>
> I am inclined to leave the order of this list as is so that
> other assumptions of network namespace unregistration order
> are exposed.
>
> Unless there is a truly good reason to perform magic on init_net.
>
> Eric
>
>> diff -r 6a1a258923f5 -r 2667e89e6f50 net/core/net_namespace.c
>> --- a/net/core/net_namespace.c Fri Dec 28 11:01:17 2012 +0800
>> +++ b/net/core/net_namespace.c Fri Dec 28 11:05:12 2012 +0800
>> @@ -450,7 +450,7 @@
>>
>> list_del(&ops->list);
>> for_each_net(net)
>> - list_add_tail(&net->exit_list, &net_exit_list);
>> + list_add(&net->exit_list, &net_exit_list);
>> ops_exit_list(ops, &net_exit_list);
>> ops_free_list(ops, &net_exit_lis
>>
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 1/2] vhost_net: correct error hanlding in vhost_net_set_backend()
From: Jason Wang @ 2012-12-28 5:31 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: kvm, virtualization, netdev, linux-kernel
In-Reply-To: <20121227131442.GF20595@redhat.com>
On 12/27/2012 09:14 PM, Michael S. Tsirkin wrote:
> On Thu, Dec 27, 2012 at 02:39:19PM +0800, Jason Wang wrote:
>> Fix the leaking of oldubufs and fd refcnt when fail to initialized used ring.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/vhost/net.c | 14 +++++++++++---
>> 1 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> index ebd08b2..629d6b5 100644
>> --- a/drivers/vhost/net.c
>> +++ b/drivers/vhost/net.c
>> @@ -834,8 +834,10 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
>> vhost_net_enable_vq(n, vq);
>>
>> r = vhost_init_used(vq);
>> - if (r)
>> - goto err_vq;
>> + if (r) {
>> + sock = NULL;
>> + goto err_used;
>> + }
>>
>> n->tx_packets = 0;
>> n->tx_zcopy_err = 0;
>> @@ -859,8 +861,14 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
>> mutex_unlock(&n->dev.mutex);
>> return 0;
>>
>> +err_used:
>> + if (oldubufs)
>> + vhost_ubuf_put_and_wait(oldubufs);
>> + if (oldsock)
>> + fput(oldsock->file);
>> err_ubufs:
>> - fput(sock->file);
>> + if (sock)
>> + fput(sock->file);
>> err_vq:
>> mutex_unlock(&vq->mutex);
>> err:
> I think it's a real bug, but I don't see how the fix
> makes sense.
> We are returning an error, so we ideally
> revert to the state before the faulty
> operation. So this should put sock and ubufs,
> not oldsock/oldubufs.
Agree.
>
> The best way is probably to change
> vhost_init_used so that it gets private data
> pointer as a parameter.
>
> We can then call it before ubuf alloc.
> You can then add err_used right after err_ubufs
> with no extra logic.
>
Make more sense, thanks.
>
>
^ permalink raw reply
* Re: [PATCH 1/2] vhost_net: correct error hanlding in vhost_net_set_backend()
From: Jason Wang @ 2012-12-28 5:31 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: netdev, linux-kernel, kvm, virtualization
In-Reply-To: <20121227131442.GF20595@redhat.com>
On 12/27/2012 09:14 PM, Michael S. Tsirkin wrote:
> On Thu, Dec 27, 2012 at 02:39:19PM +0800, Jason Wang wrote:
>> Fix the leaking of oldubufs and fd refcnt when fail to initialized used ring.
>>
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/vhost/net.c | 14 +++++++++++---
>> 1 files changed, 11 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> index ebd08b2..629d6b5 100644
>> --- a/drivers/vhost/net.c
>> +++ b/drivers/vhost/net.c
>> @@ -834,8 +834,10 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
>> vhost_net_enable_vq(n, vq);
>>
>> r = vhost_init_used(vq);
>> - if (r)
>> - goto err_vq;
>> + if (r) {
>> + sock = NULL;
>> + goto err_used;
>> + }
>>
>> n->tx_packets = 0;
>> n->tx_zcopy_err = 0;
>> @@ -859,8 +861,14 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
>> mutex_unlock(&n->dev.mutex);
>> return 0;
>>
>> +err_used:
>> + if (oldubufs)
>> + vhost_ubuf_put_and_wait(oldubufs);
>> + if (oldsock)
>> + fput(oldsock->file);
>> err_ubufs:
>> - fput(sock->file);
>> + if (sock)
>> + fput(sock->file);
>> err_vq:
>> mutex_unlock(&vq->mutex);
>> err:
> I think it's a real bug, but I don't see how the fix
> makes sense.
> We are returning an error, so we ideally
> revert to the state before the faulty
> operation. So this should put sock and ubufs,
> not oldsock/oldubufs.
Agree.
>
> The best way is probably to change
> vhost_init_used so that it gets private data
> pointer as a parameter.
>
> We can then call it before ubuf alloc.
> You can then add err_used right after err_ubufs
> with no extra logic.
>
Make more sense, thanks.
>
>
^ permalink raw reply
* Bad magic number and
From: Manish Katiyar @ 2012-12-28 5:27 UTC (permalink / raw)
To: kernelnewbies
In-Reply-To: <CAD0Gp_aM-pZn=3WKT008eO-_bfOzA1=amniJ8DPZ0+K7=MDKsg@mail.gmail.com>
On Thu, Dec 27, 2012 at 8:29 PM, sham pavman <shampavman.cg@gmail.com>wrote:
> I've tried that as well.. and the result is the same.
> I've little idea on how to start debugging.
> If you can provide some info it would be great.
>
What does dumpe2fs -h give ?
Thanks -
Manish
>
> Thanks
>
> On Fri, Dec 28, 2012 at 6:37 AM, Mulyadi Santosa <
> mulyadi.santosa at gmail.com> wrote:
>
>> Hi...
>>
>> On Wed, Dec 26, 2012 at 12:19 PM, sham pavman <shampavman.cg@gmail.com>
>> wrote:
>> > <SNIP>
>> > mkfs -t ext4 /dev/sdb
>> > mke2fs 1.42 (29-Nov-2011)
>>
>> try using mkfs.ext4 instead....
>>
>> --
>> regards,
>>
>> Mulyadi Santosa
>> Freelance Linux trainer and consultant
>>
>> blog: the-hydra.blogspot.com
>> training: mulyaditraining.blogspot.com
>>
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
--
Thanks -
Manish
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20121227/f9d31c01/attachment.html
^ permalink raw reply
* [Qemu-devel] [PATCH 3/3 v2] Enable kvm emulated watchdog
From: Bharat Bhushan @ 2012-12-28 5:16 UTC (permalink / raw)
To: qemu-devel, qemu-ppc, agraf; +Cc: Bharat Bhushan
In-Reply-To: <1356671812-7634-1-git-send-email-bharat.bhushan@freescale.com>
Enable the KVM emulated watchdog if KVM supports (use the
capability enablement in watchdog handler). Also watchdog exit
(KVM_EXIT_WATCHDOG) handling is added.
Watchdog state machine is cleared whenever VM state changes to running.
This is to handle the cases like return from debug halt etc.
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
v2:
- access cap_* from target_ppc/kvm.c only.
- Added wrapper functions in target_ppc/kvm.c for
enable_watchdog and tsr_sregs synchronization.
- Incorporated other Review comments
hw/ppc.h | 1 +
hw/ppc_booke.c | 36 +++++++++++++++++++++++++++++++-
target-ppc/kvm.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++
target-ppc/kvm_ppc.h | 11 +++++++++
4 files changed, 103 insertions(+), 1 deletions(-)
diff --git a/hw/ppc.h b/hw/ppc.h
index 2f3ea27..6ad9e1f 100644
--- a/hw/ppc.h
+++ b/hw/ppc.h
@@ -90,3 +90,4 @@ enum {
/* ppc_booke.c */
void ppc_booke_timers_init(CPUPPCState *env, uint32_t freq, uint32_t flags);
+void ppc_booke_watchdog_clear_tsr(CPUPPCState *env);
diff --git a/hw/ppc_booke.c b/hw/ppc_booke.c
index 837a5b6..7273259 100644
--- a/hw/ppc_booke.c
+++ b/hw/ppc_booke.c
@@ -28,7 +28,7 @@
#include "nvram.h"
#include "qemu-log.h"
#include "loader.h"
-
+#include "kvm_ppc.h"
/* Timer Control Register */
@@ -203,6 +203,11 @@ static void booke_wdt_cb(void *opaque)
booke_timer->wdt_timer);
}
+void ppc_booke_watchdog_clear_tsr(CPUPPCState *env)
+{
+ env->spr[SPR_BOOKE_TSR] &= ~(TSR_ENW | TSR_WIS | TSR_WRS_MASK);
+}
+
void store_booke_tsr(CPUPPCState *env, target_ulong val)
{
env->spr[SPR_BOOKE_TSR] &= ~val;
@@ -241,10 +246,27 @@ static void ppc_booke_timer_reset_handle(void *opaque)
booke_update_irq(env);
}
+static void cpu_state_change_handler(void *opaque, int running, RunState state)
+{
+ CPUPPCState *env = opaque;
+
+ if (!running) {
+ return;
+ }
+
+ /*
+ * Clear watchdog interrupt condition by clearing TSR.
+ */
+ ppc_booke_watchdog_clear_tsr(env);
+
+ kvmppc_synch_sregs_tsr(env);
+}
+
void ppc_booke_timers_init(CPUPPCState *env, uint32_t freq, uint32_t flags)
{
ppc_tb_t *tb_env;
booke_timer_t *booke_timer;
+ int ret = 0;
tb_env = g_malloc0(sizeof(ppc_tb_t));
booke_timer = g_malloc0(sizeof(booke_timer_t));
@@ -262,5 +284,17 @@ void ppc_booke_timers_init(CPUPPCState *env, uint32_t freq, uint32_t flags)
booke_timer->wdt_timer =
qemu_new_timer_ns(vm_clock, &booke_wdt_cb, env);
+ ret = kvmppc_booke_watchdog_enable(env);
+
+ if (ret) {
+ /* TODO: Start the QEMU emulated watchdog if not running on KVM.
+ * Also start the QEMU emulated watchdog if KVM does not support
+ * emulated watchdog or somehow it is not enabled (supported but
+ * not enabled is though some bug and requires debugging :)).
+ */
+ }
+
+ qemu_add_vm_change_state_handler(cpu_state_change_handler, env);
+
qemu_register_reset(ppc_booke_timer_reset_handle, env);
}
diff --git a/target-ppc/kvm.c b/target-ppc/kvm.c
index 3f5df57..6828afa 100644
--- a/target-ppc/kvm.c
+++ b/target-ppc/kvm.c
@@ -32,10 +32,12 @@
#include "device_tree.h"
#include "hw/sysbus.h"
#include "hw/spapr.h"
+#include "hw/watchdog.h"
#include "hw/sysbus.h"
#include "hw/spapr.h"
#include "hw/spapr_vio.h"
+#include "hw/ppc.h"
//#define DEBUG_KVM
@@ -61,6 +63,7 @@ static int cap_ppc_smt;
static int cap_ppc_rma;
static int cap_spapr_tce;
static int cap_hior;
+static int cap_ppc_watchdog;
/* XXX We have a race condition where we actually have a level triggered
* interrupt, but the infrastructure can't expose that yet, so the guest
@@ -90,6 +93,7 @@ int kvm_arch_init(KVMState *s)
cap_ppc_rma = kvm_check_extension(s, KVM_CAP_PPC_RMA);
cap_spapr_tce = kvm_check_extension(s, KVM_CAP_SPAPR_TCE);
cap_hior = kvm_check_extension(s, KVM_CAP_PPC_HIOR);
+ cap_ppc_watchdog = kvm_check_extension(s, KVM_CAP_PPC_BOOKE_WATCHDOG);
if (!cap_interrupt_level) {
fprintf(stderr, "KVM: Couldn't find level irq capability. Expect the "
@@ -823,6 +827,12 @@ int kvm_arch_handle_exit(CPUPPCState *env, struct kvm_run *run)
ret = 0;
break;
#endif
+ case KVM_EXIT_WATCHDOG:
+ dprintf("handle watchdog expiry\n");
+ watchdog_perform_action();
+ ret = 0;
+ break;
+
default:
fprintf(stderr, "KVM: unknown exit reason %d\n", run->exit_reason);
ret = -1;
@@ -1239,3 +1249,49 @@ int kvm_arch_on_sigbus(int code, void *addr)
{
return 1;
}
+
+int kvmppc_synch_sregs_tsr(CPUPPCState *env)
+{
+ struct kvm_sregs sregs;
+ int ret;
+
+ if (!kvm_enabled() || !cap_booke_sregs || !cap_ppc_watchdog) {
+ return -1;
+ }
+
+ ret = kvm_vcpu_ioctl(env, KVM_GET_SREGS, &sregs);
+
+ env->spr[SPR_BOOKE_TSR] = sregs.u.e.tsr;
+ ppc_booke_watchdog_clear_tsr(env);
+ sregs.u.e.tsr = env->spr[SPR_BOOKE_TSR];
+ sregs.u.e.update_special = KVM_SREGS_E_UPDATE_TSR;
+
+ ret = kvm_vcpu_ioctl(env, KVM_SET_SREGS, &sregs);
+
+ return ret;
+}
+
+int kvmppc_booke_watchdog_enable(CPUPPCState *env)
+{
+ int ret;
+ struct kvm_enable_cap encap = {};
+
+ if (!kvm_enabled()) {
+ return -1;
+ }
+
+ if (!cap_ppc_watchdog) {
+ printf("warning: KVM does not support watchdog");
+ return -1;
+ }
+
+ encap.cap = KVM_CAP_PPC_BOOKE_WATCHDOG;
+ ret = kvm_vcpu_ioctl(env, KVM_ENABLE_CAP, &encap);
+ if (ret < 0) {
+ fprintf(stderr, "%s: couldn't enable KVM_CAP_PPC_BOOKE_WATCHDOG: %s\n",
+ __func__, strerror(-ret));
+ return ret;
+ }
+
+ return ret;
+}
diff --git a/target-ppc/kvm_ppc.h b/target-ppc/kvm_ppc.h
index baad6eb..4ccc9fa 100644
--- a/target-ppc/kvm_ppc.h
+++ b/target-ppc/kvm_ppc.h
@@ -23,6 +23,8 @@ int kvmppc_get_hypercall(CPUPPCState *env, uint8_t *buf, int buf_len);
int kvmppc_set_interrupt(CPUPPCState *env, int irq, int level);
void kvmppc_set_papr(CPUPPCState *env);
int kvmppc_smt_threads(void);
+int kvmppc_synch_sregs_tsr(CPUPPCState *cenv);
+int kvmppc_booke_watchdog_enable(CPUPPCState *env);
#ifndef CONFIG_USER_ONLY
off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem);
void *kvmppc_create_spapr_tce(uint32_t liobn, uint32_t window_size, int *pfd);
@@ -79,6 +81,15 @@ static inline int kvmppc_smt_threads(void)
return 1;
}
+static inline int kvmppc_synch_sregs_tsr(CPUPPCState *env)
+{
+ return -1;
+}
+
+static inline int kvmppc_booke_watchdog_enable(CPUPPCState *env)
+{
+ return -1;
+}
#ifndef CONFIG_USER_ONLY
static inline off_t kvmppc_alloc_rma(const char *name, MemoryRegion *sysmem)
{
--
1.7.0.4
^ permalink raw reply related
* [Qemu-devel] [PATCH 1/3 v2] Synchronized the linux headers
From: Bharat Bhushan @ 2012-12-28 5:16 UTC (permalink / raw)
To: qemu-devel, qemu-ppc, agraf; +Cc: Bharat Bhushan
In-Reply-To: <1356671812-7634-1-git-send-email-bharat.bhushan@freescale.com>
This is needed for the watchdog patches (follow up patches)
Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
---
v2: same as v1
| 4 +
| 98 ++++++++++++++++++++++++++++++
| 86 ++++++++++++++++++++++++++
| 7 +-
| 21 +++++--
5 files changed, 208 insertions(+), 8 deletions(-)
create mode 100644 linux-headers/asm-generic/kvm_para.h
create mode 100644 linux-headers/asm-powerpc/epapr_hcalls.h
--git a/linux-headers/asm-generic/kvm_para.h b/linux-headers/asm-generic/kvm_para.h
new file mode 100644
index 0000000..486f0af
--- /dev/null
+++ b/linux-headers/asm-generic/kvm_para.h
@@ -0,0 +1,4 @@
+/*
+ * There isn't anything here, but the file must not be empty or patch
+ * will delete it.
+ */
--git a/linux-headers/asm-powerpc/epapr_hcalls.h b/linux-headers/asm-powerpc/epapr_hcalls.h
new file mode 100644
index 0000000..7f9c74b
--- /dev/null
+++ b/linux-headers/asm-powerpc/epapr_hcalls.h
@@ -0,0 +1,98 @@
+/*
+ * ePAPR hcall interface
+ *
+ * Copyright 2008-2011 Freescale Semiconductor, Inc.
+ *
+ * Author: Timur Tabi <timur@freescale.com>
+ *
+ * This file is provided under a dual BSD/GPL license. When using or
+ * redistributing this file, you may do so under either 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.
+ * * Neither the name of Freescale Semiconductor nor the
+ * names of its contributors may be used to endorse or promote products
+ * derived from this software without specific prior written permission.
+ *
+ *
+ * ALTERNATIVELY, this software may be distributed under the terms of the
+ * GNU General Public License ("GPL") as published by the Free Software
+ * Foundation, either version 2 of that License or (at your option) any
+ * later version.
+ *
+ * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``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 Freescale Semiconductor 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 _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
+#define _UAPI_ASM_POWERPC_EPAPR_HCALLS_H
+
+#define EV_BYTE_CHANNEL_SEND 1
+#define EV_BYTE_CHANNEL_RECEIVE 2
+#define EV_BYTE_CHANNEL_POLL 3
+#define EV_INT_SET_CONFIG 4
+#define EV_INT_GET_CONFIG 5
+#define EV_INT_SET_MASK 6
+#define EV_INT_GET_MASK 7
+#define EV_INT_IACK 9
+#define EV_INT_EOI 10
+#define EV_INT_SEND_IPI 11
+#define EV_INT_SET_TASK_PRIORITY 12
+#define EV_INT_GET_TASK_PRIORITY 13
+#define EV_DOORBELL_SEND 14
+#define EV_MSGSND 15
+#define EV_IDLE 16
+
+/* vendor ID: epapr */
+#define EV_LOCAL_VENDOR_ID 0 /* for private use */
+#define EV_EPAPR_VENDOR_ID 1
+#define EV_FSL_VENDOR_ID 2 /* Freescale Semiconductor */
+#define EV_IBM_VENDOR_ID 3 /* IBM */
+#define EV_GHS_VENDOR_ID 4 /* Green Hills Software */
+#define EV_ENEA_VENDOR_ID 5 /* Enea */
+#define EV_WR_VENDOR_ID 6 /* Wind River Systems */
+#define EV_AMCC_VENDOR_ID 7 /* Applied Micro Circuits */
+#define EV_KVM_VENDOR_ID 42 /* KVM */
+
+/* The max number of bytes that a byte channel can send or receive per call */
+#define EV_BYTE_CHANNEL_MAX_BYTES 16
+
+
+#define _EV_HCALL_TOKEN(id, num) (((id) << 16) | (num))
+#define EV_HCALL_TOKEN(hcall_num) _EV_HCALL_TOKEN(EV_EPAPR_VENDOR_ID, hcall_num)
+
+/* epapr return codes */
+#define EV_SUCCESS 0
+#define EV_EPERM 1 /* Operation not permitted */
+#define EV_ENOENT 2 /* Entry Not Found */
+#define EV_EIO 3 /* I/O error occured */
+#define EV_EAGAIN 4 /* The operation had insufficient
+ * resources to complete and should be
+ * retried
+ */
+#define EV_ENOMEM 5 /* There was insufficient memory to
+ * complete the operation */
+#define EV_EFAULT 6 /* Bad guest address */
+#define EV_ENODEV 7 /* No such device */
+#define EV_EINVAL 8 /* An argument supplied to the hcall
+ was out of range or invalid */
+#define EV_INTERNAL 9 /* An internal error occured */
+#define EV_CONFIG 10 /* A configuration error was detected */
+#define EV_INVALID_STATE 11 /* The object is in an invalid state */
+#define EV_UNIMPLEMENTED 12 /* Unimplemented hypercall */
+#define EV_BUFFER_OVERFLOW 13 /* Caller-supplied buffer too small */
+
+#endif /* _UAPI_ASM_POWERPC_EPAPR_HCALLS_H */
--git a/linux-headers/asm-powerpc/kvm.h b/linux-headers/asm-powerpc/kvm.h
index 1bea4d8..2fba8a6 100644
--- a/linux-headers/asm-powerpc/kvm.h
+++ b/linux-headers/asm-powerpc/kvm.h
@@ -221,6 +221,12 @@ struct kvm_sregs {
__u32 dbsr; /* KVM_SREGS_E_UPDATE_DBSR */
__u32 dbcr[3];
+ /*
+ * iac/dac registers are 64bit wide, while this API
+ * interface provides only lower 32 bits on 64 bit
+ * processors. ONE_REG interface is added for 64bit
+ * iac/dac registers.
+ */
__u32 iac[4];
__u32 dac[2];
__u32 dvc[2];
@@ -325,6 +331,86 @@ struct kvm_book3e_206_tlb_params {
__u32 reserved[8];
};
+/* For KVM_PPC_GET_HTAB_FD */
+struct kvm_get_htab_fd {
+ __u64 flags;
+ __u64 start_index;
+ __u64 reserved[2];
+};
+
+/* Values for kvm_get_htab_fd.flags */
+#define KVM_GET_HTAB_BOLTED_ONLY ((__u64)0x1)
+#define KVM_GET_HTAB_WRITE ((__u64)0x2)
+
+/*
+ * Data read on the file descriptor is formatted as a series of
+ * records, each consisting of a header followed by a series of
+ * `n_valid' HPTEs (16 bytes each), which are all valid. Following
+ * those valid HPTEs there are `n_invalid' invalid HPTEs, which
+ * are not represented explicitly in the stream. The same format
+ * is used for writing.
+ */
+struct kvm_get_htab_header {
+ __u32 index;
+ __u16 n_valid;
+ __u16 n_invalid;
+};
+
#define KVM_REG_PPC_HIOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x1)
+#define KVM_REG_PPC_IAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x2)
+#define KVM_REG_PPC_IAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3)
+#define KVM_REG_PPC_IAC3 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x4)
+#define KVM_REG_PPC_IAC4 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x5)
+#define KVM_REG_PPC_DAC1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x6)
+#define KVM_REG_PPC_DAC2 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x7)
+#define KVM_REG_PPC_DABR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x8)
+#define KVM_REG_PPC_DSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x9)
+#define KVM_REG_PPC_PURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xa)
+#define KVM_REG_PPC_SPURR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xb)
+#define KVM_REG_PPC_DAR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xc)
+#define KVM_REG_PPC_DSISR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0xd)
+#define KVM_REG_PPC_AMR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xe)
+#define KVM_REG_PPC_UAMOR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0xf)
+
+#define KVM_REG_PPC_MMCR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x10)
+#define KVM_REG_PPC_MMCR1 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x11)
+#define KVM_REG_PPC_MMCRA (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x12)
+
+#define KVM_REG_PPC_PMC1 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x18)
+#define KVM_REG_PPC_PMC2 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x19)
+#define KVM_REG_PPC_PMC3 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1a)
+#define KVM_REG_PPC_PMC4 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1b)
+#define KVM_REG_PPC_PMC5 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1c)
+#define KVM_REG_PPC_PMC6 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1d)
+#define KVM_REG_PPC_PMC7 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1e)
+#define KVM_REG_PPC_PMC8 (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x1f)
+
+/* 32 floating-point registers */
+#define KVM_REG_PPC_FPR0 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x20)
+#define KVM_REG_PPC_FPR(n) (KVM_REG_PPC_FPR0 + (n))
+#define KVM_REG_PPC_FPR31 (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x3f)
+
+/* 32 VMX/Altivec vector registers */
+#define KVM_REG_PPC_VR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x40)
+#define KVM_REG_PPC_VR(n) (KVM_REG_PPC_VR0 + (n))
+#define KVM_REG_PPC_VR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x5f)
+
+/* 32 double-width FP registers for VSX */
+/* High-order halves overlap with FP regs */
+#define KVM_REG_PPC_VSR0 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x60)
+#define KVM_REG_PPC_VSR(n) (KVM_REG_PPC_VSR0 + (n))
+#define KVM_REG_PPC_VSR31 (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x7f)
+
+/* FP and vector status/control registers */
+#define KVM_REG_PPC_FPSCR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x80)
+#define KVM_REG_PPC_VSCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x81)
+
+/* Virtual processor areas */
+/* For SLB & DTL, address in high (first) half, length in low half */
+#define KVM_REG_PPC_VPA_ADDR (KVM_REG_PPC | KVM_REG_SIZE_U64 | 0x82)
+#define KVM_REG_PPC_VPA_SLB (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x83)
+#define KVM_REG_PPC_VPA_DTL (KVM_REG_PPC | KVM_REG_SIZE_U128 | 0x84)
+
+#define KVM_REG_PPC_EPCR (KVM_REG_PPC | KVM_REG_SIZE_U32 | 0x85)
#endif /* __LINUX_KVM_POWERPC_H */
--git a/linux-headers/asm-powerpc/kvm_para.h b/linux-headers/asm-powerpc/kvm_para.h
index 5e04383..e3af328 100644
--- a/linux-headers/asm-powerpc/kvm_para.h
+++ b/linux-headers/asm-powerpc/kvm_para.h
@@ -75,9 +75,10 @@ struct kvm_vcpu_arch_shared {
};
#define KVM_SC_MAGIC_R0 0x4b564d21 /* "KVM!" */
-#define HC_VENDOR_KVM (42 << 16)
-#define HC_EV_SUCCESS 0
-#define HC_EV_UNIMPLEMENTED 12
+
+#define KVM_HCALL_TOKEN(num) _EV_HCALL_TOKEN(EV_KVM_VENDOR_ID, num)
+
+#include <asm/epapr_hcalls.h>
#define KVM_FEATURE_MAGIC_PAGE 1
--git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h
index 81d2feb..bfdbf4d 100644
--- a/linux-headers/linux/kvm.h
+++ b/linux-headers/linux/kvm.h
@@ -167,10 +167,15 @@ struct kvm_pit_config {
#define KVM_EXIT_OSI 18
#define KVM_EXIT_PAPR_HCALL 19
#define KVM_EXIT_S390_UCONTROL 20
+#define KVM_EXIT_WATCHDOG 21
/* For KVM_EXIT_INTERNAL_ERROR */
-#define KVM_INTERNAL_ERROR_EMULATION 1
-#define KVM_INTERNAL_ERROR_SIMUL_EX 2
+/* Emulate instruction failed. */
+#define KVM_INTERNAL_ERROR_EMULATION 1
+/* Encounter unexpected simultaneous exceptions. */
+#define KVM_INTERNAL_ERROR_SIMUL_EX 2
+/* Encounter unexpected vm-exit due to delivery event. */
+#define KVM_INTERNAL_ERROR_DELIVERY_EV 3
/* for KVM_RUN, returned by mmap(vcpu_fd, offset=0) */
struct kvm_run {
@@ -477,6 +482,8 @@ struct kvm_ppc_smmu_info {
struct kvm_ppc_one_seg_page_size sps[KVM_PPC_PAGE_SIZES_MAX_SZ];
};
+#define KVM_PPC_PVINFO_FLAGS_EV_IDLE (1<<0)
+
#define KVMIO 0xAE
/* machine type bits, to be used as argument to KVM_CREATE_VM */
@@ -626,6 +633,8 @@ struct kvm_ppc_smmu_info {
#define KVM_CAP_READONLY_MEM 81
#endif
#define KVM_CAP_IRQFD_RESAMPLE 82
+#define KVM_CAP_PPC_BOOKE_WATCHDOG 83
+#define KVM_CAP_PPC_HTAB_FD 84
#ifdef KVM_CAP_IRQ_ROUTING
@@ -848,6 +857,11 @@ struct kvm_s390_ucas_mapping {
#define KVM_PPC_GET_SMMU_INFO _IOR(KVMIO, 0xa6, struct kvm_ppc_smmu_info)
/* Available with KVM_CAP_PPC_ALLOC_HTAB */
#define KVM_PPC_ALLOCATE_HTAB _IOWR(KVMIO, 0xa7, __u32)
+#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
+/* Available with KVM_CAP_RMA */
+#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
+/* Available with KVM_CAP_PPC_HTAB_FD */
+#define KVM_PPC_GET_HTAB_FD _IOW(KVMIO, 0xaa, struct kvm_get_htab_fd)
/*
* ioctls for vcpu fds
@@ -911,9 +925,6 @@ struct kvm_s390_ucas_mapping {
/* Available with KVM_CAP_XCRS */
#define KVM_GET_XCRS _IOR(KVMIO, 0xa6, struct kvm_xcrs)
#define KVM_SET_XCRS _IOW(KVMIO, 0xa7, struct kvm_xcrs)
-#define KVM_CREATE_SPAPR_TCE _IOW(KVMIO, 0xa8, struct kvm_create_spapr_tce)
-/* Available with KVM_CAP_RMA */
-#define KVM_ALLOCATE_RMA _IOR(KVMIO, 0xa9, struct kvm_allocate_rma)
/* Available with KVM_CAP_SW_TLB */
#define KVM_DIRTY_TLB _IOW(KVMIO, 0xaa, struct kvm_dirty_tlb)
/* Available with KVM_CAP_ONE_REG */
--
1.7.0.4
^ permalink raw reply related
* [Qemu-devel] [PATCH 0/3 v2] Enable and Handle in-kernel watchdog emulation
From: Bharat Bhushan @ 2012-12-28 5:16 UTC (permalink / raw)
To: qemu-devel, qemu-ppc, agraf; +Cc: Bharat Bhushan
The Patchset enables and handle the in-kernel watchdog emulation
if KVM supports.
The first Patch is synchronizes the Linux-headers as this is needed
for enabling the in-kernel watchdog emulation.
The Second Patch installs the timer reset handler and the Third patch
enables and handles the watchdog exit.
Bharat Bhushan (3):
Synchronized the linux headers
Reset qemu timers when guest reset
Enable kvm emulated watchdog
hw/ppc.h | 1 +
hw/ppc_booke.c | 48 ++++++++++++++-
linux-headers/asm-generic/kvm_para.h | 4 +
linux-headers/asm-powerpc/epapr_hcalls.h | 98 ++++++++++++++++++++++++++++++
linux-headers/asm-powerpc/kvm.h | 86 ++++++++++++++++++++++++++
linux-headers/asm-powerpc/kvm_para.h | 7 +-
linux-headers/linux/kvm.h | 21 +++++--
target-ppc/kvm.c | 56 +++++++++++++++++
target-ppc/kvm_ppc.h | 11 +++
9 files changed, 323 insertions(+), 9 deletions(-)
create mode 100644 linux-headers/asm-generic/kvm_para.h
create mode 100644 linux-headers/asm-powerpc/epapr_hcalls.h
^ permalink raw reply
* Re: how to look for source code in kernel
From: anish singh @ 2012-12-28 5:19 UTC (permalink / raw)
To: amit mehta
Cc: Henrique Rodrigues, kishore kumar, Jonathan Neuschäfer,
linux-kernel, Kernelnewbies
In-Reply-To: <CAOUxTKNgs4N-M5RR6YHyGeXQqRrg0_CJpxgT2OmN_buEP+jbjQ@mail.gmail.com>
On Fri, Dec 28, 2012 at 10:42 AM, amit mehta <gmate.amit@gmail.com> wrote:
>>>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>>>> > can anybody tell me how to look into source code, as most are hidden in
>>>> > kernel.
>>>>
>>>> You can find the Linux source code at http://kernel.org/ .
>> for browsing the code unfortunately there is no good tool as in windows we
>> have source insight.We can use wine in linux but that sucks.
> Funny you say that!
> Never heard of cscope, ctags ?
It is not as convenient as source insight or is it?
>
> -Amit
^ permalink raw reply
* Re: [PATCH 08/14] xen: netback: Remove redundant check on unsigned variable
From: Tushar Behera @ 2012-12-28 5:15 UTC (permalink / raw)
To: Ian Campbell
Cc: linux-kernel@vger.kernel.org, patches@linaro.org,
xen-devel@lists.xensource.com, netdev@vger.kernel.org
In-Reply-To: <1353057394.3499.159.camel@zakaz.uk.xensource.com>
On 11/16/2012 02:46 PM, Ian Campbell wrote:
> On Fri, 2012-11-16 at 06:50 +0000, Tushar Behera wrote:
>> No need to check whether unsigned variable is less than 0.
>>
>> CC: Ian Campbell <ian.campbell@citrix.com>
>> CC: xen-devel@lists.xensource.com
>> CC: netdev@vger.kernel.org
>> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
>
> Acked-by: Ian Campbell <ian.campbell@citrix.com>
>
> Thanks.
>
This patch was not picked up for 3.8-rc1. Any idea, who should pick this up?
>> ---
>> drivers/net/xen-netback/netback.c | 4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
>> index aab8677..515e10c 100644
>> --- a/drivers/net/xen-netback/netback.c
>> +++ b/drivers/net/xen-netback/netback.c
>> @@ -190,14 +190,14 @@ static int get_page_ext(struct page *pg,
>>
>> group = ext.e.group - 1;
>>
>> - if (group < 0 || group >= xen_netbk_group_nr)
>> + if (group >= xen_netbk_group_nr)
>> return 0;
>>
>> netbk = &xen_netbk[group];
>>
>> idx = ext.e.idx;
>>
>> - if ((idx < 0) || (idx >= MAX_PENDING_REQS))
>> + if (idx >= MAX_PENDING_REQS)
>> return 0;
>>
>> if (netbk->mmap_pages[idx] != pg)
>
>
--
Tushar Behera
^ permalink raw reply
* Re: [PATCH] ppc/iommu: prevent false TCE leak message
From: Gavin Shan @ 2012-12-28 5:21 UTC (permalink / raw)
To: Thadeu Lima de Souza Cascardo; +Cc: paulus, linuxppc-dev, anton
In-Reply-To: <1356625686-8943-1-git-send-email-cascardo@linux.vnet.ibm.com>
On Thu, Dec 27, 2012 at 02:28:06PM -0200, Thadeu Lima de Souza Cascardo wrote:
>When a device DMA window includes the address 0, it's reserved in the
>TCE bitmap to avoid returning that address to drivers.
>
>When the device is removed, the bitmap is checked for any mappings not
>removed by the driver, indicating a possible DMA mapping leak. Since the
>reserved address is not cleared, a message is printed, warning of such a
>leak.
>
>Check for the reservation, and clear it before checking for any other
>standing mappings.
>
>Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
>---
> arch/powerpc/kernel/iommu.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
>
>diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
>index 8226c6c..226e9e5 100644
>--- a/arch/powerpc/kernel/iommu.c
>+++ b/arch/powerpc/kernel/iommu.c
>@@ -717,6 +717,11 @@ void iommu_free_table(struct iommu_table *tbl, const char *node_name)
> return;
> }
>
>+ /* In case we have reserved the first bit, we should not emit
>+ * the warning below. */
At least, the comment would look like:
/*
* xxxxxxx
*/
>+ if (tbl->it_offset == 0)
>+ clear_bit(0, tbl->it_map);
>+
> /* verify that table contains no entries */
> /* it_size is in entries, and we're examining 64 at a time */
The comment would be merged as well? :-)
> for (i = 0; i < (tbl->it_size/64); i++) {
Thanks,
Gavin
^ permalink raw reply
* Re: how to look for source code in kernel
From: amit mehta @ 2012-12-28 5:12 UTC (permalink / raw)
To: anish singh
Cc: Henrique Rodrigues, kishore kumar, Jonathan Neuschäfer,
linux-kernel, Kernelnewbies
In-Reply-To: <CAK7N6vpvLrAb=sZitaEBQ6Fx4K5ehGg+LTU70hiVK=1RdE4WwQ@mail.gmail.com>
>>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>>> > can anybody tell me how to look into source code, as most are hidden in
>>> > kernel.
>>>
>>> You can find the Linux source code at http://kernel.org/ .
> for browsing the code unfortunately there is no good tool as in windows we
> have source insight.We can use wine in linux but that sucks.
Funny you say that!
Never heard of cscope, ctags ?
-Amit
^ permalink raw reply
* how to look for source code in kernel
From: anish singh @ 2012-12-28 5:19 UTC (permalink / raw)
To: kernelnewbies
In-Reply-To: <CAOUxTKNgs4N-M5RR6YHyGeXQqRrg0_CJpxgT2OmN_buEP+jbjQ@mail.gmail.com>
On Fri, Dec 28, 2012 at 10:42 AM, amit mehta <gmate.amit@gmail.com> wrote:
>>>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>>>> > can anybody tell me how to look into source code, as most are hidden in
>>>> > kernel.
>>>>
>>>> You can find the Linux source code at http://kernel.org/ .
>> for browsing the code unfortunately there is no good tool as in windows we
>> have source insight.We can use wine in linux but that sucks.
> Funny you say that!
> Never heard of cscope, ctags ?
It is not as convenient as source insight or is it?
>
> -Amit
^ permalink raw reply
* Re: [PATCH] ppc/EEH: fix crash when adding a device in a slot with DDW
From: Gavin Shan @ 2012-12-28 5:18 UTC (permalink / raw)
To: Thadeu Lima de Souza Cascardo
Cc: shangw, linux-kernel, stable, paulus, bhelgaas, linuxppc-dev
In-Reply-To: <1356626040-9384-1-git-send-email-cascardo@linux.vnet.ibm.com>
On Thu, Dec 27, 2012 at 02:34:00PM -0200, Thadeu Lima de Souza Cascardo wrote:
>The DDW code uses a eeh_dev struct from the pci_dev. However, this is
>not set until eeh_add_device_late is called.
>
>Since pci_bus_add_devices is called before eeh_add_device_late, the PCI
>devices are added to the bus, making drivers' probe hooks to be called.
>These will call set_dma_mask, which will call the DDW code, which will
>require the eeh_dev struct from pci_dev. This would result in a crash,
>due to a NULL dereference.
>
>Calling eeh_add_device_late after pci_bus_add_devices would make the
>system BUG, because device files shouldn't be added to devices there
>were not added to the system. So, a new function is needed to add such
>files only after pci_bus_add_devices have been called.
>
Could you please explain for a bit how did you trigger the problem? I'm
not sure you got it while doing PCI hotplug or just saw the issue during
system bootup stage :-)
>Cc: stable@vger.kernel.org
>Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
>---
> arch/powerpc/include/asm/eeh.h | 3 +++
> arch/powerpc/kernel/pci-common.c | 7 +++++--
> arch/powerpc/platforms/pseries/eeh.c | 24 +++++++++++++++++++++++-
> 3 files changed, 31 insertions(+), 3 deletions(-)
>
>diff --git a/arch/powerpc/include/asm/eeh.h b/arch/powerpc/include/asm/eeh.h
>index b0ef738..71aac19 100644
>--- a/arch/powerpc/include/asm/eeh.h
>+++ b/arch/powerpc/include/asm/eeh.h
>@@ -201,6 +201,7 @@ int eeh_dev_check_failure(struct eeh_dev *edev);
> void __init eeh_addr_cache_build(void);
> void eeh_add_device_tree_early(struct device_node *);
> void eeh_add_device_tree_late(struct pci_bus *);
>+void eeh_add_device_tree_files(struct pci_bus *);
Since the function is going to add EEH specific sysfs files, its name would
be something like "eeh_add_sysfs_files" instead of "eeh_add_device_tree_files" :-)
> void eeh_remove_bus_device(struct pci_dev *, int);
>
> /**
>@@ -240,6 +241,8 @@ static inline void eeh_add_device_tree_early(struct device_node *dn) { }
>
> static inline void eeh_add_device_tree_late(struct pci_bus *bus) { }
>
>+static inline void eeh_add_device_tree_files(struct pci_bus *bus) { }
>+
It'd better to rename the function name to "eeh_add_sysfs_files" mentioned
as above.
> static inline void eeh_remove_bus_device(struct pci_dev *dev, int purge_pe) { }
>
> static inline void eeh_lock(void) { }
>diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
>index 7f94f76..7b1f14c 100644
>--- a/arch/powerpc/kernel/pci-common.c
>+++ b/arch/powerpc/kernel/pci-common.c
>@@ -1480,11 +1480,14 @@ void pcibios_finish_adding_to_bus(struct pci_bus *bus)
> pcibios_allocate_bus_resources(bus);
> pcibios_claim_one_bus(bus);
>
>+ /* Fixup EEH */
>+ eeh_add_device_tree_late(bus);
>+
> /* Add new devices to global lists. Register in proc, sysfs. */
> pci_bus_add_devices(bus);
>
>- /* Fixup EEH */
>- eeh_add_device_tree_late(bus);
>+ /* Add EEH sysfs files */
>+ eeh_add_device_tree_files(bus);
The function name would be "eeh_add_sysfs_files" as above.
> }
> EXPORT_SYMBOL_GPL(pcibios_finish_adding_to_bus);
>
By the way, arch/powerpc/kernel/of_platform.c::of_pci_phb_probe is also calling
to eeh_add_device_tree_late() as well. Since you have removed part of the logic
from original eeh_add_device_tree_late(), which is add EEH specific sysfs files,
and you put that part of logic to eeh_add_device_tree_files(). So I think you
also need make the similiar change for of_pci_phb_probe() as well :-)
>diff --git a/arch/powerpc/platforms/pseries/eeh.c b/arch/powerpc/platforms/pseries/eeh.c
>index 9a04322..a667a34 100644
>--- a/arch/powerpc/platforms/pseries/eeh.c
>+++ b/arch/powerpc/platforms/pseries/eeh.c
>@@ -788,7 +788,6 @@ static void eeh_add_device_late(struct pci_dev *dev)
> dev->dev.archdata.edev = edev;
>
> eeh_addr_cache_insert_dev(dev);
>- eeh_sysfs_add_device(dev);
> }
>
> /**
>@@ -815,6 +814,29 @@ void eeh_add_device_tree_late(struct pci_bus *bus)
> EXPORT_SYMBOL_GPL(eeh_add_device_tree_late);
>
> /**
>+ * eeh_add_device_tree_files - Add EEH sysfs files for the indicated PCI bus
>+ * @bus: PCI bus
>+ *
>+ * This routine must be used to add EEH sysfs files for PCI
>+ * devices which are attached to the indicated PCI bus. The PCI bus
>+ * is added after system boot through hotplug or dlpar.
>+ */
>+void eeh_add_device_tree_files(struct pci_bus *bus)
>+{
>+ struct pci_dev *dev;
>+
>+ list_for_each_entry(dev, &bus->devices, bus_list) {
>+ eeh_sysfs_add_device(dev);
>+ if (dev->hdr_type == PCI_HEADER_TYPE_BRIDGE) {
>+ struct pci_bus *subbus = dev->subordinate;
>+ if (subbus)
>+ eeh_add_device_tree_files(subbus);
>+ }
>+ }
>+}
>+EXPORT_SYMBOL_GPL(eeh_add_device_tree_files);
>+
The function name mentioned as above.
>+/**
> * eeh_remove_device - Undo EEH setup for the indicated pci device
> * @dev: pci device to be removed
> * @purge_pe: remove the PE or not
>
Thanks,
Gavin
^ permalink raw reply
* Re: [PATCH 10/14] atm: Removed redundant check on unsigned variable
From: Tushar Behera @ 2012-12-28 5:16 UTC (permalink / raw)
To: linux-kernel; +Cc: patches, Chas Williams, linux-atm-general, netdev
In-Reply-To: <1353048646-10935-11-git-send-email-tushar.behera@linaro.org>
Ping.
On 11/16/2012 12:20 PM, Tushar Behera wrote:
> No need to check whether unsigned variable is less than 0.
>
> CC: Chas Williams <chas@cmf.nrl.navy.mil>
> CC: linux-atm-general@lists.sourceforge.net
> CC: netdev@vger.kernel.org
> Signed-off-by: Tushar Behera <tushar.behera@linaro.org>
> ---
> drivers/atm/fore200e.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/atm/fore200e.c b/drivers/atm/fore200e.c
> index 361f5ae..fdd3fe7 100644
> --- a/drivers/atm/fore200e.c
> +++ b/drivers/atm/fore200e.c
> @@ -972,7 +972,7 @@ int bsq_audit(int where, struct host_bsq* bsq, int scheme, int magn)
> where, scheme, magn, buffer->index, buffer->scheme);
> }
>
> - if ((buffer->index < 0) || (buffer->index >= fore200e_rx_buf_nbr[ scheme ][ magn ])) {
> + if (buffer->index >= fore200e_rx_buf_nbr[ scheme ][ magn ]) {
> printk(FORE200E "bsq_audit(%d): queue %d.%d, out of range buffer index = %ld !\n",
> where, scheme, magn, buffer->index);
> }
>
--
Tushar Behera
^ permalink raw reply
* Re: Find the starting point of a local branch
From: Woody Wu @ 2012-12-28 5:15 UTC (permalink / raw)
To: Martin von Zweigbergk; +Cc: Seth Robertson, git
In-Reply-To: <CANiSa6iSYvLbp1s8h9pwi=P1m0QdZPqf06hAm+4muChgJUuj=g@mail.gmail.com>
On Mon, Dec 24, 2012 at 09:24:39AM -0800, Martin von Zweigbergk wrote:
> On Sun, Dec 23, 2012 at 11:31 PM, Woody Wu <narkewoody@gmail.com> wrote:
> > On Sun, Dec 23, 2012 at 11:09:58PM -0500, Seth Robertson wrote:
> >>
> >> In message <20121224035825.GA17203@zuhnb712>, Woody Wu writes:
> >>
> >> How can I find out what's the staring reference point (a commit number
> >> or tag name) of a locally created branch? I can use gitk to find out it
> >> but this method is slow, I think there might be a command line to do it
> >> quickly.
> >>
> >> The answer is more complex than you probably suspected.
> >>
> >> Technically, `git log --oneline mybranch | tail -n 1` will tell you
> >> the starting point of any branch. But...I'm sure that isn't what you
> >> want to know.
> >>
> >> You want to know "what commit was I at when I typed `git branch
> >> mybranch`"?
> >
> > Yes, this is exactly I want to know.
> >
> >>The problem is git doesn't record this information and
> >> doesn't have the slightest clue.
> >>
> >> But, you say, I can use `gitk` and see it. See? Right there. That
> >> isn't (necessarily) the "starting point" of the branch, it is the
> >> place where your branch diverged from some other branch. Git is
> >> actually quite able to tell you when the last time your branch
> >> diverged from some other branch. `git merge-base mybranch master`
> >> will tell you this, and is probably the answer you were looking for.
> >
> > This is not working to me since I have more than one local branch that
> > diverged from the master, and in fact, the branch I have in question was
> > diverged from another local branch.
>
> As Jeff mentions in a later message, "git pull --rebase" would
> probably do what you want. It works with local branches too.
>
I think what 'git pull --rebase' would do is to fetch from the origin
and do a 'git rebase'. On one hand, I don't understand 'git rebase' so
much from the manual, ont the other hand, I did not get the point why
'git rebase' has something to do with the thing I want to do (what I
want is just query some kind of history information).
I know, my knowledge about git is still so limit. I will keep study from
the man pages.
> I once tried to add the same cleverness that "git pull --rebase"
> directly in "git rebase" [1], but there were several issues with those
> patches, one of was regarding the performance ("git pull --rebase" can
> be equally slow, but since it often involves network, users probably
> rarely notice). I think it would be nice to at least add it as an
> option to "git rebase" some day. Until then, "git pull --rebase" works
> fine.
>
> [1] http://thread.gmane.org/gmane.comp.version-control.git/166710
--
woody
I can't go back to yesterday - because I was a different person then.
^ permalink raw reply
* how to look for source code in kernel
From: amit mehta @ 2012-12-28 5:12 UTC (permalink / raw)
To: kernelnewbies
In-Reply-To: <CAK7N6vpvLrAb=sZitaEBQ6Fx4K5ehGg+LTU70hiVK=1RdE4WwQ@mail.gmail.com>
>>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>>> > can anybody tell me how to look into source code, as most are hidden in
>>> > kernel.
>>>
>>> You can find the Linux source code at http://kernel.org/ .
> for browsing the code unfortunately there is no good tool as in windows we
> have source insight.We can use wine in linux but that sucks.
Funny you say that!
Never heard of cscope, ctags ?
-Amit
^ permalink raw reply
* Re: Patch update notification: 5 patches updated
From: Tushar Behera @ 2012-12-28 5:10 UTC (permalink / raw)
To: linux-media; +Cc: Mauro Carvalho Chehab
In-Reply-To: <20121226123302.24678.81659@www.linuxtv.org>
On 12/26/2012 06:03 PM, Patchwork wrote:
> Hello,
>
> The following patches (submitted by you) have been updated in patchwork:
>
> * [05/14,media] atmel-isi: Update error check for unsigned variables
> - http://patchwork.linuxtv.org/patch/15475/
> was: New
> now: Under Review
>
> * [01/14,media] ivtv: Remove redundant check on unsigned variable
> - http://patchwork.linuxtv.org/patch/15479/
> was: New
> now: Under Review
>
> * [04/14,media] tlg2300: Remove redundant check on unsigned variable
> - http://patchwork.linuxtv.org/patch/15476/
> was: New
> now: Under Review
>
> * [02/14,media] meye: Remove redundant check on unsigned variable
> - http://patchwork.linuxtv.org/patch/15478/
> was: New
> now: Under Review
>
> * [03/14,media] saa7134: Remove redundant check on unsigned variable
> - http://patchwork.linuxtv.org/patch/15477/
> was: New
> now: Under Review
>
> This email is a notification only - you do not need to respond.
>
The above 5 patches may please be marked as "Obsolete" as a similar
patches have already been merged to 3.8-rc1.
--
Tushar Behera
^ permalink raw reply
* Re: Another novice question & comment
From: Chris Murphy @ 2012-12-28 5:03 UTC (permalink / raw)
To: russell; +Cc: linux-btrfs Mailing list
In-Reply-To: <201212281134.10604.russell@coker.com.au>
On Dec 27, 2012, at 5:34 PM, Russell Coker <russell@coker.com.au> wrote:
> On Fri, 28 Dec 2012, Chris Murphy <lists@colorremedies.com> wrote:
>> On Dec 27, 2012, at 12:27 PM, Gene Czarcinski <gene@czarc.net> wrote:
>>> Oh thanks for that little reminder that you can put btrfs on an LV.
>>
>> I find it's more trouble than it's worth. It doesn't bring much to the
>> table.
>
> I've tried using LVM and BTRFS together. While they work the combination
> doesn't seem to offer much benefit. LVM is good for snapshots (which BTRFS does
> better) and also for dividing a device that is larger than your filesystem can
> properly support (also not a problem for BTRFS).
>
> http://etbe.coker.com.au/2012/12/17/using-btrfs/
>
> At the above URL I've documented some of the things I'm currently doing with
> BTRFS in production. I'm still considering what's the best way of managing
> virtual machines. My current method is to run a server with two disks that
> have separate LVM VGs and give each VM a pair of block devices to run BTRFS
> RAID-1.
>
> The other option I'm considering is a single BTRFS RAID-1 taking all disk
> space and giving each VM a single block device that's a file on the BTRFS
> filesystem. Presumably that will give a significant performance hit because of
> double filesystem overhead but will make management a little easier and
> possibly reduce seeks when multiple VMs are writing to disk.
What the VMs are doing makes a big difference. But in any case you'd need to benchmark the various configurations that are possible.
Off hand it seems to be better to have the host running the more complex/capable file system, in this case btrfs on whole drives. And then the guests write to a file, with a simpler file system like ext4, and optionally disable journaling.
For a handful of VMs that aren't doing heavy writes, then either dedicated partitions or LVs (in effect the same thing), is probably OK. But I suspect as you get busier VMs, or add more VMs, this will not scale. You'll quickly get too much disk contention, VM's demanding their own disk region is being written to NOW and will simply slow down while they wait for the disk to handle the request. Whereas if you have the VM guests use ext4 (optionally disable journaling) to a file, either XFS or Btrfs will aggregate those requests much more efficiently than individual VMs can.
But still needs to be tested.
Chris Murphy
^ permalink raw reply
* Re: [PATCH 1/2] vhost_net: correct error hanlding in vhost_net_set_backend()
From: Jason Wang @ 2012-12-28 4:58 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: kvm, virtualization, netdev, linux-kernel
In-Reply-To: <20121227130305.GE20595@redhat.com>
On 12/27/2012 09:03 PM, Michael S. Tsirkin wrote:
> On Thu, Dec 27, 2012 at 02:39:20PM +0800, Jason Wang wrote:
>> Currently, polling error were ignored in vhost. This may lead some issues (e.g
>> kenrel crash when passing a tap fd to vhost before calling TUNSETIFF). Fix this
>> by:
>>
>> - extend the idea of vhost_net_poll_state to all vhost_polls
>> - change the state only when polling is succeed
>> - make vhost_poll_start() report errors to the caller, which could be used
>> caller or userspace.
> Maybe it could but this patch just ignores these errors.
> And it's not clear how would userspace handle these errors.
Not all were ignored, one example is vhost_net_enable_vq(), this could
be used to let userspace know the fd were not setup correctly.
> Also, since we have a reference on the fd, it would seem
> that once poll succeeds it can't fail in the future.
Right.
>
> So two other options would make more sense to me:
> - if vhost is bound to tun without SETIFF, fail this immediately
> - if vhost is bound to tun without SETIFF, defer polling
> until SETIFF
>
> Option 1 would seem much easier to implement, I think it's
> preferable.
Option 1 seems better, since userspace may also disable a queue in the
meantime. Will add a vq_err() and break out of the loop when fails to
start the polling.
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/vhost/net.c | 75 +++++++++++++++++--------------------------------
>> drivers/vhost/vhost.c | 16 +++++++++-
>> drivers/vhost/vhost.h | 11 ++++++-
>> 3 files changed, 50 insertions(+), 52 deletions(-)
>>
>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> index 629d6b5..56e7f5a 100644
>> --- a/drivers/vhost/net.c
>> +++ b/drivers/vhost/net.c
>> @@ -64,20 +64,10 @@ enum {
>> VHOST_NET_VQ_MAX = 2,
>> };
>>
>> -enum vhost_net_poll_state {
>> - VHOST_NET_POLL_DISABLED = 0,
>> - VHOST_NET_POLL_STARTED = 1,
>> - VHOST_NET_POLL_STOPPED = 2,
>> -};
>> -
>> struct vhost_net {
>> struct vhost_dev dev;
>> struct vhost_virtqueue vqs[VHOST_NET_VQ_MAX];
>> struct vhost_poll poll[VHOST_NET_VQ_MAX];
>> - /* Tells us whether we are polling a socket for TX.
>> - * We only do this when socket buffer fills up.
>> - * Protected by tx vq lock. */
>> - enum vhost_net_poll_state tx_poll_state;
>> /* Number of TX recently submitted.
>> * Protected by tx vq lock. */
>> unsigned tx_packets;
>> @@ -155,24 +145,6 @@ static void copy_iovec_hdr(const struct iovec *from, struct iovec *to,
>> }
>> }
>>
>> -/* Caller must have TX VQ lock */
>> -static void tx_poll_stop(struct vhost_net *net)
>> -{
>> - if (likely(net->tx_poll_state != VHOST_NET_POLL_STARTED))
>> - return;
>> - vhost_poll_stop(net->poll + VHOST_NET_VQ_TX);
>> - net->tx_poll_state = VHOST_NET_POLL_STOPPED;
>> -}
>> -
>> -/* Caller must have TX VQ lock */
>> -static void tx_poll_start(struct vhost_net *net, struct socket *sock)
>> -{
>> - if (unlikely(net->tx_poll_state != VHOST_NET_POLL_STOPPED))
>> - return;
>> - vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file);
>> - net->tx_poll_state = VHOST_NET_POLL_STARTED;
>> -}
>> -
>> /* In case of DMA done not in order in lower device driver for some reason.
>> * upend_idx is used to track end of used idx, done_idx is used to track head
>> * of used idx. Once lower device DMA done contiguously, we will signal KVM
>> @@ -252,7 +224,7 @@ static void handle_tx(struct vhost_net *net)
>> wmem = atomic_read(&sock->sk->sk_wmem_alloc);
>> if (wmem >= sock->sk->sk_sndbuf) {
>> mutex_lock(&vq->mutex);
>> - tx_poll_start(net, sock);
>> + vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file);
>> mutex_unlock(&vq->mutex);
>> return;
>> }
>> @@ -261,7 +233,7 @@ static void handle_tx(struct vhost_net *net)
>> vhost_disable_notify(&net->dev, vq);
>>
>> if (wmem < sock->sk->sk_sndbuf / 2)
>> - tx_poll_stop(net);
>> + vhost_poll_stop(net->poll + VHOST_NET_VQ_TX);
>> hdr_size = vq->vhost_hlen;
>> zcopy = vq->ubufs;
>>
>> @@ -283,7 +255,8 @@ static void handle_tx(struct vhost_net *net)
>>
>> wmem = atomic_read(&sock->sk->sk_wmem_alloc);
>> if (wmem >= sock->sk->sk_sndbuf * 3 / 4) {
>> - tx_poll_start(net, sock);
>> + vhost_poll_start(net->poll + VHOST_NET_VQ_TX,
>> + sock->file);
>> set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
>> break;
>> }
>> @@ -294,7 +267,8 @@ static void handle_tx(struct vhost_net *net)
>> (vq->upend_idx - vq->done_idx) :
>> (vq->upend_idx + UIO_MAXIOV - vq->done_idx);
>> if (unlikely(num_pends > VHOST_MAX_PEND)) {
>> - tx_poll_start(net, sock);
>> + vhost_poll_start(net->poll + VHOST_NET_VQ_TX,
>> + sock->file);
>> set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
>> break;
>> }
>> @@ -360,7 +334,8 @@ static void handle_tx(struct vhost_net *net)
>> }
>> vhost_discard_vq_desc(vq, 1);
>> if (err == -EAGAIN || err == -ENOBUFS)
>> - tx_poll_start(net, sock);
>> + vhost_poll_start(net->poll + VHOST_NET_VQ_TX,
>> + sock->file);
>> break;
>> }
>> if (err != len)
>> @@ -623,7 +598,6 @@ static int vhost_net_open(struct inode *inode, struct file *f)
>>
>> vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
>> vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
>> - n->tx_poll_state = VHOST_NET_POLL_DISABLED;
>>
>> f->private_data = n;
>>
>> @@ -635,27 +609,26 @@ static void vhost_net_disable_vq(struct vhost_net *n,
>> {
>> if (!vq->private_data)
>> return;
>> - if (vq == n->vqs + VHOST_NET_VQ_TX) {
>> - tx_poll_stop(n);
>> - n->tx_poll_state = VHOST_NET_POLL_DISABLED;
>> - } else
>> + if (vq == n->vqs + VHOST_NET_VQ_TX)
>> + vhost_poll_stop(n->poll + VHOST_NET_VQ_TX);
>> + else
>> vhost_poll_stop(n->poll + VHOST_NET_VQ_RX);
>> }
>>
>> -static void vhost_net_enable_vq(struct vhost_net *n,
>> - struct vhost_virtqueue *vq)
>> +static int vhost_net_enable_vq(struct vhost_net *n,
>> + struct vhost_virtqueue *vq)
>> {
>> + int err, index = vq - n->vqs;
>> struct socket *sock;
>>
>> sock = rcu_dereference_protected(vq->private_data,
>> lockdep_is_held(&vq->mutex));
>> if (!sock)
>> - return;
>> - if (vq == n->vqs + VHOST_NET_VQ_TX) {
>> - n->tx_poll_state = VHOST_NET_POLL_STOPPED;
>> - tx_poll_start(n, sock);
>> - } else
>> - vhost_poll_start(n->poll + VHOST_NET_VQ_RX, sock->file);
>> + return 0;
>> +
>> + n->poll[index].state = VHOST_POLL_STOPPED;
>> + err = vhost_poll_start(n->poll + index, sock->file);
>> + return err;
>> }
>>
>> static struct socket *vhost_net_stop_vq(struct vhost_net *n,
>> @@ -831,12 +804,16 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
>> vq->ubufs = ubufs;
>> vhost_net_disable_vq(n, vq);
>> rcu_assign_pointer(vq->private_data, sock);
>> - vhost_net_enable_vq(n, vq);
>> + r = vhost_net_enable_vq(n, vq);
>> + if (r) {
>> + sock = NULL;
>> + goto err_enable;
>> + }
>>
>> r = vhost_init_used(vq);
>> if (r) {
>> sock = NULL;
>> - goto err_used;
>> + goto err_enable;
>> }
>>
>> n->tx_packets = 0;
>> @@ -861,7 +838,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
>> mutex_unlock(&n->dev.mutex);
>> return 0;
>>
>> -err_used:
>> +err_enable:
>> if (oldubufs)
>> vhost_ubuf_put_and_wait(oldubufs);
>> if (oldsock)
>> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
>> index 34389f7..1cb2604 100644
>> --- a/drivers/vhost/vhost.c
>> +++ b/drivers/vhost/vhost.c
>> @@ -77,26 +77,36 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
>> init_poll_funcptr(&poll->table, vhost_poll_func);
>> poll->mask = mask;
>> poll->dev = dev;
>> + poll->state = VHOST_POLL_DISABLED;
>>
>> vhost_work_init(&poll->work, fn);
>> }
>>
>> /* Start polling a file. We add ourselves to file's wait queue. The caller must
>> * keep a reference to a file until after vhost_poll_stop is called. */
>> -void vhost_poll_start(struct vhost_poll *poll, struct file *file)
>> +int vhost_poll_start(struct vhost_poll *poll, struct file *file)
>> {
>> unsigned long mask;
>> + if (unlikely(poll->state != VHOST_POLL_STOPPED))
>> + return 0;
>>
>> mask = file->f_op->poll(file, &poll->table);
>> + if (mask & POLLERR)
>> + return -EINVAL;
>> if (mask)
>> vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask);
>> + poll->state = VHOST_POLL_STARTED;
>> + return 0;
>> }
>>
> Hmm, interesting. I note that tun has this:
>
> if (tun->dev->reg_state != NETREG_REGISTERED)
> mask = POLLERR;
>
> So apparently we sometimes return POLLERR when poll
> did succeed, then test below wouldn't remove
> from wqh in this case. Maybe it's a bug in tun,
> need to look into this.
Looks a bug of tun to me, looks like a POLLHUP is better here.
>
>> /* Stop polling a file. After this function returns, it becomes safe to drop the
>> * file reference. You must also flush afterwards. */
>> void vhost_poll_stop(struct vhost_poll *poll)
>> {
>> + if (likely(poll->state != VHOST_POLL_STARTED))
>> + return;
>> remove_wait_queue(poll->wqh, &poll->wait);
>> + poll->state = VHOST_POLL_STOPPED;
>> }
>>
>> static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,
>> @@ -791,8 +801,10 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp)
>> if (filep)
>> fput(filep);
>>
>> - if (pollstart && vq->handle_kick)
>> + if (pollstart && vq->handle_kick) {
>> + vq->poll.state = VHOST_POLL_STOPPED;
>> vhost_poll_start(&vq->poll, vq->kick);
>> + }
>>
>> mutex_unlock(&vq->mutex);
>>
>> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
>> index 2639c58..98861d9 100644
>> --- a/drivers/vhost/vhost.h
>> +++ b/drivers/vhost/vhost.h
>> @@ -26,6 +26,12 @@ struct vhost_work {
>> unsigned done_seq;
>> };
>>
>> +enum vhost_poll_state {
>> + VHOST_POLL_DISABLED = 0,
>> + VHOST_POLL_STARTED = 1,
>> + VHOST_POLL_STOPPED = 2,
>> +};
>> +
>> /* Poll a file (eventfd or socket) */
>> /* Note: there's nothing vhost specific about this structure. */
>> struct vhost_poll {
>> @@ -35,6 +41,9 @@ struct vhost_poll {
>> struct vhost_work work;
>> unsigned long mask;
>> struct vhost_dev *dev;
>> + /* Tells us whether we are polling a file.
>> + * Protected by tx vq lock. */
> tx vq lock does not make sense in this context.
Yes, thanks for pointing this out.
>> + enum vhost_poll_state state;
>> };
>>
>> void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn);
>> @@ -42,7 +51,7 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
>>
>> void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
>> unsigned long mask, struct vhost_dev *dev);
>> -void vhost_poll_start(struct vhost_poll *poll, struct file *file);
>> +int vhost_poll_start(struct vhost_poll *poll, struct file *file);
>> void vhost_poll_stop(struct vhost_poll *poll);
>> void vhost_poll_flush(struct vhost_poll *poll);
>> void vhost_poll_queue(struct vhost_poll *poll);
>> --
>> 1.7.1
^ permalink raw reply
* Re: [PATCH 1/2] vhost_net: correct error hanlding in vhost_net_set_backend()
From: Jason Wang @ 2012-12-28 4:58 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: netdev, linux-kernel, kvm, virtualization
In-Reply-To: <20121227130305.GE20595@redhat.com>
On 12/27/2012 09:03 PM, Michael S. Tsirkin wrote:
> On Thu, Dec 27, 2012 at 02:39:20PM +0800, Jason Wang wrote:
>> Currently, polling error were ignored in vhost. This may lead some issues (e.g
>> kenrel crash when passing a tap fd to vhost before calling TUNSETIFF). Fix this
>> by:
>>
>> - extend the idea of vhost_net_poll_state to all vhost_polls
>> - change the state only when polling is succeed
>> - make vhost_poll_start() report errors to the caller, which could be used
>> caller or userspace.
> Maybe it could but this patch just ignores these errors.
> And it's not clear how would userspace handle these errors.
Not all were ignored, one example is vhost_net_enable_vq(), this could
be used to let userspace know the fd were not setup correctly.
> Also, since we have a reference on the fd, it would seem
> that once poll succeeds it can't fail in the future.
Right.
>
> So two other options would make more sense to me:
> - if vhost is bound to tun without SETIFF, fail this immediately
> - if vhost is bound to tun without SETIFF, defer polling
> until SETIFF
>
> Option 1 would seem much easier to implement, I think it's
> preferable.
Option 1 seems better, since userspace may also disable a queue in the
meantime. Will add a vq_err() and break out of the loop when fails to
start the polling.
>> Signed-off-by: Jason Wang <jasowang@redhat.com>
>> ---
>> drivers/vhost/net.c | 75 +++++++++++++++++--------------------------------
>> drivers/vhost/vhost.c | 16 +++++++++-
>> drivers/vhost/vhost.h | 11 ++++++-
>> 3 files changed, 50 insertions(+), 52 deletions(-)
>>
>> diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
>> index 629d6b5..56e7f5a 100644
>> --- a/drivers/vhost/net.c
>> +++ b/drivers/vhost/net.c
>> @@ -64,20 +64,10 @@ enum {
>> VHOST_NET_VQ_MAX = 2,
>> };
>>
>> -enum vhost_net_poll_state {
>> - VHOST_NET_POLL_DISABLED = 0,
>> - VHOST_NET_POLL_STARTED = 1,
>> - VHOST_NET_POLL_STOPPED = 2,
>> -};
>> -
>> struct vhost_net {
>> struct vhost_dev dev;
>> struct vhost_virtqueue vqs[VHOST_NET_VQ_MAX];
>> struct vhost_poll poll[VHOST_NET_VQ_MAX];
>> - /* Tells us whether we are polling a socket for TX.
>> - * We only do this when socket buffer fills up.
>> - * Protected by tx vq lock. */
>> - enum vhost_net_poll_state tx_poll_state;
>> /* Number of TX recently submitted.
>> * Protected by tx vq lock. */
>> unsigned tx_packets;
>> @@ -155,24 +145,6 @@ static void copy_iovec_hdr(const struct iovec *from, struct iovec *to,
>> }
>> }
>>
>> -/* Caller must have TX VQ lock */
>> -static void tx_poll_stop(struct vhost_net *net)
>> -{
>> - if (likely(net->tx_poll_state != VHOST_NET_POLL_STARTED))
>> - return;
>> - vhost_poll_stop(net->poll + VHOST_NET_VQ_TX);
>> - net->tx_poll_state = VHOST_NET_POLL_STOPPED;
>> -}
>> -
>> -/* Caller must have TX VQ lock */
>> -static void tx_poll_start(struct vhost_net *net, struct socket *sock)
>> -{
>> - if (unlikely(net->tx_poll_state != VHOST_NET_POLL_STOPPED))
>> - return;
>> - vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file);
>> - net->tx_poll_state = VHOST_NET_POLL_STARTED;
>> -}
>> -
>> /* In case of DMA done not in order in lower device driver for some reason.
>> * upend_idx is used to track end of used idx, done_idx is used to track head
>> * of used idx. Once lower device DMA done contiguously, we will signal KVM
>> @@ -252,7 +224,7 @@ static void handle_tx(struct vhost_net *net)
>> wmem = atomic_read(&sock->sk->sk_wmem_alloc);
>> if (wmem >= sock->sk->sk_sndbuf) {
>> mutex_lock(&vq->mutex);
>> - tx_poll_start(net, sock);
>> + vhost_poll_start(net->poll + VHOST_NET_VQ_TX, sock->file);
>> mutex_unlock(&vq->mutex);
>> return;
>> }
>> @@ -261,7 +233,7 @@ static void handle_tx(struct vhost_net *net)
>> vhost_disable_notify(&net->dev, vq);
>>
>> if (wmem < sock->sk->sk_sndbuf / 2)
>> - tx_poll_stop(net);
>> + vhost_poll_stop(net->poll + VHOST_NET_VQ_TX);
>> hdr_size = vq->vhost_hlen;
>> zcopy = vq->ubufs;
>>
>> @@ -283,7 +255,8 @@ static void handle_tx(struct vhost_net *net)
>>
>> wmem = atomic_read(&sock->sk->sk_wmem_alloc);
>> if (wmem >= sock->sk->sk_sndbuf * 3 / 4) {
>> - tx_poll_start(net, sock);
>> + vhost_poll_start(net->poll + VHOST_NET_VQ_TX,
>> + sock->file);
>> set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
>> break;
>> }
>> @@ -294,7 +267,8 @@ static void handle_tx(struct vhost_net *net)
>> (vq->upend_idx - vq->done_idx) :
>> (vq->upend_idx + UIO_MAXIOV - vq->done_idx);
>> if (unlikely(num_pends > VHOST_MAX_PEND)) {
>> - tx_poll_start(net, sock);
>> + vhost_poll_start(net->poll + VHOST_NET_VQ_TX,
>> + sock->file);
>> set_bit(SOCK_ASYNC_NOSPACE, &sock->flags);
>> break;
>> }
>> @@ -360,7 +334,8 @@ static void handle_tx(struct vhost_net *net)
>> }
>> vhost_discard_vq_desc(vq, 1);
>> if (err == -EAGAIN || err == -ENOBUFS)
>> - tx_poll_start(net, sock);
>> + vhost_poll_start(net->poll + VHOST_NET_VQ_TX,
>> + sock->file);
>> break;
>> }
>> if (err != len)
>> @@ -623,7 +598,6 @@ static int vhost_net_open(struct inode *inode, struct file *f)
>>
>> vhost_poll_init(n->poll + VHOST_NET_VQ_TX, handle_tx_net, POLLOUT, dev);
>> vhost_poll_init(n->poll + VHOST_NET_VQ_RX, handle_rx_net, POLLIN, dev);
>> - n->tx_poll_state = VHOST_NET_POLL_DISABLED;
>>
>> f->private_data = n;
>>
>> @@ -635,27 +609,26 @@ static void vhost_net_disable_vq(struct vhost_net *n,
>> {
>> if (!vq->private_data)
>> return;
>> - if (vq == n->vqs + VHOST_NET_VQ_TX) {
>> - tx_poll_stop(n);
>> - n->tx_poll_state = VHOST_NET_POLL_DISABLED;
>> - } else
>> + if (vq == n->vqs + VHOST_NET_VQ_TX)
>> + vhost_poll_stop(n->poll + VHOST_NET_VQ_TX);
>> + else
>> vhost_poll_stop(n->poll + VHOST_NET_VQ_RX);
>> }
>>
>> -static void vhost_net_enable_vq(struct vhost_net *n,
>> - struct vhost_virtqueue *vq)
>> +static int vhost_net_enable_vq(struct vhost_net *n,
>> + struct vhost_virtqueue *vq)
>> {
>> + int err, index = vq - n->vqs;
>> struct socket *sock;
>>
>> sock = rcu_dereference_protected(vq->private_data,
>> lockdep_is_held(&vq->mutex));
>> if (!sock)
>> - return;
>> - if (vq == n->vqs + VHOST_NET_VQ_TX) {
>> - n->tx_poll_state = VHOST_NET_POLL_STOPPED;
>> - tx_poll_start(n, sock);
>> - } else
>> - vhost_poll_start(n->poll + VHOST_NET_VQ_RX, sock->file);
>> + return 0;
>> +
>> + n->poll[index].state = VHOST_POLL_STOPPED;
>> + err = vhost_poll_start(n->poll + index, sock->file);
>> + return err;
>> }
>>
>> static struct socket *vhost_net_stop_vq(struct vhost_net *n,
>> @@ -831,12 +804,16 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
>> vq->ubufs = ubufs;
>> vhost_net_disable_vq(n, vq);
>> rcu_assign_pointer(vq->private_data, sock);
>> - vhost_net_enable_vq(n, vq);
>> + r = vhost_net_enable_vq(n, vq);
>> + if (r) {
>> + sock = NULL;
>> + goto err_enable;
>> + }
>>
>> r = vhost_init_used(vq);
>> if (r) {
>> sock = NULL;
>> - goto err_used;
>> + goto err_enable;
>> }
>>
>> n->tx_packets = 0;
>> @@ -861,7 +838,7 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
>> mutex_unlock(&n->dev.mutex);
>> return 0;
>>
>> -err_used:
>> +err_enable:
>> if (oldubufs)
>> vhost_ubuf_put_and_wait(oldubufs);
>> if (oldsock)
>> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
>> index 34389f7..1cb2604 100644
>> --- a/drivers/vhost/vhost.c
>> +++ b/drivers/vhost/vhost.c
>> @@ -77,26 +77,36 @@ void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
>> init_poll_funcptr(&poll->table, vhost_poll_func);
>> poll->mask = mask;
>> poll->dev = dev;
>> + poll->state = VHOST_POLL_DISABLED;
>>
>> vhost_work_init(&poll->work, fn);
>> }
>>
>> /* Start polling a file. We add ourselves to file's wait queue. The caller must
>> * keep a reference to a file until after vhost_poll_stop is called. */
>> -void vhost_poll_start(struct vhost_poll *poll, struct file *file)
>> +int vhost_poll_start(struct vhost_poll *poll, struct file *file)
>> {
>> unsigned long mask;
>> + if (unlikely(poll->state != VHOST_POLL_STOPPED))
>> + return 0;
>>
>> mask = file->f_op->poll(file, &poll->table);
>> + if (mask & POLLERR)
>> + return -EINVAL;
>> if (mask)
>> vhost_poll_wakeup(&poll->wait, 0, 0, (void *)mask);
>> + poll->state = VHOST_POLL_STARTED;
>> + return 0;
>> }
>>
> Hmm, interesting. I note that tun has this:
>
> if (tun->dev->reg_state != NETREG_REGISTERED)
> mask = POLLERR;
>
> So apparently we sometimes return POLLERR when poll
> did succeed, then test below wouldn't remove
> from wqh in this case. Maybe it's a bug in tun,
> need to look into this.
Looks a bug of tun to me, looks like a POLLHUP is better here.
>
>> /* Stop polling a file. After this function returns, it becomes safe to drop the
>> * file reference. You must also flush afterwards. */
>> void vhost_poll_stop(struct vhost_poll *poll)
>> {
>> + if (likely(poll->state != VHOST_POLL_STARTED))
>> + return;
>> remove_wait_queue(poll->wqh, &poll->wait);
>> + poll->state = VHOST_POLL_STOPPED;
>> }
>>
>> static bool vhost_work_seq_done(struct vhost_dev *dev, struct vhost_work *work,
>> @@ -791,8 +801,10 @@ long vhost_vring_ioctl(struct vhost_dev *d, int ioctl, void __user *argp)
>> if (filep)
>> fput(filep);
>>
>> - if (pollstart && vq->handle_kick)
>> + if (pollstart && vq->handle_kick) {
>> + vq->poll.state = VHOST_POLL_STOPPED;
>> vhost_poll_start(&vq->poll, vq->kick);
>> + }
>>
>> mutex_unlock(&vq->mutex);
>>
>> diff --git a/drivers/vhost/vhost.h b/drivers/vhost/vhost.h
>> index 2639c58..98861d9 100644
>> --- a/drivers/vhost/vhost.h
>> +++ b/drivers/vhost/vhost.h
>> @@ -26,6 +26,12 @@ struct vhost_work {
>> unsigned done_seq;
>> };
>>
>> +enum vhost_poll_state {
>> + VHOST_POLL_DISABLED = 0,
>> + VHOST_POLL_STARTED = 1,
>> + VHOST_POLL_STOPPED = 2,
>> +};
>> +
>> /* Poll a file (eventfd or socket) */
>> /* Note: there's nothing vhost specific about this structure. */
>> struct vhost_poll {
>> @@ -35,6 +41,9 @@ struct vhost_poll {
>> struct vhost_work work;
>> unsigned long mask;
>> struct vhost_dev *dev;
>> + /* Tells us whether we are polling a file.
>> + * Protected by tx vq lock. */
> tx vq lock does not make sense in this context.
Yes, thanks for pointing this out.
>> + enum vhost_poll_state state;
>> };
>>
>> void vhost_work_init(struct vhost_work *work, vhost_work_fn_t fn);
>> @@ -42,7 +51,7 @@ void vhost_work_queue(struct vhost_dev *dev, struct vhost_work *work);
>>
>> void vhost_poll_init(struct vhost_poll *poll, vhost_work_fn_t fn,
>> unsigned long mask, struct vhost_dev *dev);
>> -void vhost_poll_start(struct vhost_poll *poll, struct file *file);
>> +int vhost_poll_start(struct vhost_poll *poll, struct file *file);
>> void vhost_poll_stop(struct vhost_poll *poll);
>> void vhost_poll_flush(struct vhost_poll *poll);
>> void vhost_poll_queue(struct vhost_poll *poll);
>> --
>> 1.7.1
^ permalink raw reply
* Re: how to look for source code in kernel
From: anish singh @ 2012-12-28 4:49 UTC (permalink / raw)
To: Henrique Rodrigues
Cc: Jonathan Neuschäfer, kishore kumar, Kernelnewbies,
linux-kernel
In-Reply-To: <CABuSbKbk5DdhvuwYUeLkm=eub1CsSaOB_oX7bkBZcAV_MNsSdg@mail.gmail.com>
On Fri, Dec 28, 2012 at 1:23 AM, Henrique Rodrigues
<henriquesilvar@gmail.com> wrote:
> http://lxr.linux.no/ is a really good linux cross referencing website for
> code reference.
>
> On Thu, Dec 27, 2012 at 10:40 AM, Jonathan Neuschäfer
> <j.neuschaefer@gmx.net> wrote:
>>
>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>> > can anybody tell me how to look into source code, as most are hidden in
>> > kernel.
>>
>> You can find the Linux source code at http://kernel.org/ .
for browsing the code unfortunately there is no good tool as in windows we
have source insight.We can use wine in linux but that sucks.
>>
>> HTH,
>> Jonathan Neuschäfer
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies@kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
>
> --
> Henrique Rodrigues
> http://www.dcc.ufmg.br/~hsr
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies@kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
^ permalink raw reply
* how to look for source code in kernel
From: anish singh @ 2012-12-28 4:49 UTC (permalink / raw)
To: kernelnewbies
In-Reply-To: <CABuSbKbk5DdhvuwYUeLkm=eub1CsSaOB_oX7bkBZcAV_MNsSdg@mail.gmail.com>
On Fri, Dec 28, 2012 at 1:23 AM, Henrique Rodrigues
<henriquesilvar@gmail.com> wrote:
> http://lxr.linux.no/ is a really good linux cross referencing website for
> code reference.
>
> On Thu, Dec 27, 2012 at 10:40 AM, Jonathan Neusch?fer
> <j.neuschaefer@gmx.net> wrote:
>>
>> On Thu, Dec 27, 2012 at 11:01:52PM +0530, kishore kumar wrote:
>> > can anybody tell me how to look into source code, as most are hidden in
>> > kernel.
>>
>> You can find the Linux source code at http://kernel.org/ .
for browsing the code unfortunately there is no good tool as in windows we
have source insight.We can use wine in linux but that sucks.
>>
>> HTH,
>> Jonathan Neusch?fer
>>
>> _______________________________________________
>> Kernelnewbies mailing list
>> Kernelnewbies at kernelnewbies.org
>> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>
>
>
> --
> Henrique Rodrigues
> http://www.dcc.ufmg.br/~hsr
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
^ permalink raw reply
* Re: [PATCH 01/19] netfilter: move nf_conntrack initialize out of pernet operations
From: Eric W. Biederman @ 2012-12-28 4:48 UTC (permalink / raw)
To: canqun zhang
Cc: Gao feng, netfilter-devel, netdev@vger.kernel.org,
Patrick McHardy, pablo
In-Reply-To: <CAFFEFTXT_fkF2pPSxDEEgic80NVWLqBWtFuvs6W9uDUW2aCnqw@mail.gmail.com>
canqun zhang <canqunzhang@gmail.com> writes:
> Hi all
> As discussed above,if the host machine create several linux
> containers, there will be several net namespaces.Resources with "nf
> conntrack" are registered or unregistered on the first net
> namespace(init_net),But init_net is not unregistered lastly,so
> cleanuping other net namespaces will triger painic.
> If net namespaces are created with the order of 1,2,...n,they should
> be cleaned with the order of n,...2,1,so in this case init_net will be
> unregistered lastly.
No. Network namespaces in general can be cleaned up in any order.
In particular you should never ever expect to see the order
n,n-1,n-2,...,2,1.
It may make sense to special case init_net in the cleanup order
but I would really rather not.
Now init_net is special and really should never be cleaned up
for non-modular code. So it almost makes sense to special
case init_net.
Does anyone know why Alexy decided to do this only for init_net?
My inclination is that Gao Feng is on the rigt path by just removing
the strange init_net special case and performing the work once
per module load, and once per module unload.
> I fixed it up (see below). I have taken a lot of test!
Thank you.
It is nice to see that we have exposed this mis-assumption.
I am inclined to leave the order of this list as is so that
other assumptions of network namespace unregistration order
are exposed.
Unless there is a truly good reason to perform magic on init_net.
Eric
> diff -r 6a1a258923f5 -r 2667e89e6f50 net/core/net_namespace.c
> --- a/net/core/net_namespace.c Fri Dec 28 11:01:17 2012 +0800
> +++ b/net/core/net_namespace.c Fri Dec 28 11:05:12 2012 +0800
> @@ -450,7 +450,7 @@
>
> list_del(&ops->list);
> for_each_net(net)
> - list_add_tail(&net->exit_list, &net_exit_list);
> + list_add(&net->exit_list, &net_exit_list);
> ops_exit_list(ops, &net_exit_list);
> ops_free_list(ops, &net_exit_lis
>
^ permalink raw reply
* Re: [PATCH] modpost: Ignore ARC specific non-alloc sections
From: Vineet Gupta @ 2012-12-28 4:42 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: Tony Lindgren, linux-kernel, linux-arch
In-Reply-To: <20121227204816.GA2068@merkur.ravnborg.org>
On Friday 28 December 2012 02:18 AM, Sam Ravnborg wrote:
> On Thu, Dec 27, 2012 at 04:17:20PM +0530, Vineet Gupta wrote:
>> ARC relocatable object files contain one/more .gnu.linkonce.arcextmap.*
>> sections (collated by kernel/vmlinux.lds into .arcextmap in final link).
>> This section is used by debuggers to display the extension instructions
>> and need-not be loaded by target (hence !SHF_ALLOC)
>>
>> The final kernel binary only needs .arcextmap entry in modpost's ignore
>> list (section_white_list[]). However when building modules, modpost scans
>> each object file individually, hence tripping on non-aggregated
>> .gnu.linkonce.arcextmap.* entries as well.
>
> The list exist for this particular purpose.
> So acked.
>
>>
>> Thus need for the 2 entires !
>>
>> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> Acked-by: Sam Ravnborg <sam@ravnborg.org>
>
>
> Sam
>
Thx,
-Vineet
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.