diff mbox

Revert "fsp/console: Allocate irq for each hvc console"

Message ID 1479791953-16820-1-git-send-email-ppaidipe@linux.vnet.ibm.com
State Changes Requested
Headers show

Commit Message

ppaidipe Nov. 22, 2016, 5:19 a.m. UTC
This reverts commit 583c8203dcb26b42cea81e4734ea926dae05dbb9.

Below is the WARNING in pre 4.2 linux kernels which is raised in firenze
systems due to interrupts mapping failure.

[    0.947741] irq: irq-62==>hwirq-0x3e mapping failed: -22
[    0.947793] ------------[ cut here ]------------
[    0.947838] WARNING: at kernel/irq/irqdomain.c:485

So this commit 583c8203dcb26b42cea81e4734ea926dae05dbb9 is causing
the above kernel WARNING(found by git-bisect).

Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
---
 hw/fsp/fsp-console.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

Comments

Sam Mendoza-Jonas Nov. 23, 2016, 5:52 a.m. UTC | #1
On Tue, 2016-11-22 at 10:49 +0530, Pridhiviraj Paidipeddi wrote:
> This reverts commit 583c8203dcb26b42cea81e4734ea926dae05dbb9.

Stewart, please don't merge this yet.
Without the patch to add irqs for hvc consoles, we'll get the original
lockup problem in Linux 4.2+ that this aimed to solve. We'll need to
work out something to make older kernels happy.

> 
> Below is the WARNING in pre 4.2 linux kernels which is raised in firenze
> systems due to interrupts mapping failure.
> 
> [    0.947741] irq: irq-62==>hwirq-0x3e mapping failed: -22
> [    0.947793] ------------[ cut here ]------------
> [    0.947838] WARNING: at kernel/irq/irqdomain.c:485
> 
> So this commit 583c8203dcb26b42cea81e4734ea926dae05dbb9 is causing
> the above kernel WARNING(found by git-bisect).
> 
> Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
> ---
>  hw/fsp/fsp-console.c | 26 +++++---------------------
>  1 file changed, 5 insertions(+), 21 deletions(-)
> 
> diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
> index 0080d73..5e27197 100644
> --- a/hw/fsp/fsp-console.c
> +++ b/hw/fsp/fsp-console.c
> @@ -55,7 +55,6 @@ struct fsp_serial {
>  	struct fsp_serbuf_hdr	*out_buf;
>  	struct fsp_msg		*poke_msg;
>  	u8			waiting;
> -	u64			irq;
>  };
>  
>  #define SER_BUFFER_SIZE 0x00040000UL
> @@ -194,7 +193,6 @@ static size_t fsp_write_vserial(struct fsp_serial *fs, const char *buf,
>  #ifndef DISABLE_CON_PENDING_EVT
>  	opal_update_pending_evt(OPAL_EVENT_CONSOLE_OUTPUT,
>  				OPAL_EVENT_CONSOLE_OUTPUT);
> -	opal_update_pending_evt(fs->irq, fs->irq);
>  #endif
>  	return len;
>  }
> @@ -467,7 +465,6 @@ static bool fsp_con_msg_vt(u32 cmd_sub_mod, struct fsp_msg *msg)
>  		lock(&fsp_con_lock);
>  		opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT,
>  					OPAL_EVENT_CONSOLE_INPUT);
> -		opal_update_pending_evt(fs->irq, fs->irq);
>  		unlock(&fsp_con_lock);
>  	}
>  	return true;
> @@ -707,10 +704,8 @@ static int64_t fsp_console_read(int64_t term_number, int64_t *length,
>  			}
>  		}
>  	}
> -	if (!pending) {
> -		opal_update_pending_evt(fs->irq, 0);
> +	if (!pending)
>  		opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT, 0);
> -	}
>  
>  	unlock(&fsp_con_lock);
>  
> @@ -746,14 +741,11 @@ void fsp_console_poll(void *data __unused)
>  
>  			if (!fs->open)
>  				continue;
> -			if (sb->next_out == sb->next_in) {
> -				opal_update_pending_evt(fs->irq, 0);
> +			if (sb->next_out == sb->next_in)
>  				continue;
> -			}
> -			if (fs->log_port) {
> +			if (fs->log_port)
>  				__flush_console(true);
> -				opal_update_pending_evt(fs->irq, 0);
> -			} else {
> +			else {
>  #ifdef OPAL_DEBUG_CONSOLE_POLL
>  				if (debug < 5) {
>  					prlog(PR_DEBUG,"OPAL: %d still pending"
> @@ -918,7 +910,7 @@ void fsp_console_reset(void)
>  void fsp_console_add_nodes(void)
>  {
>  	unsigned int i;
> -	struct dt_node *consoles, *opal_event;
> +	struct dt_node *consoles;
>  
>  	consoles = dt_new(opal_node, "consoles");
>  	dt_add_property_cells(consoles, "#address-cells", 1);
> @@ -943,14 +935,6 @@ void fsp_console_add_nodes(void)
>  				     "#write-buffer-size", SER_BUF_DATA_SIZE);
>  		dt_add_property_cells(fs_node, "reg", i);
>  		dt_add_property_string(fs_node, "device_type", "serial");
> -
> -		fs->irq = opal_dynamic_event_alloc();
> -		dt_add_property_cells(fs_node, "interrupts", ilog2(fs->irq));
> -
> -		opal_event = dt_find_by_name(opal_node, "event");
> -		if (opal_event)
> -			dt_add_property_cells(fs_node, "interrupt-parent",
> -					      opal_event->phandle);
>  	}
>  }
>
Sam Mendoza-Jonas Nov. 23, 2016, 6:03 a.m. UTC | #2
On Wed, 2016-11-23 at 16:52 +1100, Samuel Mendoza-Jonas wrote:
> On Tue, 2016-11-22 at 10:49 +0530, Pridhiviraj Paidipeddi wrote:
> > This reverts commit 583c8203dcb26b42cea81e4734ea926dae05dbb9.
> 
> Stewart, please don't merge this yet.
> Without the patch to add irqs for hvc consoles, we'll get the original
> lockup problem in Linux 4.2+ that this aimed to solve. We'll need to
> work out something to make older kernels happy.

Ah as I page this back into my brain we should be saved by commit fd6b71fc
which ignores unresponsive consoles (eg. hvc1). Still, without this patch
host serial will be unusable on Firenze systems.

> 
> > 
> > Below is the WARNING in pre 4.2 linux kernels which is raised in firenze
> > systems due to interrupts mapping failure.
> > 
> > [    0.947741] irq: irq-62==>hwirq-0x3e mapping failed: -22
> > [    0.947793] ------------[ cut here ]------------
> > [    0.947838] WARNING: at kernel/irq/irqdomain.c:485
> > 
> > So this commit 583c8203dcb26b42cea81e4734ea926dae05dbb9 is causing
> > the above kernel WARNING(found by git-bisect).
> > 
> > Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
> > ---
> >  hw/fsp/fsp-console.c | 26 +++++---------------------
> >  1 file changed, 5 insertions(+), 21 deletions(-)
> > 
> > diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
> > index 0080d73..5e27197 100644
> > --- a/hw/fsp/fsp-console.c
> > +++ b/hw/fsp/fsp-console.c
> > @@ -55,7 +55,6 @@ struct fsp_serial {
> >  	struct fsp_serbuf_hdr	*out_buf;
> >  	struct fsp_msg		*poke_msg;
> >  	u8			waiting;
> > -	u64			irq;
> >  };
> >  
> >  #define SER_BUFFER_SIZE 0x00040000UL
> > @@ -194,7 +193,6 @@ static size_t fsp_write_vserial(struct fsp_serial *fs, const char *buf,
> >  #ifndef DISABLE_CON_PENDING_EVT
> >  	opal_update_pending_evt(OPAL_EVENT_CONSOLE_OUTPUT,
> >  				OPAL_EVENT_CONSOLE_OUTPUT);
> > -	opal_update_pending_evt(fs->irq, fs->irq);
> >  #endif
> >  	return len;
> >  }
> > @@ -467,7 +465,6 @@ static bool fsp_con_msg_vt(u32 cmd_sub_mod, struct fsp_msg *msg)
> >  		lock(&fsp_con_lock);
> >  		opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT,
> >  					OPAL_EVENT_CONSOLE_INPUT);
> > -		opal_update_pending_evt(fs->irq, fs->irq);
> >  		unlock(&fsp_con_lock);
> >  	}
> >  	return true;
> > @@ -707,10 +704,8 @@ static int64_t fsp_console_read(int64_t term_number, int64_t *length,
> >  			}
> >  		}
> >  	}
> > -	if (!pending) {
> > -		opal_update_pending_evt(fs->irq, 0);
> > +	if (!pending)
> >  		opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT, 0);
> > -	}
> >  
> >  	unlock(&fsp_con_lock);
> >  
> > @@ -746,14 +741,11 @@ void fsp_console_poll(void *data __unused)
> >  
> >  			if (!fs->open)
> >  				continue;
> > -			if (sb->next_out == sb->next_in) {
> > -				opal_update_pending_evt(fs->irq, 0);
> > +			if (sb->next_out == sb->next_in)
> >  				continue;
> > -			}
> > -			if (fs->log_port) {
> > +			if (fs->log_port)
> >  				__flush_console(true);
> > -				opal_update_pending_evt(fs->irq, 0);
> > -			} else {
> > +			else {
> >  #ifdef OPAL_DEBUG_CONSOLE_POLL
> >  				if (debug < 5) {
> >  					prlog(PR_DEBUG,"OPAL: %d still pending"
> > @@ -918,7 +910,7 @@ void fsp_console_reset(void)
> >  void fsp_console_add_nodes(void)
> >  {
> >  	unsigned int i;
> > -	struct dt_node *consoles, *opal_event;
> > +	struct dt_node *consoles;
> >  
> >  	consoles = dt_new(opal_node, "consoles");
> >  	dt_add_property_cells(consoles, "#address-cells", 1);
> > @@ -943,14 +935,6 @@ void fsp_console_add_nodes(void)
> >  				     "#write-buffer-size", SER_BUF_DATA_SIZE);
> >  		dt_add_property_cells(fs_node, "reg", i);
> >  		dt_add_property_string(fs_node, "device_type", "serial");
> > -
> > -		fs->irq = opal_dynamic_event_alloc();
> > -		dt_add_property_cells(fs_node, "interrupts", ilog2(fs->irq));
> > -
> > -		opal_event = dt_find_by_name(opal_node, "event");
> > -		if (opal_event)
> > -			dt_add_property_cells(fs_node, "interrupt-parent",
> > -					      opal_event->phandle);
> >  	}
> >  }
> >  
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
Alistair Popple Nov. 23, 2016, 6:08 a.m. UTC | #3
Hi,

On Wed, 23 Nov 2016 05:03:22 PM Samuel Mendoza-Jonas wrote:
> On Wed, 2016-11-23 at 16:52 +1100, Samuel Mendoza-Jonas wrote:
> > On Tue, 2016-11-22 at 10:49 +0530, Pridhiviraj Paidipeddi wrote:
> > > This reverts commit 583c8203dcb26b42cea81e4734ea926dae05dbb9.
> > 
> > Stewart, please don't merge this yet.
> > Without the patch to add irqs for hvc consoles, we'll get the original
> > lockup problem in Linux 4.2+ that this aimed to solve. We'll need to
> > work out something to make older kernels happy.
> 
> Ah as I page this back into my brain we should be saved by commit fd6b71fc
> which ignores unresponsive consoles (eg. hvc1). Still, without this patch
> host serial will be unusable on Firenze systems.
> 
> > 
> > > 
> > > Below is the WARNING in pre 4.2 linux kernels which is raised in firenze
> > > systems due to interrupts mapping failure.
> > > 
> > > [    0.947741] irq: irq-62==>hwirq-0x3e mapping failed: -22
> > > [    0.947793] ------------[ cut here ]------------
> > > [    0.947838] WARNING: at kernel/irq/irqdomain.c:485
> > > 
> > > So this commit 583c8203dcb26b42cea81e4734ea926dae05dbb9 is causing
> > > the above kernel WARNING(found by git-bisect).
> > > 
> > > Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
> > > ---
> > > -
> > > -		opal_event = dt_find_by_name(opal_node, "event");
> > > -		if (opal_event)
> > > -			dt_add_property_cells(fs_node, "interrupt-parent",
> > > -					      opal_event->phandle);

I think the correct fix is probably just to revert those lines. That should 
avoid the warning but not result in any functional change, although I will 
have to check all the kernel sides.

- Alistair

> > >  	}
> > >  }
> > 
> > _______________________________________________
> > Skiboot mailing list
> > Skiboot@lists.ozlabs.org
> > https://lists.ozlabs.org/listinfo/skiboot
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
>
Stewart Smith Feb. 6, 2017, 4:21 a.m. UTC | #4
Alistair Popple <alistair@popple.id.au> writes:
> On Wed, 23 Nov 2016 05:03:22 PM Samuel Mendoza-Jonas wrote:
>> On Wed, 2016-11-23 at 16:52 +1100, Samuel Mendoza-Jonas wrote:
>> > On Tue, 2016-11-22 at 10:49 +0530, Pridhiviraj Paidipeddi wrote:
>> > > This reverts commit 583c8203dcb26b42cea81e4734ea926dae05dbb9.
>> > 
>> > Stewart, please don't merge this yet.
>> > Without the patch to add irqs for hvc consoles, we'll get the original
>> > lockup problem in Linux 4.2+ that this aimed to solve. We'll need to
>> > work out something to make older kernels happy.
>> 
>> Ah as I page this back into my brain we should be saved by commit fd6b71fc
>> which ignores unresponsive consoles (eg. hvc1). Still, without this patch
>> host serial will be unusable on Firenze systems.
>> 
>> > 
>> > > 
>> > > Below is the WARNING in pre 4.2 linux kernels which is raised in firenze
>> > > systems due to interrupts mapping failure.
>> > > 
>> > > [    0.947741] irq: irq-62==>hwirq-0x3e mapping failed: -22
>> > > [    0.947793] ------------[ cut here ]------------
>> > > [    0.947838] WARNING: at kernel/irq/irqdomain.c:485
>> > > 
>> > > So this commit 583c8203dcb26b42cea81e4734ea926dae05dbb9 is causing
>> > > the above kernel WARNING(found by git-bisect).
>> > > 
>> > > Signed-off-by: Pridhiviraj Paidipeddi <ppaidipe@linux.vnet.ibm.com>
>> > > ---
>> > > -
>> > > -		opal_event = dt_find_by_name(opal_node, "event");
>> > > -		if (opal_event)
>> > > -			dt_add_property_cells(fs_node, "interrupt-parent",
>> > > -					      opal_event->phandle);
>
> I think the correct fix is probably just to revert those lines. That should 
> avoid the warning but not result in any functional change, although I will 
> have to check all the kernel sides.

Any further thoughts? Or a patch perchance?
Vasant Hegde June 16, 2017, 5:22 a.m. UTC | #5
On 11/22/2016 10:49 AM, Pridhiviraj Paidipeddi wrote:
> This reverts commit 583c8203dcb26b42cea81e4734ea926dae05dbb9.
>

Stewart,

I think we should apply this patch to 5.4.x stable branch. This will avoid below 
kernel message on pre 4.2 kernel.

-Vasant
Alistair Popple June 16, 2017, 6:04 a.m. UTC | #6
On Fri, 16 Jun 2017 10:52:41 AM Vasant Hegde wrote:
> On 11/22/2016 10:49 AM, Pridhiviraj Paidipeddi wrote:
> > This reverts commit 583c8203dcb26b42cea81e4734ea926dae05dbb9.
> >
> 
> Stewart,
> 
> I think we should apply this patch to 5.4.x stable branch. This will avoid below 
> kernel message on pre 4.2 kernel.

I believe reverting just these lines is the better fix:

-         opal_event = dt_find_by_name(opal_node, "event");
-         if (opal_event)
-                 dt_add_property_cells(fs_node, "interrupt-parent",
-                                       opal_event->phandle);

This needs to be tested on both pre and post 4.2 kernels, however I simply
haven't found the time yet sorry. Vasant if you could see if that fixes your
issue that would be great!

Thanks.

- Alistair

> -Vasant
> 
> _______________________________________________
> Skiboot mailing list
> Skiboot@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/skiboot
>
diff mbox

Patch

diff --git a/hw/fsp/fsp-console.c b/hw/fsp/fsp-console.c
index 0080d73..5e27197 100644
--- a/hw/fsp/fsp-console.c
+++ b/hw/fsp/fsp-console.c
@@ -55,7 +55,6 @@  struct fsp_serial {
 	struct fsp_serbuf_hdr	*out_buf;
 	struct fsp_msg		*poke_msg;
 	u8			waiting;
-	u64			irq;
 };
 
 #define SER_BUFFER_SIZE 0x00040000UL
@@ -194,7 +193,6 @@  static size_t fsp_write_vserial(struct fsp_serial *fs, const char *buf,
 #ifndef DISABLE_CON_PENDING_EVT
 	opal_update_pending_evt(OPAL_EVENT_CONSOLE_OUTPUT,
 				OPAL_EVENT_CONSOLE_OUTPUT);
-	opal_update_pending_evt(fs->irq, fs->irq);
 #endif
 	return len;
 }
@@ -467,7 +465,6 @@  static bool fsp_con_msg_vt(u32 cmd_sub_mod, struct fsp_msg *msg)
 		lock(&fsp_con_lock);
 		opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT,
 					OPAL_EVENT_CONSOLE_INPUT);
-		opal_update_pending_evt(fs->irq, fs->irq);
 		unlock(&fsp_con_lock);
 	}
 	return true;
@@ -707,10 +704,8 @@  static int64_t fsp_console_read(int64_t term_number, int64_t *length,
 			}
 		}
 	}
-	if (!pending) {
-		opal_update_pending_evt(fs->irq, 0);
+	if (!pending)
 		opal_update_pending_evt(OPAL_EVENT_CONSOLE_INPUT, 0);
-	}
 
 	unlock(&fsp_con_lock);
 
@@ -746,14 +741,11 @@  void fsp_console_poll(void *data __unused)
 
 			if (!fs->open)
 				continue;
-			if (sb->next_out == sb->next_in) {
-				opal_update_pending_evt(fs->irq, 0);
+			if (sb->next_out == sb->next_in)
 				continue;
-			}
-			if (fs->log_port) {
+			if (fs->log_port)
 				__flush_console(true);
-				opal_update_pending_evt(fs->irq, 0);
-			} else {
+			else {
 #ifdef OPAL_DEBUG_CONSOLE_POLL
 				if (debug < 5) {
 					prlog(PR_DEBUG,"OPAL: %d still pending"
@@ -918,7 +910,7 @@  void fsp_console_reset(void)
 void fsp_console_add_nodes(void)
 {
 	unsigned int i;
-	struct dt_node *consoles, *opal_event;
+	struct dt_node *consoles;
 
 	consoles = dt_new(opal_node, "consoles");
 	dt_add_property_cells(consoles, "#address-cells", 1);
@@ -943,14 +935,6 @@  void fsp_console_add_nodes(void)
 				     "#write-buffer-size", SER_BUF_DATA_SIZE);
 		dt_add_property_cells(fs_node, "reg", i);
 		dt_add_property_string(fs_node, "device_type", "serial");
-
-		fs->irq = opal_dynamic_event_alloc();
-		dt_add_property_cells(fs_node, "interrupts", ilog2(fs->irq));
-
-		opal_event = dt_find_by_name(opal_node, "event");
-		if (opal_event)
-			dt_add_property_cells(fs_node, "interrupt-parent",
-					      opal_event->phandle);
 	}
 }